dwstring.h.svn-base

来自「ffshow源码」· SVN-BASE 代码 · 共 905 行 · 第 1/3 页

SVN-BASE
905
字号
    DwString& assign(const tchar* aBuf, size_t aLen);    DwString& assign(const tchar* aCstr);    DwString& assign(size_t aLen, tchar aChar);    //. Assigns characters to this string.    //. Returns {\tt *this}.    //.    //. The first version assigns all of the characters from {\tt aStr}.    //.    //. The second version assigns at most {\tt aLen} characters from    //. {\tt aStr} beginning at position {\tt aPos}.  {\tt aPos} must be    //. less than or equal to {\tt aStr.size()}.  The function will not    //. assign more characters than what are available in {\tt aStr}.    //.    //. The third version assigns {\tt aLen} characters from {\tt aBuf},    //. which is not assumed to be NUL-terminated and can contain embedded    //. NULs.    //.    //. The fourth version assigns characters from the NUL-terminated    //. string {\tt aCstr}.    //.    //. The fifth version assigns {\tt aChar} repeated {\tt aLen} times.    DwString& insert(size_t aPos1, const DwString& aStr);    DwString& insert(size_t aPos1, const DwString& aStr, size_t aPos2,        size_t aLen2);    DwString& insert(size_t aPos1, const tchar* aBuf, size_t aLen2);    DwString& insert(size_t aPos1, const tchar* aCstr);    DwString& insert(size_t aPos1, size_t aLen2, tchar aChar);    //. Inserts characters into this string beginning at position {\tt aPos1}.    //. Returns {\tt *this}.    //.    //. The first version inserts all of the characters from {\tt aStr}.    //.    //. The second version inserts at most {\tt aLen2} characters from    //. {\tt aStr} beginning at position {\tt aPos2}.  {\tt aPos1} must be    //. less than or equal to {\tt aStr.size()}.  The function will not    //. assign more characters than what are available in {\tt aStr}.    //.    //. The third version inserts {\tt aLen2} characters from {\tt aBuf},    //. which is not assumed to be NUL-terminated and can contain embedded    //. NULs.    //.    //. The fourth version inserts characters from the NUL-terminated    //. string {\tt aCstr}.    //.    //. The fifth version inserts {\tt aChar} repeated {\tt aLen2} times.    DwString& erase(size_t aPos=0, size_t aLen=npos);    //. Erases (removes) at most {\tt aLen} characters beginning at position    //. {\tt aPos} from this string.    //. The function will not erase more characters than what are    //. available.    //. Returns {\tt *this}.    DwString& replace(size_t aPos1, size_t aLen1, const DwString& aStr);    DwString& replace(size_t aPos1, size_t aLen1, const DwString& aStr,        size_t aPos2, size_t aLen2);    DwString& replace(size_t aPos1, size_t aLen1, const tchar* aBuf,        size_t aLen2);    DwString& replace(size_t aPos1, size_t aLen1, const tchar* aCstr);    DwString& replace(size_t aPos1, size_t aLen1, size_t aLen2, tchar aChar);    //. Removes {\tt aLen1} characters beginning at position {\tt aPos1}    //. and inserts other characters.    //. Returns {\tt *this}.    //.    //. The first version inserts all of the characters from {\tt aStr}.    //.    //. The second version inserts at most {\tt aLen2} characters from    //. {\tt aStr} beginning at position {\tt aPos2}.  {\tt aPos1} must be    //. less than or equal to {\tt aStr.size()}.  The function will not    //. assign more characters than what are available in {\tt aStr}.    //.    //. The third version inserts {\tt aLen2} characters from {\tt aBuf},    //. which is not assumed to be NUL-terminated and can contain embedded    //. NULs.    //.    //. The fourth version inserts characters from the NUL-terminated    //. string {\tt aCstr}.    //.    //. The fifth version inserts {\tt aChar} repeated {\tt aLen2} times.    size_t copy(tchar* aBuf, size_t aLen, size_t aPos=0) const;    //. Copies at most {\tt aLen} characters beginning at position {\tt aPos}    //. from this string to the buffer pointed to by {\tt aBuf}.    //. Returns the number of characters copied.    void swap(DwString& aStr);    //. Swaps the contents of this string and {\tt aStr}.    const tchar* c_str() const     {      if (mRep->mRefCount > 1 && mRep != sEmptyRep) {          DwString* xthis = (DwString*) this;          xthis->_copy();      }      else       if (mRep->mRefCount==1)        mRep->mBuffer[mStart+mLength]='\0';      return &mRep->mBuffer[mStart];     }    const tchar* data() const     {      return &mRep->mBuffer[mStart];     }    //. These member functions permit access to the internal buffer used    //. by the {\tt DwString} object.  {\tt c_str()} returns a NUL-terminated    //. string suitable for use in C library functions.  {\tt data()}    //. returns a pointer to the internal buffer, which may not be    //. NUL-terminated.    //.    //. {\tt c_str()} may copy the internal buffer in order to place the    //. terminating NUL.  This is not a violation of the const declaration:    //. it is a logical const, not a bit-representation const.  It could    //. have the side effect of invalidating a pointer previously returned    //. by {\tt c_str()} or {\tt data()}.    //.    //. The characters in the returned string should not be modified, and    //. should be considered invalid after any call to a non-const member    //. function or another call to {\tt c_str()}.    size_t find(const DwString& aStr, size_t aPos=0) const;    size_t find(const tchar* aBuf, size_t aPos, size_t aLen) const;    size_t find(const tchar* aCstr, size_t aPos=0) const;    size_t find(tchar aChar, size_t aPos=0) const;    //. Performs a forward search for a sequence of characters in the    //. {\tt DwString} object.  The return value is the position of the    //. sequence in the string if found, or {\tt DwString::npos} if not    //. found.    //.    //. The first version searches beginning at position {\tt aPos} for    //. the sequence of characters in {\tt aStr}.    //.    //. The second version searches beginning at position {\tt aPos} for    //. the sequence of {\tt aLen} characters in {\tt aBuf}, which need not    //. be NUL-terminated and can contain embedded NULs.    //.    //. The third version searches beginning at position {\tt aPos} for    //. the sequence of characters in the NUL-terminated string {\tt aCstr}.    //.    //. The fourth version searches beginning at position {\tt aPos} for    //. the character {\tt aChar}.    size_t rfind(const DwString& aStr, size_t aPos=npos) const;    size_t rfind(const tchar* aBuf, size_t aPos, size_t aLen) const;    size_t rfind(const tchar* aCstr, size_t aPos=npos) const;    size_t rfind(tchar aChar, size_t aPos=npos) const;    //. Performs a reverse search for a sequence of characters in the    //. {\tt DwString} object.  The return value is the position of the    //. sequence in the string if found, or {\tt DwString::npos} if not    //. found.    //.    //. The first version searches beginning at position {\tt aPos} for    //. the sequence of characters in {\tt aStr}.    //.    //. The second version searches beginning at position {\tt aPos} for    //. the sequence of {\tt aLen} characters in {\tt aBuf}, which need not    //. be NUL-terminated and can contain embedded NULs.    //.    //. The third version searches beginning at position {\tt aPos} for    //. the sequence of characters in the NUL-terminated string {\tt aCstr}.    //.    //. The fourth version searches beginning at position {\tt aPos} for    //. the character {\tt aChar}.    size_t find_first_of(const DwString& aStr, size_t aPos=0) const;    size_t find_first_of(const tchar* aBuf, size_t aPos, size_t aLen) const;    size_t find_first_of(const tchar* aCstr, size_t aPos=0) const;    //. Performs a forward search beginning at position {\tt aPos} for    //. the first occurrence of any character from a specified set of    //. characters.  The return value is the position of the character    //. if found, or {\tt DwString::npos} if not found.    //.    //. The first version searches for any character in the string {\tt aStr}.    //.    //. The second version searches for any of the {\tt aLen} characters in    //. {\tt aBuf}.    //.    //. The third version searches for any character in the NUL-terminated    //. string {\tt aCstr}.    size_t find_last_of(const DwString& aStr, size_t aPos=npos) const;    size_t find_last_of(const tchar* aBuf, size_t aPos, size_t aLen) const;    size_t find_last_of(const tchar* aCstr, size_t aPos=npos) const;    //. Performs a reverse search beginning at position {\tt aPos} for    //. the first occurrence of any character from a specified set of    //. characters.  If {\tt aPos} is greater than or equal to the number    //. of characters in the string, then the search starts at the end    //. of the string.  The return value is the position of the character    //. if found, or {\tt DwString::npos} if not found.    //.    //. The first version searches for any character in the string {\tt aStr}.    //.    //. The second version searches for any of the {\tt aLen} characters in    //. {\tt aBuf}.    //.    //. The third version searches for any character in the NUL-terminated    //. string {\tt aCstr}.    size_t find_first_not_of(const DwString& aStr, size_t aPos=0) const;    size_t find_first_not_of(const tchar* aBuf, size_t aPos, size_t aLen) const;    size_t find_first_not_of(const tchar* aCstr, size_t aPos=0) const;    //. Performs a forward search beginning at position {\tt aPos} for    //. the first occurrence of any character {\it not} in a specified set    //. of characters.  The return value is the position of the character    //. if found, or {\tt DwString::npos} if not found.    //.    //. The first version searches for any character not in the string    //. {\tt aStr}.    //.    //. The second version searches for any character not among the    //. {\tt aLen} characters in {\tt aBuf}.    //.    //. The third version searches for any character not in the NUL-terminated    //. string {\tt aCstr}.    size_t find_last_not_of(const DwString& aStr, size_t aPos=npos) const;    size_t find_last_not_of(const tchar* aBuf, size_t aPos, size_t aLen) const;    size_t find_last_not_of(const tchar* aCstr, size_t aPos=npos) const;    //. Performs a reverse search beginning at position {\tt aPos} for    //. the first occurrence of any character {\it not} in a specified set    //. of characters.  If {\tt aPos} is greater than or equal to the number    //. of characters in the string, then the search starts at the end    //. of the string.  The return value is the position of the character    //. if found, or {\tt DwString::npos} if not found.    //.    //. The first version searches for any character not in the string    //. {\tt aStr}.    //.    //. The second version searches for any character not among the    //. {\tt aLen} characters in {\tt aBuf}.    //.    //. The third version searches for any character not in the NUL-terminated    //. string {\tt aCstr}.    DwString substr(size_t aPos=0, size_t aLen=npos) const;    //. Returns a string that contains at most {\tt aLen} characters from    //. the {\tt DwString} object beginning at position {\tt aPos}.  The    //. returned substring will not contain more characters than what are    //. available in the superstring {\tt DwString} object.    int compare(const DwString& aStr) const;    int compare(size_t aPos1, size_t aLen1, const DwString& aStr) const;    int compare(size_t aPos1, size_t aLen1, const DwString& aStr,        size_t aPos2, size_t aLen2) const;    int compare(const tchar* aCstr) const;    int compare(size_t aPos1, size_t aLen1, const tchar* aBuf, size_t aLen2=npos) const;    //. These member functions compare a sequence of characters to this    //. {\tt DwString} object, or a segment of this {\tt DwString} object.    //. They return -1, 0, or 1, depending on whether this {\tt DwString}    //. object is less than, equal to, or greater than the compared sequence    //. of characters, respectively.    //.    //. The first version compares {\tt aStr} to this string.    //.    //. The second version compares {\tt aStr} to the segment of this string    //. of length {\tt aLen} beginning at position {\tt aPos}.    //.    //. The third version compares the {tt aLen2} characters beginning at    //. position {\tt aPos2} in {\tt aStr} with the {\tt aLen1} characters    //. beginning at position {\tt aPos1} in this {\tt DwString} object.    //.    //. The fourth version compares the NUL-terminated string {\tt aCstr}    //. to this {\tt DwString}.    //.    //. The fifth version compares the {\tt aLen2} characters in {\tt aBuf}    //. with this {\tt DwString}.    // Non-ANSI member functions    DwString& ConvertToLowerCase();    DwString& ConvertToUpperCase();    //. Converts this {\tt DwString} object's characters to all lower case or    //. all upper case.    DwString& Trim();    //. Removes all white space from the beginning and the end of this    //. {\tt DwString} object.  White space characters include ASCII HT,    //. LF, and SPACE.    //void WriteTo(std::ostream& aStrm) const;    //. Writes the contents of this {\tt DwString} object to the stream    //. {\tt aStrm}.    int RefCount() const     {      return mRep->mRefCount;     }    //. This {\it advanced} member function returns the number of    //. references to the internal buffer used by the {\tt DwString} object.    void TakeBuffer(tchar* aBuf, size_t aSize, size_t aStart, size_t aLen);    //. This {\it advanced} member function sets the contents of the    //. {\tt DwString} object to the {\tt aLen} characters starting at    //. offset {\tt aStart} in the buffer {\tt aBuf}.  {\tt aSize} is    //. the allocated size of {\tt aBuf}.    //. This member function is provided for efficiency in setting a    //. {\tt DwString}'s contents from a large buffer.  It is efficient    //. because no copying takes place.  Instead, {\tt aBuf} becomes the    //. buffer used internally by the {\tt DwString} object, which    //. takes responsibility for deleting the buffer.    //. Because DwString will free the buffer using {\tt delete []}, the    //. buffer should have been allocated using {\tt new}.

⌨️ 快捷键说明

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