Back to index

Go to the documentation of this file.
00002 /******************************************************************************
00003 * MODULE     : analyze.hpp
00004 * DESCRIPTION: Properties of characters and strings
00005 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <>.
00010 ******************************************************************************/
00012 #ifndef ANALYZE_H
00013 #define ANALYZE_H
00014 #include "string.hpp"
00015 #include "array.hpp"
00016 #include "hashset.hpp"
00018 class object;
00020 bool is_alpha (char c);
00021 bool is_iso_alpha (char c);
00022 bool is_locase (char c);
00023 bool is_upcase (char c);
00024 bool is_digit (char c);
00025 bool is_numeric (char c);
00026 bool is_punctuation (char c);
00027 bool is_space (char s);
00028 bool is_alpha (string s);
00029 bool is_locase_alpha (string s);
00030 bool is_iso_alpha (string s);
00031 bool is_numeric (string s);
00033 char   upcase (char s);
00034 char   locase (char s);
00035 string upcase_first (string s);
00036 string locase_first (string s);
00037 string upcase_all (string s);
00038 string locase_all (string s);
00039 string string_union (string s1, string s2);
00040 string string_minus (string s1, string s2);
00041 string iso_to_koi8 (string s);
00042 string koi8_to_iso (string s);
00043 string iso_to_koi8uk (string s);
00044 string koi8uk_to_iso (string s);
00045 string il2_to_cork (string s);
00046 string cork_to_il2 (string s);
00047 string ispanish_to_spanish (string s);
00048 string spanish_to_ispanish (string s);
00049 string igerman_to_german (string s);
00050 string german_to_igerman (string s);
00051 string old_tm_to_xml_cdata (string s);
00052 object tm_to_xml_cdata (string s);
00053 string old_xml_cdata_to_tm (string s);
00054 string tm_to_xml_name (string s);
00055 string xml_name_to_tm (string s);
00056 string xml_unspace (string s, bool first, bool last);
00057 bool   contains_unicode_char (string s);
00059 string roman_nr (int nr);
00060 string Roman_nr (int nr);
00061 string alpha_nr (int nr);
00062 string Alpha_nr (int nr);
00063 string fnsymbol_nr (int nr);
00065 string as_hexadecimal (int i);
00066 string as_hexadecimal (pointer ptr);
00067 string as_hexadecimal (int i, int length);
00068 int    from_hexadecimal (string s);
00070 string tm_encode (string s);
00071 string tm_decode (string s);
00072 string tm_var_encode (string s);
00073 string tm_correct (string s);
00074 void   tm_char_forwards (string s, int& pos);
00075 void   tm_char_backwards (string s, int& pos);
00076 int    tm_char_next (string s, int pos);
00077 int    tm_char_previous (string s, int pos);
00078 string tm_forward_access (string s, int i);
00079 string tm_backward_access (string s, int i);
00080 int    tm_string_length (string s);
00081 array<string> tm_tokenize (string s);
00082 string tm_recompose (array<string> a);
00084 string scm_quote (string s);
00085 string scm_unquote (string s);
00086 string raw_quote (string s);
00087 string raw_unquote (string s);
00088 string escape_sh (string s);
00089 string escape_generic (string s);
00090 string escape_verbatim (string s);
00091 string escape_spaces (string s);
00092 string dos_to_better (string s);
00094 bool test (string s, int i, const char* test);
00095 bool test (string s, int i, string test);
00096 bool starts (string s, const char* test);
00097 bool starts (string s, const string test);
00098 bool ends (string s, const char* test);
00099 bool ends (string s, const string test);
00100 bool read (string s, int& i, const char* test);
00101 bool read (string s, int& i, string test);
00102 bool read (string s, string test);
00103 bool read_line (string s, int& i, string& result);
00104 bool read_int (string s, int& i, int& result);
00105 bool read_double (string s, int& i, double& result);
00106 void skip_spaces (string s, int& i);
00107 void skip_line (string s, int& i);
00108 void skip_symbol (string s, int& i);
00110 void parse (string s, int& pos, QI& ret);
00111 void parse (string s, int& pos, QN& ret);
00112 void parse (string s, int& pos, HI& ret);
00113 void parse (string s, int& pos, HN& ret);
00114 void parse (string s, int& pos, SI& ret);
00115 void parse (string s, int& pos, SI*& a, int len);
00117 int    search_forwards (string what, string in);
00118 int    search_forwards (string what, int pos, string in);
00119 int    search_backwards (string what, string in);
00120 int    search_backwards (string what, int pos, string in);
00121 int    count_occurrences (string what, string in);
00122 int    count_occurrences (string what, string in);
00123 bool   occurs (string what, string in);
00124 string replace (string s, string what, string by);
00125 bool   match_wildcard (string s, string w);
00126 array<string> tokenize (string s, string sep);
00127 string recompose (array<string> a, string sep);
00128 string trim_spaces (string s);
00129 array<string> trim_spaces (array<string> a);
00131 array<string> as_completions (hashset<string> h);
00132 array<string> close_completions (array<string> a);
00133 array<string> strip_completions (array<string> a, string prefix);
00135 #endif // defined ANALYZE_H