Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #pragma once
00015 #include <windows.h>
00016 #include "maxheap.h"
00017 #include "strbasic.h"
00018 #include "tab.h"
00019 #include "coreexp.h"
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00058 class CStr: public MaxHeapOperators {
00059 char *buf;
00060 public:
00062 UtilExport CStr();
00064 UtilExport CStr(const char *cs);
00066 UtilExport CStr(const mwchar_t *wcstr);
00068 UtilExport CStr(const CStr& ws);
00070 UtilExport ~CStr();
00072 UtilExport char *data();
00074 UtilExport const char *data() const;
00076 UtilExport operator char *();
00078 UtilExport operator const char *() const;
00079
00080
00086 UtilExport void Resize(int nchars);
00087
00089 UtilExport int Length() const { return ByteCount(); }
00091 int length() const { return Length(); }
00093 UtilExport int ByteCount() const;
00096 UtilExport int LanguageCharacterCount() const;
00097
00100 BOOL isNull() const { return Length()==0?1:0; }
00101
00103 UtilExport CStr & operator=(const CStr& cs);
00105 UtilExport CStr & operator=(const mwchar_t *wcstr);
00107 UtilExport CStr & operator=(const char *cs);
00108
00109
00112 UtilExport CStr operator+(const CStr& cs) const;
00114 UtilExport CStr& operator+=(const CStr& cs);
00116 CStr& Append(const CStr& cs) { return ((*this) += cs); }
00118 CStr& append(const CStr& cs) { return ((*this) += cs); }
00123 UtilExport CStr& remove(int pos);
00130 UtilExport CStr& remove(int pos, int N);
00131
00132
00135 UtilExport CStr Substr(int start, int nchars) const;
00138 UtilExport CStr MultiByteCharacterSubString(int firstCharacterIndex, int numberOfMBCharacters) const;
00141 UtilExport int FindMBCharacterFirstByteIndex(int characterIndex) const;
00144 UtilExport int FindMBCharacterLastByteIndex(int characterIndex) const;
00145
00147 UtilExport char& operator[](int i);
00148
00150 UtilExport char operator[](int i) const;
00151
00152
00155 UtilExport int first(char c) const;
00158 UtilExport int last(char c) const;
00159
00160
00163 UtilExport int operator==(const CStr &cs) const;
00166 UtilExport int operator!=(const CStr &cs) const;
00168 UtilExport int operator<(const CStr &cs) const;
00170 UtilExport int operator<=(const CStr &ws) const;
00172 UtilExport int operator>(const CStr &ws) const;
00174 UtilExport int operator>=(const CStr &ws) const;
00175
00177 UtilExport void toUpper();
00179 UtilExport void toLower();
00180
00194 UtilExport int printf(const char *format, ...);
00195
00212 UtilExport int vprintf(const char *format, va_list args);
00213 };
00214
00215
00216
00217
00218
00228 class WStr: public MaxHeapOperators {
00229 mwchar_t *buf;
00230 public:
00232 UtilExport WStr();
00234 UtilExport WStr(const char *cs);
00236 UtilExport WStr(const mwchar_t *wcstr);
00238 UtilExport WStr(const WStr& ws);
00240 UtilExport ~WStr();
00242 UtilExport mwchar_t *data();
00244 UtilExport const mwchar_t *data() const;
00246 UtilExport operator mwchar_t *();
00248 UtilExport operator const mwchar_t *() const;
00249
00250
00256 UtilExport void Resize(int nchars);
00258 UtilExport int Length() const;
00260 int length() const { return Length(); }
00262 UtilExport int ByteCount() const;
00264 UtilExport int LanguageCharacterCount() const;
00266 BOOL isNull() const { return Length()==0?1:0; }
00267
00270 UtilExport WStr & operator=(const WStr& ws);
00272 UtilExport WStr & operator=(const mwchar_t *wcstr);
00274 UtilExport WStr & operator=(const char *cstr);
00275
00276
00279 UtilExport WStr operator+(const WStr& ws) const;
00281 UtilExport WStr & operator+=(const WStr& ws);
00283 WStr& Append(const WStr& ws) { return ((*this) += ws); }
00285 WStr& append(const WStr& ws) { return ((*this) += ws); }
00292 UtilExport WStr& remove(int pos);
00293 UtilExport WStr& remove(int pos, int N);
00294
00295
00298 UtilExport WStr Substr(int start, int nchars) const;
00300 mwchar_t& operator[](int i) {
00301 DbgAssert((buf != NULL) && (i >= 0) && (i <= Length()));
00302 return buf[i];
00303 }
00305 mwchar_t operator[](int i) const {
00306 DbgAssert((buf != NULL) && (i >= 0) && (i <= Length()));
00307 return buf[i];
00308 }
00309
00310
00313 UtilExport int first(mwchar_t c) const;
00316 UtilExport int last(mwchar_t c) const;
00317
00318
00321 UtilExport int operator==(const WStr &ws) const;
00324 UtilExport int operator!=(const WStr &ws) const;
00326 UtilExport int operator<(const WStr &ws) const;
00328 UtilExport int operator<=(const WStr &ws) const;
00330 UtilExport int operator>(const WStr &ws) const;
00332 UtilExport int operator>=(const WStr &ws) const;
00333
00335 UtilExport void toUpper();
00337 UtilExport void toLower();
00338
00355 UtilExport int printf(const mwchar_t *format, ...);
00356
00373 UtilExport int vprintf(const mwchar_t *format, va_list args);
00374 };
00375
00376 #ifdef _UNICODE
00377 #define TSTR WStr
00378 #else
00379 #define TSTR CStr
00380 #endif
00381
00382 #ifdef _UNICODE
00383 #ifdef _UNICODE_MODULE_FOR_MBCS_MAX
00384 typedef CStr MSTR;
00385 #else
00386 typedef WStr MSTR;
00387 #endif
00388 #else
00389 typedef CStr MSTR;
00390 #endif
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00439 class FilterList: public MaxHeapOperators {
00440 Tab<const MCHAR> buf;
00441 int m_filterIndex;
00442 int m_newFilterIndex;
00443 public:
00445 UtilExport FilterList();
00447 UtilExport void Append(const MCHAR *name);
00448 UtilExport void Append(FilterList& filters);
00450 UtilExport operator const MCHAR *();
00451
00455 UtilExport int GetFilterIndex();
00456
00460 UtilExport void SetFilterIndex(int filterIndex);
00461
00467 UtilExport int GetNewFilterIndex();
00468
00473 UtilExport void SetNewFilterIndex(int filterIndex);
00474
00479 UtilExport const MCHAR* GetFilterDescriptor(unsigned int filterIndex);
00480
00486 UtilExport const MCHAR* GetFilterExtension(unsigned int filterIndex);
00487 };
00488
00489
00537 CoreExport void SplitFilename(const CStr& name, CStr* p, CStr* f, CStr* e);
00540 CoreExport void SplitFilename(LPCSTR name, LPSTR p, LPSTR f, LPSTR e);
00543 CoreExport void SplitFilename(const WStr& name, WStr* p, WStr* f, WStr* e);
00546 CoreExport void SplitFilename(LPCWSTR name, LPWSTR p, LPWSTR f, LPWSTR e);
00547
00552 UtilExport void SplitFilenameOld(LPCSTR name, LPSTR p, LPSTR f, LPSTR e);
00555 UtilExport void SplitFilenameOld(const CStr& name, CStr* p, CStr* f, CStr* e);
00558 UtilExport void SplitFilenameOld(const WStr& name, WStr* p, WStr* f, WStr* e);
00561 UtilExport void SplitFilenameOld(LPCWSTR name, LPWSTR p, LPWSTR f, LPWSTR e);
00562
00563
00564
00565
00566
00567 CoreExport void SplitPathFile(const MSTR& name,MSTR* p, MSTR* f);
00568
00569
00570 UtilExport void SplitPathFileOld(const MSTR& name,MSTR* p, MSTR* f);
00571
00572
00573
00574
00575 UtilExport BOOL MatchPattern(const MSTR &s, const MSTR &ptrn, BOOL ignoreCase=TRUE);
00576
00577
00578
00579
00580
00581
00582 UtilExport int MaxAlphaNumComp(MCHAR *a, MCHAR *b);
00583
00584
00585
00586
00587
00588
00589 UtilExport int MaxAlphaNumCompI(const MCHAR *a, const MCHAR *b);
00590