00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __HTSTRING_H__
00022 #define __HTSTRING_H__
00023
00024 #include "global.h"
00025 #include "config.h"
00026 #include "htdata.h"
00027
00028 char *ht_strdup(const char *str);
00029 char *ht_strndup(const char *str, int maxlen);
00030 int ht_strncpy(char *s1, const char *s2, int maxlen);
00031 int ht_strncmp(const char *s1, const char *s2, size_t max);
00032 int ht_strnicmp(const char *s1, const char *s2, size_t max);
00033 int ht_stricmp(const char *s1, const char *s2);
00034
00035 int strcicomm(const char *s1, const char *s2);
00036 int strccomm(const char *s1, const char *s2);
00037 #define strend(s) ((s)+strlen(s))
00038 int escape_special_str(char *result, int resultmaxlen, const char *s, const char *specialchars=0, bool bit7=true);
00039 int escape_special(char *result, int resultmaxlen, const void *s, int len, const char *specialchars=0, bool bit7=true);
00040 int unescape_special_str(char *result, int resultmaxlen, const char *s);
00041 int unescape_special(void *result, int resultmaxlen, const char *s);
00042 int bin2str(char *result, const void *s, int len);
00043 void wide_char_to_multi_byte(char *result, const byte *unicode, int maxlen);
00044
00045
00046
00047 void whitespaces(char **str);
00048 bool waitforchar(char **str, char b);
00049
00050
00051
00052 bool bnstr(char **str, dword *v, int defaultbase);
00053 bool bnstr(char **str, qword *q, int defaultbase);
00054
00055
00056
00057 int hexdigit(char a);
00058
00059 bool hexb_ex(uint8 &result, const char *s);
00060 bool hexw_ex(uint16 &result, const char *s);
00061 bool hexd_ex(uint32 &result, const char *s);
00062
00063 char *mkhexb(char *buf, byte d);
00064 char *mkhexw(char *buf, word d);
00065 char *mkhexd(char *buf, dword d);
00066 char *mkhexq(char *buf, qword q);
00067
00068
00069
00070
00071
00072 class ht_data_string: public Object {
00073 public:
00074 char *value;
00075
00076 ht_data_string(const char *s = 0);
00077 virtual ~ht_data_string();
00078
00079 virtual int load(ht_object_stream *f);
00080 virtual void store(ht_object_stream *f);
00081 virtual int toString(char *s, int maxlen);
00082 virtual OBJECT_ID object_id() const;
00083 };
00084
00085
00086
00087
00088
00089 class ht_string_list: public ht_clist {
00090 public:
00091 void init();
00092
00093 char *get_string(UINT i);
00094 void insert_string(char *s);
00095 };
00096
00097
00098
00099
00100
00101 class ht_sorted_string_list: public ht_sorted_list {
00102 public:
00103 void init(int (*compare_keys_proc)(Object *key_a, Object *key_b));
00104
00105 char *get_string(char *s);
00106 void insert_string(char *s);
00107 };
00108
00109 int compare_keys_string(Object *key_a, Object *key_b);
00110 int icompare_keys_string(Object *key_a, Object *key_b);
00111
00112
00113
00114
00115
00116 bool init_string();
00117
00118
00119
00120
00121
00122 void done_string();
00123
00124 #endif