📄 xmlstring.hpp
字号:
( XMLCh* const target , const XMLCh* const src , const unsigned int maxChars ); //@} /** @name Hash functions */ //@{ /** Hashes a string given a modulus * * @param toHash The string to hash * @param hashModulus The divisor to be used for hashing * @param manager The MemoryManager to use to allocate objects * @return Returns the hash value */ static unsigned int hash ( const char* const toHash , const unsigned int hashModulus , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); /** Hashes a string given a modulus * * @param toHash The string to hash * @param hashModulus The divisor to be used for hashing * @param manager The MemoryManager to use to allocate objects * @return Returns the hash value */ static unsigned int hash ( const XMLCh* const toHash , const unsigned int hashModulus , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); /** Hashes a string given a modulus taking a maximum number of characters * as the limit * * @param toHash The string to hash * @param numChars The maximum number of characters to consider for hashing * @param hashModulus The divisor to be used for hashing * @param manager The MemoryManager to use to allocate objects * @return Returns the hash value */ static unsigned int hashN ( const XMLCh* const toHash , const unsigned int numChars , const unsigned int hashModulus , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); //@} /** @name Search functions */ //@{ /** * Provides the index of the first occurance of a character within a string * * @param toSearch The string to search * @param ch The character to search within the string * @return If found, returns the index of the character within the string, * else returns -1. */ static int indexOf(const char* const toSearch, const char ch); /** * Provides the index of the first occurance of a character within a string * * @param toSearch The string to search * @param ch The character to search within the string * @return If found, returns the index of the character within the string, * else returns -1. */ static int indexOf(const XMLCh* const toSearch, const XMLCh ch); /** * Provides the index of the first occurance of a character within a string * starting from a given index * * @param toSearch The string to search * @param chToFind The character to search within the string * @param fromIndex The index to start searching from * @param manager The MemoryManager to use to allocate objects * @return If found, returns the index of the character within the string, * else returns -1. */ static int indexOf ( const char* const toSearch , const char chToFind , const unsigned int fromIndex , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); /** * Provides the index of the first occurance of a character within a string * starting from a given index * * @param toSearch The string to search * @param chToFind The character to search within the string * @param fromIndex The index to start searching from * @param manager The MemoryManager to use to allocate objects * @return If found, returns the index of the character within the string, * else returns -1. */ static int indexOf ( const XMLCh* const toSearch , const XMLCh chToFind , const unsigned int fromIndex , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); /** * Provides the index of the last occurance of a character within a string * * @param toSearch The string to search * @param ch The character to search within the string * @return If found, returns the index of the character within the string, * else returns -1. */ static int lastIndexOf(const char* const toSearch, const char ch); /** * Provides the index of the last occurance of a character within a string * * @param toSearch The string to search * @param ch The character to search within the string * @return If found, returns the index of the character within the string, * else returns -1. */ static int lastIndexOf(const XMLCh* const toSearch, const XMLCh ch); /** * Provides the index of the last occurance of a character within a string * * @param ch The character to search within the string * @param toSearch The string to search * @param toSearchLen The length of the string to search * @return If found, returns the index of the character within the string, * else returns -1. */ static int lastIndexOf ( const XMLCh ch , const XMLCh* const toSearch , const unsigned int toSearchLen ); /** * Provides the index of the last occurance of a character within a string * starting backward from a given index * * @param toSearch The string to search * @param chToFind The character to search within the string * @param fromIndex The index to start backward search from * @param manager The MemoryManager to use to allocate objects * @return If found, returns the index of the character within the string, * else returns -1. */ static int lastIndexOf ( const char* const toSearch , const char chToFind , const unsigned int fromIndex , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); /** * Provides the index of the last occurance of a character within a string * starting backward from a given index * * @param toSearch The string to search * @param ch The character to search within the string * @param fromIndex The index to start backward search from * @param manager The MemoryManager to use to allocate objects * @return If found, returns the index of the character within the string, * else returns -1. */ static int lastIndexOf ( const XMLCh* const toSearch , const XMLCh ch , const unsigned int fromIndex , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); //@} /** @name Fixed size string movement */ //@{ /** Moves X number of chars * @param targetStr The string to copy the chars to * @param srcStr The string to copy the chars from * @param count The number of chars to move */ static void moveChars ( XMLCh* const targetStr , const XMLCh* const srcStr , const unsigned int count ); //@} /** @name Substring function */ //@{ /** Create a substring of a given string. The substring begins at the * specified beginIndex and extends to the character at index * endIndex - 1. * @param targetStr The string to copy the chars to * @param srcStr The string to copy the chars from * @param startIndex beginning index, inclusive. * @param endIndex the ending index, exclusive. * @param manager The MemoryManager to use to allocate objects */ static void subString ( char* const targetStr , const char* const srcStr , const int startIndex , const int endIndex , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); /** Create a substring of a given string. The substring begins at the * specified beginIndex and extends to the character at index * endIndex - 1. * @param targetStr The string to copy the chars to * @param srcStr The string to copy the chars from * @param startIndex beginning index, inclusive. * @param endIndex the ending index, exclusive. * @param manager The MemoryManager to use to allocate objects */ static void subString ( XMLCh* const targetStr , const XMLCh* const srcStr , const int startIndex , const int endIndex , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); /** Create a substring of a given string. The substring begins at the * specified beginIndex and extends to the character at index * endIndex - 1. * @param targetStr The string to copy the chars to * @param srcStr The string to copy the chars from * @param startIndex beginning index, inclusive. * @param endIndex the ending index, exclusive. * @param srcStrLength the length of srcStr * @param manager The MemoryManager to use to allocate objects */ static void subString ( XMLCh* const targetStr , const XMLCh* const srcStr , const int startIndex , const int endIndex , const int srcStrLength , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); //@} /** @name Replication function */ //@{ /** Replicates a string * NOTE: The returned buffer is dynamically allocated and is the * responsibility of the caller to delete it when not longer needed. * You can call XMLString::release to release this returned buffer. * * @param toRep The string to replicate * @return Returns a pointer to the replicated string * @see XMLString::release(char**) */ static char* replicate(const char* const toRep); /** Replicates a string * NOTE: The returned buffer is allocated with the MemoryManager. It is the * responsibility of the caller to delete it when not longer needed. * * @param toRep The string to replicate * @param manager The MemoryManager to use to allocate the string * @return Returns a pointer to the replicated string */ static char* replicate(const char* const toRep, MemoryManager* const manager); /** Replicates a string * NOTE: The returned buffer is dynamically allocated and is the * responsibility of the caller to delete it when not longer needed. * You can call XMLString::release to release this returned buffer. * @param toRep The string to replicate * @return Returns a pointer to the replicated string * @see XMLString::release(XMLCh**) */ static XMLCh* replicate(const XMLCh* const toRep); /** Replicates a string * NOTE: The returned buffer is allocated with the MemoryManager. It is the * responsibility of the caller to delete it when not longer needed. * * @param toRep The string to replicate * @param manager The MemoryManager to use to allocate the string * @return Returns a pointer to the replicated string */ static XMLCh* replicate(const XMLCh* const toRep, MemoryManager* const manager); //@} /** @name String query function */ //@{ /** Tells if the sub-string appears within a string at the beginning * @param toTest The string to test * @param prefix The sub-string that needs to be checked * @return Returns true if the sub-string was found at the beginning of * <code>toTest</code>, else false */ static bool startsWith ( const char* const toTest , const char* const prefix ); /** Tells if the sub-string appears within a string at the beginning * @param toTest The string to test * @param prefix The sub-string that needs to be checked * @return Returns true if the sub-string was found at the beginning of * <code>toTest</code>, else false */ static bool startsWith ( const XMLCh* const toTest , const XMLCh* const prefix ); /** Tells if the sub-string appears within a string at the beginning * without regard to case * * @param toTest The string to test * @param prefix The sub-string that needs to be checked * @return Returns true if the sub-string was found at the beginning of * <code>toTest</code>, else false */ static bool startsWithI ( const char* const toTest , const char* const prefix ); /** Tells if the sub-string appears within a string at the beginning * without regard to case * * @param toTest The string to test * @param prefix The sub-string that needs to be checked * * @return Returns true if the sub-string was found at the beginning * of <code>toTest</code>, else false */ static bool startsWithI ( const XMLCh* const toTest , const XMLCh* const prefix ); /** Tells if the sub-string appears within a string at the end. * @param toTest The string to test * @param suffix The sub-string that needs to be checked * @return Returns true if the sub-string was found at the end of * <code>toTest</code>, else false */ static bool endsWith ( const XMLCh* const toTest , const XMLCh* const suffix ); /** Tells if a string has any occurance of any character of another * string within itself * @param toSearch The string to be searched * @param searchList The string from which characters to be searched for are drawn * @return Returns the pointer to the location where the first occurrence of any * character from searchList is found, * else returns 0 */ static const XMLCh* findAny ( const XMLCh* const toSearch , const XMLCh* const searchList ); /** Tells if a string has any occurance of any character of another * string within itself * @param toSearch The string to be searched * @param searchList The string from which characters to be searched for are drawn
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -