📄 domstring.hpp
字号:
/** * Appends the content of another <code>DOMString</code> to this string. * * @param other The object to be appended */ DOMString& operator +=(const DOMString &other); /** * Appends the content of a c-style string to this string. * * @param other The string to be appended */ DOMString& operator +=(const XMLCh* other); /** * Appends a character to this string. * * @param ch The character to be appended */ DOMString& operator +=(XMLCh ch); /** * Clears the data of this <code>DOMString</code>. * * @param offset The position from the beginning from which the data must be deleted * @param count The count of characters from the offset that must be deleted */ void deleteData(unsigned int offset, unsigned int count); /** * Inserts a string within the existing <code>DOMString</code> at an arbitrary position. * * @param offset The offset from the beginning at which the insertion needs to be done * in <code>this</code> object * @param data The <code>DOMString</code> containing the data that needs to be inserted * @return The object to be returned. */ void insertData(unsigned int offset, const DOMString &data); //@} /** @name Functions to get properties of the string. */ //@{ /** * Returns the character at the specified position. * * @param index The position at which the character is being requested * @return Returns the character at the specified position. */ XMLCh charAt(unsigned int index) const; /** * Returns a handle to the raw buffer in the <code>DOMString</code>. * * @return The pointer inside the <code>DOMString</code> containg the string data. * Note: the data is not always null terminated. Do not rely on * a null being there, and do not add one, as several DOMStrings * with different lengths may share the same raw buffer. */ const XMLCh *rawBuffer() const; /** * Returns a copy of the string, transcoded to the local code page. The * caller owns the (char *) string that is returned, and is responsible * for deleting it. * * Note: The buffer returned is allocated using the global operator new * and users need to make sure to use the corresponding delete []. * This method will be deprecated in later versions, as we move * towards using a memory manager for allocation and deallocation. * * @return A pointer to a newly allocated buffer of char elements, which * represents the original string, but in the local encoding. */ char *transcode() const; /** * Returns a copy of the string, transcoded to the local code page. The * caller owns the (char *) string that is returned, and is responsible * for deleting it. * * @param manager the memory manager to use for allocating returned * returned buffer. * * @return A pointer to a newly allocated buffer of char elements, which * represents the original string, but in the local encoding. */ char *transcode(MemoryManager* const manager) const; /** * Creates a DOMString, transcoded from an input 8 bit char * string * in the local code page. * * @param str The string to be transcoded * @return A new DOMString object */ static DOMString transcode(const char* str); /** * Returns a sub-string of the <code>DOMString</code> starting at a specified position. * * @param offset The offset from the beginning from which the sub-string is being requested. * @param count The count of characters in the requested sub-string * @return The sub-string of the <code>DOMString</code> being requested */ DOMString substringData(unsigned int offset, unsigned int count) const; /** * Returns the length of the DOMString. * * @return The length of the string */ unsigned int length() const; //@} /** @name Cloning function. */ //@{ /** * Makes a clone of a the DOMString. * * @return The object to be cloned. */ DOMString clone() const; //@} /** @name Print functions. */ //@{ /** * Dumps the <code>DOMString</code> on the console. * */ void print() const; /** * Dumps the <code>DOMString</code> on the console with a line feed at the end. * */ void println() const; //@} /** @name Functions to compare a string with another. */ //@{ /** * Compares a DOMString with another. * * This compareString does not match the semantics of the standard C strcmp. * All it needs to do is define some less than - equals - greater than * ordering of strings. How doesn't matter. * * * @param other The object to be compared with * @return Either -1, 0, or 1 based on the comparison. */ int compareString(const DOMString &other) const; /** * Tells if a <code>DOMString</code> contains the same character data * as another. * * @param other The DOMString to be compared with. * @return True if the two <code>DOMString</code>s are same, false otherwise. */ bool equals(const DOMString &other) const; /** * Compare a DOMString with a null-terminated raw 16-bit character * string. * * @param other The character string to be compared with. * @return True if the strings are the same, false otherwise. */ bool equals(const XMLCh *other) const; //@} friend class DOMStringData; friend class DOMStringHandle; friend class DomMemDebug;private: DOMStringHandle *fHandle; static int gLiveStringHandleCount; static int gTotalStringHandleCount; static int gLiveStringDataCount; static int gTotalStringDataCount;};/****** Global Helper Functions ******//** * Concatenate two DOMString's. * * @param lhs the first string * @param rhs the second string * @return The concatenated object */DOMString CDOM_EXPORT operator + (const DOMString &lhs, const DOMString &rhs);/** * Concatenate a null terminated Unicode string to a DOMString. * * @param lhs the DOMString * @param rhs the XMLCh * string * @return The concatenated object */DOMString CDOM_EXPORT operator + (const DOMString &lhs, const XMLCh* rhs);/** * Concatenate a DOMString to a null terminated Unicode string * * @param lhs the null-terminated Unicode string * @param rhs the DOMString * @return The concatenated object */DOMString CDOM_EXPORT operator + (const XMLCh* lhs, const DOMString &rhs);/** * Concatenate a single Unicode character to a DOMString. * * @param lhs the DOMString * @param rhs the character * @return The concatenated object */DOMString CDOM_EXPORT operator + (const DOMString &lhs, XMLCh rhs);/** * Concatenate a DOMString to a single Unicode character. * * @param lhs the character * @param rhs the DOMString * @return The concatenated object */DOMString CDOM_EXPORT operator + (XMLCh lhs, const DOMString &rhs);XERCES_CPP_NAMESPACE_END#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -