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

📄 ofstring.h

📁 转化为DIB位图再显示出来的dicom文件C++代码
💻 H
📖 第 1 页 / 共 3 页
字号:
     */    const char* c_str() const    {        return (this->theCString)?(this->theCString):("");    }    /** if size() is nonzero, this function returns a pointer to the initial     *  element of an array whose first size() elements equal the     *  corresponding elements of the string controlled by *this.     *  If size() is zero, the member returns a non-null pointer that is     *  copyable and can have zero added to it.     *  @return pointer to char array for this string     */    const char* data() const;    /** returns a count of the number of char-like objects currently in     *  the string.     *  @return number of char-like objects currently in string     */    size_t size() const    {        return (this->theCString)?(strlen(this->theCString)):(0);    }    /** returns a count of the number of char-like objects currently in     *  the string.     *  @return number of char-like objects currently in string     */    size_t length() const    {        return this->size();    }    /** return true if the string is empty, false otherwise.     *  @return true if the string is empty, false otherwise.     */    OFBool empty() const    {        return (this->size() == 0)?(OFTrue):(OFFalse);    }    /** if n <= size(), truncates the string to length n else it pads the     *  extra locations with c. Reports a length error if n equals OFString_npos.     *  @param n length to truncate string to     *  @param c character to pad extra locations with     */    void resize (size_t n, char c = '\0');    /** returns the size of the allocated storage in the string.     *  @return size of the allocated storage in the string     */    size_t capacity () const    {        return this->theCapacity;    }    /** returns the maximum size of a string which could possibly by allocated.     *  @return maximum size of a string which could possibly by allocated.     */    size_t max_size() const    {        return ((OFString_npos - 1)/sizeof(char));    }    /** empty the string of all contents     */    void clear()    {        this->erase();    }    /** directive that informs a string of a planned     *  change in size, so that it can manage the storage allocation     *  accordingly.  Reallocation of a string happens if and only if     *  the current capacity is less than res_arg. After this call,     *  capacity() is greater than or equal to res_arg if reallocation     *  happens and equal to the previous value of capacity() otherwise.     *  @param res_arg string capacity to reserve     */    void reserve(size_t res_arg);    /** replaces the string designated by s with a copy of a     *  range of characters from the current string. The range copied begins     *  at position pos of the current string and extends for n characters or     *  up to the end of the current string, whichever comes first.     *  Does not append a null object to the end of the string designated by s.     *  @param s character array to copy to     *  @param n size of character array     *  @param pos position in string to start copying from     *  @return number of characters copied     */    size_t copy(char* s, size_t n, size_t pos = 0) const;    /** returns a copy the substring consisting of at most n     *  characters starting at position pos of the current string.     *  @param pos position in string to start copying from     *  @param n number of characters to copy     */    OFString substr(size_t pos = 0, size_t n = OFString_npos) const;    /** swaps the contents of the two strings. The time     *  complexity of this function is linear.     *  @param s string to swap with     */    void swap(OFString& s);    /** determines the effective length rlen of the strings to compare as     *  the smallest of size() and str.size(). The function then compares     *  the two strings by calling strcmp(data(), str.data(), rlen).     *  Returns: the nonzero result if the result of the comparison is     *  nonzero. Otherwise, returns a value < 0 if size() < str.size(),     *  a value of 0 if size() == str.size(), or a value > 0 if     *  size() > str.size().     *  @param str string to compare to     *  @return comparison result as described above     */    int compare(const OFString& str) const;    /** constructs a temporary string from the input and compares     *  it with the current string     *  @param pos1 position to start copying from in str     *  @param n1 maximum number of characters to copy from str     *  @param str string to copy from     *  @return comparison result     */    int compare(size_t pos1, size_t n1, const OFString& str) const;    /** constructs a temporary string from this object and another     *  temporary from the input and compares the two temporaries     *  @param pos1 position to start copying from this object     *  @param n1 maximum number of characters to copy from this object     *  @param str string to create second temporary from     *  @param pos2 position to start copying from in str     *  @param n2 maximum number of characters to copy from str     *  @return comparison result     */    int compare(size_t pos1, size_t n1, const OFString& str,         size_t pos2, size_t n2) const;    /** constructs a temporary string from the input and compares     *  it with the current string     *  @param s pointer to a zero-terminated C string. Must not be NULL.     *  @return comparison result     */    int compare(const char* s) const;    /** constructs a temporary string from this object and another     *  temporary from the input  and compares the two temporaries     *  @param pos1 position to start copying from this object     *  @param n1 maximum number of characters to copy from this object     *  @param s pointer to an array of char of length n. Must not be NULL.     *  @param n2 number of characters in array s     *  @return comparison result     */    int compare(size_t pos1, size_t n1,         const char* s, size_t n2 = OFString_npos) const;    /** determines the earliest occurrence of the     *  input pattern in the current string object, starting from position     *  pos in the current string. If find can determine such an occurrence,     *  it returns the starting index of pattern in the current string.     *  Otherwise, it returns string::npos.     *  @param pattern pattern to find     *  @param pos position to start searching from     *  @return index of pattern as described above     */    size_t find(const OFString& pattern, size_t pos = 0) const;    /** creates a pattern string from the input and determines the earliest     *  occurrence of the pattern in the current string object, starting from position     *  pos in the current string. If find can determine such an occurrence,     *  it returns the starting index of pattern in the current string.     *  Otherwise, it returns string::npos.     *  @param pattern pointer to an array of char of length n. Must not be NULL.     *  @param pos position to start searching from     *  @param n number of characters in array     *  @return index of pattern in string     */    size_t find(const char* pattern, size_t pos, size_t n) const;    /** creates a pattern string from the input and determines the earliest     *  occurrence of the pattern in the current string object, starting from position     *  pos in the current string. If find can determine such an occurrence,     *  it returns the starting index of pattern in the current string.     *  Otherwise, it returns string::npos.     *  @param pattern pointer to a zero-terminated C string. Must not be NULL.     *  @param pos position to start searching from     *  @return index of pattern in string     */    size_t find(const char* pattern, size_t pos = 0) const;    /** creates a pattern string from the input and determines the earliest     *  occurrence of the pattern in the current string object, starting from position     *  pos in the current string. If find can determine such an occurrence,     *  it returns the starting index of pattern in the current string.     *  Otherwise, it returns string::npos.     *  @param pattern character     *  @param pos position to start searching from     *  @return index of pattern in string     */    size_t find(char pattern, size_t pos = 0) const;    /** scans the current string backwards, and finds the first     *  occurrence of pattern in the string (from the back). The starting     *  index of the matched position in the current string should be less     *  than or equal to the parameter pos. If a match is found, the starting     *  index is returned; otherwise, the function returns string::npos.     *  @param pattern pattern to find     *  @param pos position to start searching from     *  @return index of pattern as described above     */    size_t rfind(const OFString& pattern, size_t pos = OFString_npos) const;    /** scans the current string backwards, and finds the first     *  occurrence of pattern in the string (from the back). The starting     *  index of the matched position in the current string should be less     *  than or equal to the parameter pos. If a match is found, the starting     *  index is returned; otherwise, the function returns string::npos.     *  @param pattern pointer to an array of char of length n. Must not be NULL.     *  @param pos position to start searching from     *  @param n number of characters in array     *  @return index of pattern in string     */    size_t rfind(const char* pattern, size_t pos, size_t n) const;    /** scans the current string backwards, and finds the first     *  occurrence of pattern in the string (from the back). The starting     *  index of the matched position in the current string should be less     *  than or equal to the parameter pos. If a match is found, the starting     *  index is returned; otherwise, the function returns string::npos.     *  @param pattern pointer to a zero-terminated C string. Must not be NULL.     *  @param pos position to start searching from     *  @return index of pattern in string     */    size_t rfind(const char* pattern, size_t pos = OFString_npos) const;    /** scans the current string backwards, and finds the first     *  occurrence of pattern in the string (from the back). The starting     *  index of the matched position in the current string should be less     *  than or equal to the parameter pos. If a match is found, the starting     *  index is returned; otherwise, the function returns string::npos.     *  @param pattern character     *  @param pos position to start searching from     *  @return index of pattern in string     */    size_t rfind(char pattern, size_t pos = OFString_npos) const;    /** determines the first location, loc, between pos and     *  the end of the current string, such that the character at loc matches     *  at least one character from the set of characters. If such a     *  location can be determined, it is returned. Otherwise, the function     *  returns string::npos.     *  @param str set of characters to find     *  @param pos position to start searching from     *  @return index of character as described above     */    size_t find_first_of(const OFString& str, size_t pos = 0) const;    /** determines the first location, loc, between pos and     *  the end of the current string, such that the character at loc matches     *  at least one character from the set of characters. If such a     *  location can be determined, it is returned. Otherwise, the function     *  returns string::npos.     *  @param s set of characters to find, pointer to an array of char of length n. Must not be NULL.     *  @param pos position to start searching from     *  @param n number of characters in array     *  @return index of pattern in string     */    size_t find_first_of(const char* s, size_t pos, size_t n) const;    /** determines the first location, loc, between pos and     *  the end of the current string, such that the character at loc matches     *  at least one character from the set of characters. If such a     *  location can be determined, it is returned. Otherwise, the function     *  returns string::npos.     *  @param s set of characters to find, pointer to a zero-terminated C string. Must not be NULL.     *  @param pos position to start searching from     *  @return index of pattern in string     */    size_t find_first_of(const char* s, size_t pos = 0) const;    /** determines the first location, loc, between pos and     *  the end of the current string, such that the character at loc matches     *  the given character. If such a     *  location can be determined, it is returned. Otherwise, the function     *  returns string::npos.     *  @param s character to find     *  @param pos position to start searching from     *  @return index of character     */    size_t find_first_of(char s, size_t pos = 0) const;    /** determines the highest location, loc, up to pos, such     *  that the character at loc matches at least one character from the     *  set of characters. If such a location can be determined, it is     *  returned. Otherwise, the function returns string::npos.     *  @param str set of characters to find     *  @param pos position to start searching from     *  @return index of character as described above     */    size_t find_last_of(const OFString& str, size_t pos = OFString_npos) const;    /** determines the highest location, loc, up to pos, such     *  that the character at loc matches at least one character from the     *  set of characters. If such a location can be determined, it is     *  returned. Otherwise, the function returns string::npos.     *  @param s set of characters to find, pointer to an array of char of length n. Must not be NULL.     *  @param pos position to start searching from     *  @param n number of characters in array     *  @return index of pattern in string     */    size_t find_last_of(const char* s, size_t pos, size_t n) const;    /** determines the highest location, loc, up to pos, such     *  that the character at loc matches at least one character from the     *  set of characters. If such a location can be determined, it is     *  returned. Otherwise, the function returns string::npos.     *  @param s set of characters to find, pointer to a zero-terminated C string. Must not be NULL.     *  @param pos position to start searching from     *  @return index of pattern in string     */    size_t find_last_of(const char* s, size_t pos = OFString_npos) const;    /** determines the highest location, loc, up to pos, such     *  that the character at loc matches the given character.     *  If such a location can be determined, it is     *  returned. Otherwise, the function returns string::npos.     *  @param s character to find     *  @param pos position to start searching from     *  @return index of character     */    size_t find_last_of(char s, size_t pos = OFString_npos) const;    /** determines the first location loc, between pos and     *  the end of the current string, such that the character at loc does not     *  match any character from the set of characters. If such a location     *  is found, it is returned. Otherwise, the function returns string::npos.     *  @param str set of characters to find     *  @param pos position to start searching from     *  @return index of character as described above     */    size_t find_first_not_of(const OFString& str, size_t pos = 0) const;    /** determines the first location loc, between pos and     *  the end of the current string, such that the character at loc does not     *  match any character from the set of characters. If such a location     *  is found, it is returned. Otherwise, the function returns string::npos.     *  @param s set of characters to find, pointer to an array of char of length n. Must not be NULL.     *  @param pos position to start searching from     *  @param n number of characters in array     *  @return index of pattern in string     */    size_t find_first_not_of(const char* s, size_t pos, size_t n) const;    /** determines the first location loc, between pos and     *  the end of the current string, such that the character at loc does not     *  match any character from the set of characters. If such a location     *  is found, it is returned. Otherwise, the function returns string::npos.     *  @param s set of characters to find, pointer to a zero-terminated C string. Must not be NULL.     *  @param pos position to start searching from     *  @return index of pattern in string     */    size_t find_first_not_of(const char* s, size_t pos = 0) const;    /** determines the first location loc, between pos and     *  the end of the current string, such that the character at loc does not     *  match the given character. If such a location     *  is found, it is returned. Otherwise, the function returns string::npos.     *  @param c character to find     *  @param pos position to start searching from     *  @return index of character     */    size_t find_first_not_of(char c, size_t pos = 0) const;    /** scans the current string up to the position pos and     *  determines the highest location, loc, such that the character at loc     *  does not match any character from the set of characters. If such     *  a location is found, it is returned. Otherwise, the function returns     *  string::npos.     *  @param str set of characters to find     *  @param pos position to start searching from     *  @return index of character as described above

⌨️ 快捷键说明

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