Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

htstring.h

Go to the documentation of this file.
00001 /* 
00002  *      HT Editor
00003  *      htstring.h
00004  *
00005  *      Copyright (C) 1999-2002 Stefan Weyergraf (stefan@weyergraf.de)
00006  *
00007  *      This program is free software; you can redistribute it and/or modify
00008  *      it under the terms of the GNU General Public License version 2 as
00009  *      published by the Free Software Foundation.
00010  *
00011  *      This program is distributed in the hope that it will be useful,
00012  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *      GNU General Public License for more details.
00015  *
00016  *      You should have received a copy of the GNU General Public License
00017  *      along with this program; if not, write to the Free Software
00018  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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 /* common string parsing functions */
00046 
00047 void whitespaces(char **str);
00048 bool waitforchar(char **str, char b);
00049 
00050 /* string evaluation functions */
00051 
00052 bool bnstr(char **str, dword *v, int defaultbase);
00053 bool bnstr(char **str, qword *q, int defaultbase);
00054 
00055 /* hex/string functions */
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  *      CLASS ht_data_string
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 /* overwritten */
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  *      CLASS ht_string_list
00087  */
00088 
00089 class ht_string_list: public ht_clist {
00090 public:
00091                         void init();
00092 /* new */
00093                         char *get_string(UINT i);
00094                         void insert_string(char *s);
00095 };
00096 
00097 /*
00098  *      CLASS ht_sorted_string_list
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 /* new */
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  *      INIT
00114  */
00115 
00116 bool init_string();
00117 
00118 /*
00119  *      DONE
00120  */
00121 
00122 void done_string();
00123 
00124 #endif /* !__HTSTRING_H__ */

Generated on Fri May 7 21:15:37 2004 by doxygen 1.3.5