📄 sysstring.h
字号:
// method: lastStr // long lastStr(const unichar* str, long end = Integral::NO_POS) const { SysString temp(str); return lastStr(temp, end); } // other last string methods // long lastStr(const SysString& str, long end = Integral::NO_POS) const; // method: firstChr // long firstChr(const unichar* chrs, long start = Integral::NO_POS) const { SysString temp(chrs); return firstChr(temp, start); } // other first char methods // long firstChr(const SysString& chrs, long start = Integral::NO_POS) const; long firstChr(unichar chr, long start = Integral::NO_POS) const; // method: lastChr // long lastChr(const unichar* chrs, long end = Integral::NO_POS) const { SysString temp(chrs); return lastChr(temp, end); } // other last char methods // long lastChr(const SysString& chrs, long end = Integral::NO_POS) const; long lastChr(unichar chr, long end = Integral::NO_POS) const; // not char methods: // long firstNotChr(const SysString& chrs, long start = Integral::NO_POS) const; long firstNotChr(unichar chr, long start = Integral::NO_POS) const; long lastNotChr(const SysString& chrs, long end = Integral::NO_POS) const; long lastNotChr(unichar chr, long end = Integral::NO_POS) const; // method: firstAlnum // long firstAlnum(long start = Integral::NO_POS) const { return firstChar(start, &SysChar::isAlnum); } // method: firstAlpha // long firstAlpha(long start = Integral::NO_POS) const { return firstChar(start, &SysChar::isAlpha); } // method: firstDigit // long firstDigit(long start = Integral::NO_POS) const { return firstChar(start, &SysChar::isDigit); } // method: firstLower // long firstLower(long start = Integral::NO_POS) const { return firstChar(start, &SysChar::isLower); } // method: firstPrint // long firstPrint(long start = Integral::NO_POS) const { return firstChar(start, &SysChar::isPrint); } // method: firstPunct // long firstPunct(long start = Integral::NO_POS) const { return firstChar(start, &SysChar::isPunct); } // method: firstSpace // long firstSpace(long start = Integral::NO_POS) const { return firstChar(start, &SysChar::isSpace); } // method: firstUpper // long firstUpper(long start = Integral::NO_POS) const { return firstChar(start, &SysChar::isUpper); } // method: lastAlnum // long lastAlnum(long end = Integral::NO_POS) const { return lastChar(end, &SysChar::isAlnum); } // method: lastAlpha // long lastAlpha(long end = Integral::NO_POS) const { return lastChar(end, &SysChar::isAlpha); } // method: lastDigit // long lastDigit(long end = Integral::NO_POS) const { return lastChar(end, &SysChar::isDigit); } // method: lastLower // long lastLower(long end = Integral::NO_POS) const { return lastChar(end, &SysChar::isLower); } // method: lastPrint // long lastPrint(long end = Integral::NO_POS) const { return lastChar(end, &SysChar::isPrint); } // method: lastPunct // long lastPunct(long end = Integral::NO_POS) const { return lastChar(end, &SysChar::isPunct); } // method: lastSpace // long lastSpace(long end = Integral::NO_POS) const { return lastChar(end, &SysChar::isSpace); } // method: lastUpper long lastUpper(long end = Integral::NO_POS) const { return lastChar(end, &SysChar::isUpper); } // method: firstNotAlnum // long firstNotAlnum(long start = Integral::NO_POS) const { return firstNotChar(start, &SysChar::isAlnum); } // method: firstNotAlpha // long firstNotAlpha(long start = Integral::NO_POS) const { return firstNotChar(start, &SysChar::isAlpha); } // method: firstNotDigit // long firstNotDigit(long start = Integral::NO_POS) const { return firstNotChar(start, &SysChar::isDigit); } // method: firstNotLower // long firstNotLower(long start = Integral::NO_POS) const { return firstNotChar(start, &SysChar::isLower); } // method: firstNotPrint // long firstNotPrint(long start = Integral::NO_POS) const { return firstNotChar(start, &SysChar::isPrint); } // method: firstNotPunct // long firstNotPunct(long start = Integral::NO_POS) const { return firstNotChar(start, &SysChar::isPunct); } // method: firstNotSpace // long firstNotSpace(long start = Integral::NO_POS) const { return firstNotChar(start, &SysChar::isSpace); } // method: firstNotUpper // long firstNotUpper(long start = Integral::NO_POS) const { return firstNotChar(start, &SysChar::isUpper); } // method: lastNotAlnum // long lastNotAlnum(long end = Integral::NO_POS) const { return lastNotChar(end, &SysChar::isAlnum); } // method: lastNotAlpha // long lastNotAlpha(long end = Integral::NO_POS) const { return lastNotChar(end, &SysChar::isAlpha); } // method: lastNotDigit // long lastNotDigit(long end = Integral::NO_POS) const { return lastNotChar(end, &SysChar::isDigit); } // method: lastNotLower // long lastNotLower(long end = Integral::NO_POS) const { return lastNotChar(end, &SysChar::isLower); } // method: lastNotPrint // long lastNotPrint(long end = Integral::NO_POS) const { return lastNotChar(end, &SysChar::isPrint); } // method: lastNotPunct // long lastNotPunct(long end = Integral::NO_POS) const { return lastNotChar(end, &SysChar::isPunct); } // method: lastNotSpace // long lastNotSpace(long end = Integral::NO_POS) const { return lastNotChar(end, &SysChar::isSpace); } // method: lastNotUpper // long lastNotUpper(long end = Integral::NO_POS) const { return lastNotChar(end, &SysChar::isUpper); } //--------------------------------------------------------------------------- // // class-specific public methods: // tokenize methods // //--------------------------------------------------------------------------- // method: countTokens // count the tokens when delimiter is white space // long countTokens() const { static SysString temp(L" "); return countTokens(temp); } // other count tokens methods // long countTokens(unichar delimiter) const; long countTokens(const SysString& delimiters) const; // method: tokenize // tokenize the string when delimiter is white space // boolean tokenize(SysString& sub, long& pos) const { static SysString temp(L" "); return tokenize(sub, pos, temp); } // other string tokenize methods // boolean tokenize(SysString& sub, long& pos, unichar delim) const; boolean tokenize(SysString& sub, long& pos, const SysString delim) const; // pad symbols methods // this aides in tokenization by ensuring the specified symbols are padded // boolean symbolPad(const SysString& symbols); // debug string creation methods // boolean debugStr(const SysString& class_name, const unichar* message_a, const unichar* variable_name, const SysString& variable_value); boolean debugStr(const SysString& class_name, const unichar* message_a, const unichar* variable_name); boolean debugStrPrefix(const SysString& class_name, const unichar* message_a); // method: getEmptyString // empty string creation methods // static const SysString& getEmptyString() { static SysString temp; return temp; } //--------------------------------------------------------------------------- // // private methods // //---------------------------------------------------------------------------private: // general string search methods: // these are special methods used for class-specific string search // methods. these methods have function pointer as an argument // which allow us to specify any method of the type "boolean // doWhatever() const" of SysChar class. // long firstChar(long start, boolean (SysChar::*method) (void) const) const; long lastChar(long end, boolean (SysChar::*method) (void) const) const; long firstNotChar(long start, boolean (SysChar::*method) (void) const) const; long lastNotChar(long end, boolean (SysChar::*method) (void) const) const; // memory allocation methods // boolean allocateMem(); boolean freeMem(); boolean growMem(long new_size); //--------------------------------------------------------------------------- // // wrap the system wchar methods // //--------------------------------------------------------------------------- // the following private methods are to wrap wide character // support. wide character support is in a great state of flux, so // the "isip_" prefix is meant to clarify that our api is not // dependent on the specific operating system. // // method: isip_wcslen // static ulong isip_wcslen(const unichar* ws) { return wcslen(ws); } // method: isip_wcscmp // static long isip_wcscmp(const unichar* ws1, const unichar* ws2) { return wcscmp(ws1, ws2); } // method: isip_wcsncmp // static long isip_wcsncmp(const unichar* ws1, const unichar* ws2, ulong n) { return wcsncmp(ws1, ws2, n); } // method: isip_wcschr // static unichar* isip_wcschr(const unichar* ws1, const unichar ws2) { return wcschr(ws1, ws2); } // method: isip_wcscat // static unichar* isip_wcscat(unichar* ws1, const unichar* ws2) { return wcscat(ws1, ws2); } // method: isip_wcscpy // static unichar* isip_wcscpy(unichar* ws1, const unichar* ws2) { return wcscpy(ws1, ws2); } // method: isip_wcsncpy // static unichar* isip_wcsncpy(unichar* ws1, const unichar* ws2, ulong n) { return wcsncpy(ws1, ws2, n); } // other wrappers for system wchar methods // static unichar* isip_wcsstr(const unichar* ws1, const unichar* ws2); static unichar* isip_wcstok(unichar* ws, const unichar* delim,unichar** ptr); static unichar* isip_fgetws(unichar* s, int n, FILE* stream); static long isip_fputws(const unichar* s, FILE* stream); static wint_t isip_fgetwc(FILE* stream); static wint_t isip_fputwc(wint_t wc, FILE* stream); //--------------------------------------------------------------------------- // // friend functions: // while friend functions are generally discouraged in the ISIP // environment, they are used in the SysString class to isolate // implementation details. currently, wide character support varies // greatly between different operating systems, so we abstract a // core group of wide character functions in this class as private // methods. the file class also needs to access these wrappers // directly for I/O purposes, though, so the friend directive is // used. // //--------------------------------------------------------------------------- // put methods // friend boolean File::put(const SysString& str); friend boolean File::put(const SysChar chr); // get methods // friend boolean File::get(SysString& str, long len); friend boolean File::get(SysChar& chr);};// end of include file//#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -