00001 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 00002 /* _______ ______ ______ __ */ 00003 /* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ / ____(_)___ / ___ /) / ____/___ ____/ /__ */ 00004 /* [fsStrUt] / /_ / / __ \\__ \|/ / / / __ \/ __ / _ \ */ 00005 /* rev. 7 / __/ / / /_/ /__/ / / /___/ /_/ / /_/ / __/ */ 00006 /* 10th Jan 2007 /_/ /_/ ,___/____/ \____/\____/\__,_/\___/ */ 00007 /* [x] stable /_/ (c) 2006-7 Filip STOKLAS (FipS) */ 00008 /* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ http://HOLE.4FipS.com/fips_code.php */ 00009 /* */ 00010 /* This code is free for personal and commercial use. You may redistribute */ 00011 /* it by any means. If you use the code for your own projects please give */ 00012 /* me credit. Please send a bug report. Don't alter or remove this header! */ 00013 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 00014 #ifndef FS_UT_FSSTRUT_H 00015 #define FS_UT_FSSTRUT_H 00016 //--------------------------------------------------------------------------- 00017 #if defined(FS_INCLUDE_USERDEFS) // inject user definition file on request 00018 # include <fs/fsUserDefs.h> 00019 #endif 00020 //--------------------------------------------------------------------------- 00021 namespace fs { namespace ut { 00022 //--------------------------------------------------------------------------- 00024 namespace str { 00025 //--------------------------------------------------------------------------- 00027 char * Int2Str(int nVal, char *pszStr); 00029 void WStr2Str(const wchar_t *pwszWStr, char *pszStr); 00031 void Str2WStr(const char *pszStr, wchar_t *pwszWStr); 00032 //--------------------------------------------------------------------------- 00034 00040 class StrHldr_t 00041 { 00042 public: 00043 00045 explicit StrHldr_t(const char *pszStr); 00047 explicit StrHldr_t(const wchar_t *pwszWStr); 00048 ~StrHldr_t(); 00049 00051 const char * GetStr() const; 00052 00053 private: 00054 00055 StrHldr_t(); 00056 StrHldr_t(const StrHldr_t &); 00057 StrHldr_t & operator = (const StrHldr_t &); 00058 00059 char *m_pszStr; 00060 }; 00061 //--------------------------------------------------------------------------- 00063 00069 class WStrHldr_t 00070 { 00071 public: 00072 00074 explicit WStrHldr_t(wchar_t *pwszWStr); 00076 explicit WStrHldr_t(const char *pszStr); 00077 ~WStrHldr_t(); 00078 00080 const wchar_t * GetWStr() const; 00081 00082 private: 00083 00084 WStrHldr_t(); 00085 WStrHldr_t(const WStrHldr_t &); 00086 WStrHldr_t & operator = (const WStrHldr_t &); 00087 00088 wchar_t *m_pwszWStr; 00089 }; 00090 //--------------------------------------------------------------------------- 00092 00106 class Toknzr_t 00107 { 00108 public: 00109 00111 explicit Toknzr_t(const char *pszText, const char *pszSprs = " \t", 00112 char chQuote = '\"'); 00113 ~Toknzr_t(); 00114 00116 const char * Next(); 00117 00118 private: 00119 00120 Toknzr_t(); 00121 Toknzr_t(const Toknzr_t &); 00122 Toknzr_t & operator = (const Toknzr_t &); 00123 00124 void *m_pImpl; 00125 }; 00126 //--------------------------------------------------------------------------- 00128 00138 class CmdLn_t 00139 { 00140 public: 00141 00143 explicit CmdLn_t(const char *pszCmdLn); 00145 CmdLn_t(int argc, char *argv[]); 00146 ~CmdLn_t(); 00147 00149 const char * GetVal(const char *pszKey) const; 00150 00152 int GetNumToks() const; 00154 const char * GetTok(int nIdx) const; 00156 int FindTok(const char *pszTok) const; 00157 00158 private: 00159 00160 CmdLn_t(); 00161 CmdLn_t(const CmdLn_t &); 00162 CmdLn_t & operator = (const CmdLn_t &); 00163 00164 void *m_pImpl; 00165 }; 00166 //--------------------------------------------------------------------------- 00167 }}} // namespace fs::ut::str 00168 //--------------------------------------------------------------------------- 00169 #endif // FS_UT_FSSTRUT_H