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

📄 ncbistr.hpp

📁 ncbi源码
💻 HPP
📖 第 1 页 / 共 5 页
字号:
    /// Convert pointer to string.    ///    /// @param str    ///   Pointer to be converted.    /// @return    ///   String value representing the pointer.    static string PtrToString(const void* ptr);    /// Convert bool to string.    ///    /// @param value    ///   Boolean value to be converted.    /// @return    ///   One of: 'true, 'false'    static const string& BoolToString(bool value);    /// Convert string to bool.    ///    /// @param str    ///   Boolean string value to be converted.  Can recognize    ///   case-insensitive version as one of:  'true, 't', 'yes', 'y'    ///   for TRUE; and  'false', 'f', 'no', 'n' for FALSE.    /// @return    ///   TRUE or FALSE.    static bool StringToBool(const string& str);    /// Handle an arbitrary printf-style format string.    ///    /// This method exists only to support third-party code that insists on    /// representing messages in this format; please stick to type-checked    /// means of formatting such as the above ToString methods and I/O    /// streams whenever possible.    static string FormatVarargs(const char* format, va_list args);    /// Which type of string comparison.    enum ECase {        eCase,      ///< Case sensitive compare        eNocase     ///< Case insensitive compare    };    // ATTENTION.  Be aware that:    //    // 1) "Compare***(..., SIZE_TYPE pos, SIZE_TYPE n, ...)" functions    //    follow the ANSI C++ comparison rules a la "basic_string::compare()":    //       str[pos:pos+n) == pattern   --> return 0    //       str[pos:pos+n) <  pattern   --> return negative value    //       str[pos:pos+n) >  pattern   --> return positive value    //    // 2) "strn[case]cmp()" functions follow the ANSI C comparison rules:    //       str[0:n) == pattern[0:n)   --> return 0    //       str[0:n) <  pattern[0:n)   --> return negative value    //       str[0:n) >  pattern[0:n)   --> return positive value    /// Case-sensitive compare of a substring with a pattern.    ///    /// @param str    ///   String containing the substring to be compared.    /// @param pos    ///   Start position of substring to be compared.    /// @param n    ///   Number of characters in substring to be compared.    /// @param pattern    ///   String pattern (char*) to be compared with substring.    /// @return    ///   - 0, if str[pos:pos+n) == pattern.       ///   - Negative integer, if str[pos:pos+n) <  pattern.       ///   - Positive integer, if str[pos:pos+n) >  pattern.       /// @sa    ///   Other forms of overloaded CompareCase() with differences in argument    ///   types: char* vs. string&    static int CompareCase(const string& str, SIZE_TYPE pos, SIZE_TYPE n,                           const char* pattern);    /// Case-sensitive compare of a substring with a pattern.    ///    /// @param str    ///   String containing the substring to be compared.    /// @param pos    ///   Start position of substring to be compared.    /// @param n    ///   Number of characters in substring to be compared.    /// @param pattern    ///   String pattern (string&) to be compared with substring.    /// @return    ///   - 0, if str[pos:pos+n) == pattern.       ///   - Negative integer, if str[pos:pos+n) <  pattern.       ///   - Positive integer, if str[pos:pos+n) >  pattern.       /// @sa    ///   Other forms of overloaded CompareCase() with differences in argument    ///   types: char* vs. string&    static int CompareCase(const string& str, SIZE_TYPE pos, SIZE_TYPE n,                           const string& pattern);    /// Case-sensitive compare of two strings -- char* version.    ///    /// @param s1    ///   String to be compared -- operand 1.    /// @param s2    ///   String to be compared -- operand 2.    /// @return    ///   - 0, if s1 == s2.       ///   - Negative integer, if s1 < s2.       ///   - Positive integer, if s1 > s2.       /// @sa    ///   CompareNocase(), Compare() versions with same argument types.    static int CompareCase(const char* s1, const char* s2);    /// Case-sensitive compare of two strings -- string& version.    ///    /// @param s1    ///   String to be compared -- operand 1.    /// @param s2    ///   String to be compared -- operand 2.    /// @return    ///   - 0, if s1 == s2.       ///   - Negative integer, if s1 < s2.       ///   - Positive integer, if s1 > s2.       /// @sa    ///   CompareNocase(), Compare() versions with same argument types.    static int CompareCase(const string& s1, const string& s2);    /// Case-insensitive compare of a substring with a pattern.    ///    /// @param str    ///   String containing the substring to be compared.    /// @param pos    ///   Start position of substring to be compared.    /// @param n    ///   Number of characters in substring to be compared.    /// @param pattern    ///   String pattern (char*) to be compared with substring.    /// @return    ///   - 0, if str[pos:pos+n) == pattern (case-insensitive compare).       ///   - Negative integer, if str[pos:pos+n) <  pattern (case-insensitive    ///     compare).    ///   - Positive integer, if str[pos:pos+n) >  pattern (case-insensitive    ///     compare).    /// @sa    ///   Other forms of overloaded CompareNocase() with differences in    ///   argument types: char* vs. string&    static int CompareNocase(const string& str, SIZE_TYPE pos, SIZE_TYPE n,                             const char* pattern);    /// Case-insensitive compare of a substring with a pattern.    ///    /// @param str    ///   String containing the substring to be compared.    /// @param pos    ///   Start position of substring to be compared.    /// @param n    ///   Number of characters in substring to be compared.    /// @param pattern    ///   String pattern (string&) to be compared with substring.    /// @return    ///   - 0, if str[pos:pos+n) == pattern (case-insensitive compare).       ///   - Negative integer, if str[pos:pos+n) <  pattern (case-insensitive    ///     compare).    ///   - Positive integer, if str[pos:pos+n) >  pattern (case-insensitive    ///     compare).    /// @sa    ///   Other forms of overloaded CompareNocase() with differences in    ///   argument types: char* vs. string&    static int CompareNocase(const string& str, SIZE_TYPE pos, SIZE_TYPE n,                             const string& pattern);    /// Case-insensitive compare of two strings -- char* version.    ///    /// @param s1    ///   String to be compared -- operand 1.    /// @param s2    ///   String to be compared -- operand 2.    /// @return    ///   - 0, if s1 == s2 (case-insensitive compare).          ///   - Negative integer, if s1 < s2 (case-insensitive compare).          ///   - Positive integer, if s1 > s2 (case-insensitive compare).        /// @sa    ///   CompareCase(), Compare() versions with same argument types.    static int CompareNocase(const char* s1, const char* s2);    /// Case-insensitive compare of two strings -- string& version.    ///    /// @param s1    ///   String to be compared -- operand 1.    /// @param s2    ///   String to be compared -- operand 2.    /// @return    ///   - 0, if s1 == s2 (case-insensitive compare).          ///   - Negative integer, if s1 < s2 (case-insensitive compare).          ///   - Positive integer, if s1 > s2 (case-insensitive compare).        /// @sa    ///   CompareCase(), Compare() versions with same argument types.    static int CompareNocase(const string& s1, const string& s2);    /// Compare of a substring with a pattern.    ///    /// @param str    ///   String containing the substring to be compared.    /// @param pos    ///   Start position of substring to be compared.    /// @param n    ///   Number of characters in substring to be compared.    /// @param pattern    ///   String pattern (char*) to be compared with substring.    /// @param use_case    ///   Whether to do a case sensitive compare(eCase -- default), or a    ///   case-insensitive compare (eNocase).    /// @return    ///   - 0, if str[pos:pos+n) == pattern.       ///   - Negative integer, if str[pos:pos+n) <  pattern.       ///   - Positive integer, if str[pos:pos+n) >  pattern.       /// @sa    ///   Other forms of overloaded Compare() with differences in argument    ///   types: char* vs. string&    static int Compare(const string& str, SIZE_TYPE pos, SIZE_TYPE n,                       const char* pattern, ECase use_case = eCase);    /// Compare of a substring with a pattern.    ///    /// @param str    ///   String containing the substring to be compared.    /// @param pos    ///   Start position of substring to be compared.    /// @param n    ///   Number of characters in substring to be compared.    /// @param pattern    ///   String pattern (string&) to be compared with substring.    /// @param use_case    ///   Whether to do a case sensitive compare(default is eCase), or a    ///   case-insensitive compare (eNocase).    /// @return    ///   - 0, if str[pos:pos+n) == pattern.       ///   - Negative integer, if str[pos:pos+n) <  pattern.       ///   - Positive integer, if str[pos:pos+n) >  pattern.       /// @sa    ///   Other forms of overloaded Compare() with differences in argument    ///   types: char* vs. string&    static int Compare(const string& str, SIZE_TYPE pos, SIZE_TYPE n,                       const string& pattern, ECase use_case = eCase);    /// Compare two strings -- char* version.    ///    /// @param s1    ///   String to be compared -- operand 1.    /// @param s2    ///   String to be compared -- operand 2.    /// @param use_case    ///   Whether to do a case sensitive compare(default is eCase), or a    ///   case-insensitive compare (eNocase).    /// @return    ///   - 0, if s1 == s2.       ///   - Negative integer, if s1 < s2.       ///   - Positive integer, if s1 > s2.       /// @sa    ///   CompareNocase(), Compare() versions with similar argument types.    static int Compare(const char* s1, const char* s2,                       ECase use_case = eCase);    /// Compare two strings -- string&, char* version.    ///    /// @param s1    ///   String to be compared -- operand 1.    /// @param s2    ///   String to be compared -- operand 2.    /// @param use_case    ///   Whether to do a case sensitive compare(default is eCase), or a    ///   case-insensitive compare (eNocase).    /// @return    ///   - 0, if s1 == s2.       ///   - Negative integer, if s1 < s2.       ///   - Positive integer, if s1 > s2.       /// @sa    ///   CompareNocase(), Compare() versions with similar argument types.    static int Compare(const string& s1, const char* s2,                       ECase use_case = eCase);    /// Compare two strings -- char*, string& version.    ///    /// @param s1    ///   String to be compared -- operand 1.    /// @param s2    ///   String to be compared -- operand 2.    /// @param use_case    ///   Whether to do a case sensitive compare(default is eCase), or a    ///   case-insensitive compare (eNocase).    /// @return    ///   - 0, if s1 == s2.       ///   - Negative integer, if s1 < s2.       ///   - Positive integer, if s1 > s2.       /// @sa    ///   CompareNocase(), Compare() versions with similar argument types.    static int Compare(const char* s1, const string& s2,                       ECase use_case = eCase);    /// Compare two strings -- string& version.    ///    /// @param s1    ///   String to be compared -- operand 1.    /// @param s2    ///   String to be compared -- operand 2.    /// @param use_case    ///   Whether to do a case sensitive compare(default is eCase), or a    ///   case-insensitive compare (eNocase).    /// @return    ///   - 0, if s1 == s2.       ///   - Negative integer, if s1 < s2.       ///   - Positive integer, if s1 > s2.       /// @sa    ///   CompareNocase(), Compare() versions with similar argument types.    static int Compare(const string& s1, const string& s2,                       ECase use_case = eCase);    /// Case-sensitive equality of a substring with a pattern.    ///    /// @param str    ///   String containing the substring to be compared.    /// @param pos    ///   Start position of substring to be compared.    /// @param n    ///   Number of characters in substring to be compared.    /// @param pattern    ///   String pattern (char*) to be compared with substring.    /// @return    ///   - true, if str[pos:pos+n) equals pattern.       ///   - false, otherwise    /// @sa    ///   Other forms of overloaded EqualCase() with differences in argument    ///   types: char* vs. string&    static bool EqualCase(const string& str, SIZE_TYPE pos, SIZE_TYPE n,                           const char* pattern);    /// Case-sensitive equality of a substring with a pattern.    ///    /// @param str    ///   String containing the substring to be compared.    /// @param pos    ///   Start position of substring to be compared.    /// @param n    ///   Number of characters in substring to be compared.    /// @param pattern    ///   String pattern (string&) to be compared with substring.    /// @return    ///   - true, if str[pos:pos+n) equals pattern.       ///   - false, otherwise    /// @sa    ///   Other forms of overloaded EqualCase() with differences in argument    ///   types: char* vs. string&    static bool EqualCase(const string& str, SIZE_TYPE pos, SIZE_TYPE n,                           const string& pattern);    /// Case-sensitive equality of two strings -- char* version.    ///    /// @param s1    ///   String to be compared -- operand 1.    /// @param s2    ///   String to be compared -- operand 2.    /// @return    ///   - true, if s1 equals s2    ///   - false, otherwise    /// @sa    ///   EqualCase(), Equal() versions with same argument types.    static bool EqualCase(const char* s1, const char* s2);

⌨️ 快捷键说明

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