⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stafstring.h

📁 Software Testing Automation Framework (STAF)的开发代码
💻 H
📖 第 1 页 / 共 4 页
字号:
/*                           byte index                                *//*                                                                     *//* Accepts: (In)  A STAFString_t                                       *//*          (In)  A STAFString_t which is a set of chars to look for   *//*          (In)  The char or byte index from where to start looking   *//*          (In)  0->char index, 1->byte index                         *//*          (Out) A pointer to a int set to the char or byte index of  *//*                the entry found or 0xffffffff if not found           *//*          (Out) A pointer to an OS return code (may be NULL)         *//*                                                                     *//* Returns: kSTAFOk on success                                         *//*          other on error                                             *//***********************************************************************/STAFRC_t STAFStringFindLastNotOf(STAFStringConst_t aString,                                 STAFStringConst_t aSet,                                 unsigned int index,                                 unsigned int corb,                                 unsigned int *pos,                                 unsigned int *osRC);/***********************************************************************//* STAFStringDestruct - Destructs a STAFString                         *//*                                                                     *//* Accepts: (Out) A pointer to a STAFString_t                          *//*          (Out) A pointer to an OS return code (may be NULL)         *//*                                                                     *//* Returns: kSTAFOk on success                                         *//*          other on error                                             *//***********************************************************************/STAFRC_t STAFStringDestruct(STAFString_t *pString,                            unsigned int *osRC);/***********************************************************************//* STAFStringFreeBuffer - Deallocates a buffer allocated by a          *//*                        STAFString function call                     *//*                                                                     *//* Accepts: (In)  A pointer to a STAFString allocated buffer           *//*          (Out) A pointer to an OS return code (may be NULL)         *//*                                                                     *//* Returns: kSTAFOk on success                                         *//*          other on error                                             *//*                                                                     *//* Note   : This function must be used per STAFStringToLocalCodePage   *//*          in order to free up any allocated memory                   *//***********************************************************************/STAFRC_t STAFStringFreeBuffer(const char *buffer,                              unsigned int *osRC);/* End C language definitions */#ifdef __cplusplus}/* Begin C++ language definitions */#include <stdio.h>#include "STAF_iostream.h"#include "STAFRefPtr.h"#include "STAFException.h"// Forward declaration for typedefclass STAFString;class STAFStringBuffer;typedef STAFRefPtr<STAFString> STAFStringPtr;typedef STAFRefPtr<STAFStringBuffer> STAFStringBufferPtr;// STAFStringBuffer - This class is a helper class used by the STAFString//                    class when it needs to return a buffer to the current//                    codepage representation of the stringclass STAFStringBuffer{public:    unsigned int length()   { return fLength; }    const char *buffer()    { return fPtr; }    ~STAFStringBuffer();private:    friend class STAFString;    STAFStringBuffer(const char *ptr, unsigned int length)        : fPtr(ptr), fLength(length)    { /* Do Nothing */ }    unsigned int fLength;    const char *fPtr;};inline STAFStringBuffer::~STAFStringBuffer(){    unsigned int osRC = 0;    STAFStringFreeBuffer(fPtr, &osRC);}// STAFString - This class provides a C++ wrapper around the STAFString//              C APIs.class STAFString{public:    enum IndexRep { kChar = 0, kByte = 1 };    enum CodePageType { kCurrent = 0, kUTF8 = 1 };    enum InvalidPosition { kNPos = 0xFFFFFFFF };    enum DefaultBufferLen { kStrLen = 0xFFFFFFFF };    enum StripWhat { kFront = 0, kBack = 1, kBoth = 2 };    enum CopyMode { kShallow = 0, kDeep = 1 };    enum Remainder { kRemainder = 0xFFFFFFFF };    // Constructors    STAFString(void);    STAFString(const char *buffer, unsigned int length = kStrLen,               CodePageType cpType = kCurrent);    STAFString(unsigned int fromValue, unsigned int base = 10);    STAFString(const STAFString &from);    STAFString(STAFStringConst_t from);    STAFString(STAFString_t from, CopyMode mode = kDeep);    STAFString(STAFUTF8Char_t aChar);    // Substring functions    STAFString subString(unsigned int begin, unsigned int len = kRemainder,                         IndexRep corb = kByte) const;    // Word functions    unsigned int numWords() const;    STAFString subWord(unsigned int begin,                       unsigned int length = kRemainder) const;    // Data functions    unsigned int count(const STAFString &theSubStr) const;    unsigned int length(IndexRep corb = kByte) const;    unsigned int sizeOfChar(unsigned int index, IndexRep corb = kByte) const;    const char *buffer(unsigned int *bufLength = 0) const;    STAFString_t getImpl() const;    STAFString_t adoptImpl();    void replaceImpl(STAFString_t replacementImpl);    // Search functions    unsigned int byteIndexOfChar(unsigned int charIndex) const;    unsigned int find(const STAFString &searchFor, unsigned int begin = 0,                      IndexRep corb = kByte) const;    unsigned int findFirstOf(const STAFString &searchList,                             unsigned int begin = 0,                             IndexRep corb = kByte) const;    unsigned int findFirstNotOf(const STAFString &searchList,                                unsigned int begin = 0,                                IndexRep corb = kByte) const;    unsigned int findLastOf(const STAFString &searchList,                            unsigned int begin = 0,                            IndexRep corb = kByte) const;    unsigned int findLastNotOf(const STAFString &searchList,                               unsigned int begin = 0,                               IndexRep corb = kByte) const;    // Miscellaneous alteration functions    STAFString &lowerCase();    STAFString &upperCase();    STAFString &strip(StripWhat stripWhat = kBoth);    STAFString &join(const STAFString stringArray[], unsigned int arraySize);    // Conversions    unsigned int asUInt(unsigned int base = 10) const;    unsigned int asUIntWithDefault(unsigned int defaultValue,                                   unsigned int base = 10) const;    STAFStringBufferPtr toCurrentCodePage() const;    STAFString toLowerCase() const;    STAFString toUpperCase() const;    STAFString replace(const STAFString oldchar,                       const STAFString newchar) const;    // Evaluation    bool isWhiteSpace() const;    bool isDigits() const;    bool isEqualTo(const STAFString &theString,                   STAFStringCaseSensitive_t caseSensitive =                   kSTAFStringCaseSensitive) const;    bool startsWith(const STAFString &someString) const;    bool hasWildcard() const;    bool matchesWildcards(const STAFString &wildcardString,                          STAFStringCaseSensitive_t caseSensitive =                          kSTAFStringCaseSensitive) const;    // operators    STAFString &operator=(const STAFString &rhs);    bool operator==(const STAFString &rhs) const;    bool operator!=(const STAFString &rhs) const;    bool operator<(const STAFString &rhs) const;    bool operator<=(const STAFString &rhs) const;    bool operator>(const STAFString &rhs) const;    bool operator>=(const STAFString &rhs) const;    STAFString &operator+=(const STAFString &rhs);    friend STAFString operator+(const STAFString &lhs, const STAFString &rhs);    friend ostream &operator<<(ostream &os, const STAFString &rhs);    // Destructor    ~STAFString();private:    STAFString_t fStringImpl;};// Now include inline definitions#ifndef STAF_NATIVE_COMPILER#include "STAFStringInlImpl.cpp"#endif// End C++ language definitions// End #ifdef __cplusplus#endif#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -