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

📄 pstring.h

📁 mgcp协议源代码。支持多种编码:g711
💻 H
📖 第 1 页 / 共 5 页
字号:
    virtual Comparison Compare(      const PObject & obj   /// Other PString to compare against.    ) const;    /**Output the string to the specified stream.     */    virtual void PrintOn(      ostream & strm  /// I/O stream to output to.    ) const;    /**Input the string from the specified stream. This will read all       characters until a end of line is reached. The end of line itself is       {\bf not} placed in the string, however it {\bf is} removed from       the stream.     */    virtual void ReadFrom(      istream & strm  /// I/O stream to input from.    );    /**Calculate a hash value for use in sets and dictionaries.           The hash function for strings will produce a value based on the sum of       the first three characters of the string. This is a fairly basic       function and make no assumptions about the string contents. A user may       descend from PString and override the hash function if they can take       advantage of the types of strings being used, eg if all strings start       with the letter 'A' followed by 'B or 'C' then the current hash function       will not perform very well.       @return       hash value for string.     */    virtual PINDEX HashFunction() const;  //@}  /**@name Overrides from class PContainer */  //@{    /**Set the size of the string. A new string may be allocated to accomodate       the new number of characters. If the string increases in size then the       new characters are initialised to zero. If the string is made smaller       then the data beyond the new size is lost.       Note that this function will break the current instance from multiple       references to an array. A new array is allocated and the data from the       old array copied to it.       @return       TRUE if the memory for the array was allocated successfully.     */    virtual BOOL SetSize(      PINDEX newSize  /// New size of the array in elements.    );    /**Determine if the string is empty. This is semantically slightly       different from the usual #PContainer::IsEmpty()# function. It does       not test for #PContainer::GetSize()# equal to zero, it tests for       #GetLength()# equal to zero.       @return       TRUE if no non-null characters in string.     */    virtual BOOL IsEmpty() const;    /**Make this instance to be the one and only reference to the container       contents. This implicitly does a clone of the contents of the container       to make a unique reference. If the instance was already unique then       the function does nothing.       @return       TRUE if the instance was already unique.     */    virtual BOOL MakeUnique();  //@}  /**@name Size/Length functions */  //@{    /**Set the actual memory block array size to the minimum required to hold       the current string contents.              Note that this function will break the current instance from multiple       references to the string. A new string buffer is allocated and the data       from the old string buffer copied to it.       @return       TRUE if new memory block successfully allocated.     */    BOOL MakeMinimumSize();    /**Determine the length of the null terminated string. This is different       from #PContainer::GetSize()# which returns the amount of memory       allocated to the string. This is often, though no necessarily, one       larger than the length of the string.              @return       length of the null terminated string.     */    PINLINE PINDEX GetLength() const;    /**Determine if the string is NOT empty. This is semantically identical       to executing !IsEmpty() on the string.       @return       TRUE if non-null characters in string.     */    BOOL operator!() const;  //@}  /**@name Concatenation operators **/  //@{    /**Concatenate two strings to produce a third. The original strings are       not modified, an entirely new unique reference to a string is created.              @return       new string with concatenation of the object and parameter.     */    PString operator+(      const PString & str   /// String to concatenate.    ) const;    /**Concatenate a C string to a PString to produce a third. The original       string is not modified, an entirely new unique reference to a string       is created. The #cstr# parameter is typically a literal       string, eg:\begin{verbatim}          myStr = aStr + "fred";\end{verbatim}       @return       new string with concatenation of the object and parameter.     */    PString operator+(      const char * cstr  /// C string to concatenate.    ) const;    /**Concatenate a single character to a PString to produce a third. The       original string is not modified, an entirely new unique reference to a       string is created. The #ch# parameter is typically a       literal, eg:\begin{verbatim}          myStr = aStr + '!';\end{verbatim}       @return       new string with concatenation of the object and parameter.     */    PString operator+(      char ch   /// Character to concatenate.    ) const;    /**Concatenate a PString to a C string to produce a third. The original       string is not modified, an entirely new unique reference to a string       is created. The #cstr# parameter is typically a literal       string, eg:\begin{verbatim}          myStr = "fred" + aStr;\end{verbatim}       @return       new string with concatenation of the object and parameter.     */    friend PString operator+(      const char * cstr,    /// C string to be concatenated to.      const PString & str   /// String to concatenate.    );    /**Concatenate a PString to a single character to produce a third. The       original string is not modified, an entirely new unique reference to a       string is created. The #c# parameter is typically a literal,       eg:\begin{verbatim}          myStr = '!' + aStr;\end{verbatim}       @return       new string with concatenation of the object and parameter.     */    friend PString operator+(      char  c,              /// Character to be concatenated to.      const PString & str   /// String to concatenate.    );    /**Concatenate a string to another string, modifiying that string.       @return       reference to string that was concatenated to.     */    PString & operator+=(      const PString & str   /// String to concatenate.    );    /**Concatenate a C string to a PString, modifiying that string. The       #cstr# parameter is typically a literal string, eg:\begin{verbatim}          myStr += "fred";\end{verbatim}       @return       reference to string that was concatenated to.     */    PString & operator+=(      const char * cstr  /// C string to concatenate.    );    /**Concatenate a single character to a PString. The #ch#       parameter is typically a literal, eg:\begin{verbatim}          myStr += '!';\end{verbatim}       @return       new string with concatenation of the object and parameter.     */    PString & operator+=(      char ch   /// Character to concatenate.    );    /**Concatenate two strings to produce a third. The original strings are       not modified, an entirely new unique reference to a string is created.              @return       new string with concatenation of the object and parameter.     */    PString operator&(      const PString & str   /// String to concatenate.    ) const;    /**Concatenate a C string to a PString to produce a third. The original       string is not modified, an entirely new unique reference to a string       is created. The #cstr# parameter is typically a literal       string, eg:\begin{verbatim}          myStr = aStr & "fred";\end{verbatim}       This function differes from operator+ in that it assures there is at       least one space between the strings. Exactly one space is added if       there is not a space at the end of the first or beggining of the last       string.       @return       new string with concatenation of the object and parameter.     */    PString operator&(      const char * cstr  /// C string to concatenate.    ) const;    /**Concatenate a single character to a PString to produce a third. The       original string is not modified, an entirely new unique reference to a       string is created. The #ch# parameter is typically a       literal, eg:\begin{verbatim}          myStr = aStr & '!';\end{verbatim}       This function differes from operator+ in that it assures there is at       least one space between the strings. Exactly one space is added if       there is not a space at the end of the first or beggining of the last       string.       @return       new string with concatenation of the object and parameter.     */    PString operator&(      char ch   /// Character to concatenate.    ) const;    /**Concatenate a PString to a C string to produce a third. The original       string is not modified, an entirely new unique reference to a string       is created. The #cstr# parameter is typically a literal       string, eg:\begin{verbatim}          myStr = "fred" & aStr;\end{verbatim}       This function differes from operator+ in that it assures there is at       least one space between the strings. Exactly one space is added if       there is not a space at the end of the first or beggining of the last       string.       @return       new string with concatenation of the object and parameter.     */    friend PString operator&(      const char * cstr,    /// C string to be concatenated to.      const PString & str   /// String to concatenate.    );    /**Concatenate a PString to a single character to produce a third. The       original string is not modified, an entirely new unique reference to a       string is created. The #c# parameter is typically a literal,       eg:\begin{verbatim}          myStr = '!' & aStr;\end{verbatim}       This function differes from #operator+# in that it assures there is at       least one space between the strings. Exactly one space is added if       there is not a space at the end of the first or beggining of the last       string.       @return       new string with concatenation of the object and parameter.     */    friend PString operator&(      char  ch,              /// Character to be concatenated to.      const PString & str   /// String to concatenate.    );    /**Concatenate a string to another string, modifiying that string.       @return       reference to string that was concatenated to.     */    PString & operator&=(      const PString & str   /// String to concatenate.    );    /**Concatenate a C string to a PString, modifiying that string. The       #cstr# parameter is typically a literal string, eg:\begin{verbatim}          myStr &= "fred";\end{verbatim}       This function differes from operator+ in that it assures there is at       least one space between the strings. Exactly one space is added if       there is not a space at the end of the first or beggining of the last       string.       @return       reference to string that was concatenated to.     */    PString & operator&=(      const char * cstr  /// C string to concatenate.    );    /**Concatenate a character to a PString, modifiying that string. The       #ch# parameter is typically a literal string, eg:\begin{verbatim}          myStr &= '!';\end{verbatim}       This function differes from operator+ in that it assures there is at       least one space between the strings. Exactly one space is added if       there is not a space at the end of the first or beggining of the last       string.       @return       reference to string that was concatenated to.     */    PString & operator&=(      char ch  /// Character to concatenate.    );  //@}  /**@name Comparison operators */  //@{    /**Compare two strings using case insensitive comparison.       @return       TRUE if equal.     */    BOOL operator*=(      const PString & str  /// PString object to compare against.    ) const;    /**Compare two strings using the #PObject::Compare()# function. This       is identical to the #PObject# class function but is necessary due       to other overloaded versions.       @return       TRUE if equal.     */    BOOL operator==(      const PObject & str  /// PString object to compare against.

⌨️ 快捷键说明

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