Back to index

lightning-sunbird  0.9+nobinonly
csutil.hxx
Go to the documentation of this file.
00001 #ifndef __CSUTILHXX__
00002 #define __CSUTILHXX__
00003 
00004 
00005 // First some base level utility routines
00006 
00007 // remove end of line char(s)
00008 void   mychomp(char * s);
00009 
00010 // duplicate string                          
00011 char * mystrdup(const char * s);
00012 
00013 // duplicate reverse of string                   
00014 char * myrevstrdup(const char * s);
00015 
00016 // parse into tokens with char delimiter                
00017 char * mystrsep(char ** sptr, const char delim);
00018 
00019 // is one string a leading subset of another   
00020 int    isSubset(const char * s1, const char * s2);
00021 
00022 // is one reverse string a leading subset of the end of another   
00023 int    isRevSubset(const char * s1, const char * end_of_s2, int s2_len);
00024 
00025 
00026 // character encoding information
00027 
00028 struct cs_info {
00029   unsigned char ccase;
00030   unsigned char clower;
00031   unsigned char cupper;
00032 };
00033 
00034 
00035 struct enc_entry {
00036   const char * enc_name;
00037   struct cs_info * cs_table;
00038 };
00039 
00040 // language to encoding default map
00041 
00042 struct lang_map {
00043   const char * lang;
00044   const char * def_enc;
00045 };
00046 
00047 struct cs_info * get_current_cs(const char * es);
00048 
00049 const char * get_default_enc(const char * lang);
00050 
00051 #if 0
00052 // Not needed in mozilla
00053 // convert null terminated string to all caps using encoding 
00054 void enmkallcap(char * d, const char * p, const char * encoding);
00055 
00056 // convert null terminated string to all little using encoding
00057 void enmkallsmall(char * d, const char * p, const char * encoding);
00058 
00059 // convert null terminated string to have intial capital using encoding
00060 void enmkinitcap(char * d, const char * p, const char * encoding);
00061 #endif
00062 
00063 // convert null terminated string to all caps 
00064 void mkallcap(char * p, const struct cs_info * csconv);
00065 
00066 // convert null terminated string to all little
00067 void mkallsmall(char * p, const struct cs_info * csconv);
00068 
00069 // convert null terminated string to have intial capital
00070 void mkinitcap(char * p, const struct cs_info * csconv);
00071 
00072 
00073 #endif