&
Get(
void)
77 static stringempty_str;
81 #if defined(HAVE_WSTRING) 86 static constwstring&
Get(
void)
88 staticwstring empty_str;
98 static const string&
Get(
void);
102 static const string& FirstGet(
void);
103 static const string* m_Str;
106 # if defined(HAVE_WSTRING) 111 static constwstring&
Get(
void);
115 static constwstring& FirstGet(
void);
116 static constwstring* m_Str;
122 #define NcbiEmptyString NCBI_NS_NCBI::CNcbiEmptyString::Get() 123 #define kEmptyStr NcbiEmptyString 125 #if defined(HAVE_WSTRING) 126 # define NcbiEmptyWString NCBI_NS_NCBI::CNcbiEmptyWString::Get() 127 # define kEmptyWStr NcbiEmptyWString 133 #define NPOS NCBI_NS_STD::string::npos 145 #if defined(NCBI_OS_MSWIN) && defined(_UNICODE) 151 # define _TX(x) L ## x 155 # define _T_XSTRING(x) \ 156 ncbi::CUtf8::AsBasicString<ncbi::TXChar>(x, NULL, ncbi::CUtf8::eValidate) 158 # define _T_XSTRING(x) \ 159 ncbi::CUtf8::AsBasicString<ncbi::TXChar>(x, NULL, ncbi::CUtf8::eNoValidate) 161 # define _T_STDSTRING(x) ncbi::CUtf8::AsUTF8(x) 162 # define _T_XCSTRING(x) _T_XSTRING(x).c_str() 163 # define _T_CSTRING(x) _T_STDSTRING(x).c_str() 165 # define NcbiEmptyXCStr NcbiEmptyWCStr 166 # define NcbiEmptyXString NcbiEmptyWString 167 # define kEmptyXStr kEmptyWStr 168 # define kEmptyXCStr kEmptyWCStr 179 # define _T_XSTRING(x) (x) 180 # define _T_STDSTRING(x) (x) 181 # define _T_XCSTRING(x) ncbi::impl_ToCString(x) 182 # define _T_CSTRING(x) (x) 184 # define NcbiEmptyXCStr NcbiEmptyCStr 185 # define NcbiEmptyXString NcbiEmptyString 186 # define kEmptyXStr kEmptyStr 187 # define kEmptyXCStr kEmptyCStr 198 #if defined(NCBI_CUTF8_ENCODING_CLASSIC) || !defined(HAVE_ENUM_CLASS) 227 #define eEncoding_Unknown EEncoding::Unknown 228 #define eEncoding_UTF8 EEncoding::UTF8 229 #define eEncoding_Ascii EEncoding::Ascii 230 #define eEncoding_ISO8859_1 EEncoding::ISO8859_1 231 #define eEncoding_Windows_1252 EEncoding::Windows_1252 232 #define eEncoding_CESU8 EEncoding::CESU8 251fUseLowercase = (1 << 4),
252fWithRadix = (1 << 5),
253fWithSign = (1 << 6),
254fWithCommas = (1 << 7),
255fDoubleFixed = (1 << 8),
256fDoubleScientific = (1 << 9),
257fDoublePosix = (1 << 10),
258fDoubleGeneral = fDoubleFixed | fDoubleScientific,
260fDS_Binary = (1 << 11),
261fDS_NoDecimalPoint = (1 << 12),
262fDS_PutSpaceBeforeSuffix = (1 << 13),
263fDS_ShortSuffix = (1 << 14),
264fDS_PutBSuffixToo = (1 << 15)
285fConvErr_NoThrow = (1 << 0),
291fConvErr_NoErrMessage = (1 << 2),
292fMandatorySign = (1 << 17),
293fAllowCommas = (1 << 18),
294fAllowLeadingSpaces = (1 << 19),
295fAllowLeadingSymbols = (1 << 20) | fAllowLeadingSpaces,
297fAllowTrailingSpaces = (1 << 21),
298fAllowTrailingSymbols = (1 << 22) | fAllowTrailingSpaces,
300fDecimalPosix = (1 << 23),
301fDecimalPosixOrLocal = (1 << 24),
302fDecimalPosixFinite = (1 << 25),
306fDS_ForceBinary = (1 << 26),
307fDS_ProhibitFractions = (1 << 27),
308fDS_ProhibitSpaceBeforeSuffix = (1 << 28)
329 template<
typenameTNumeric>
334 returnx_StringToNumeric<TNumeric>(
str,
flags, base);
355 template<
typenameTNumeric>
382 returnStringToNonNegativeInt(
str);
401TStringToNumFlags
flags= 0,
420TStringToNumFlags
flags= 0,
439TStringToNumFlags
flags= 0,
458TStringToNumFlags
flags= 0,
490 static doubleStringToDoublePosix(
const char*
str,
char** endptr=0,
491TStringToNumFlags
flags=0);
511TStringToNumFlags
flags= 0);
518 static doubleStringToDoubleEx(
const char*
str,
size_t size,
519TStringToNumFlags
flags= 0);
537TStringToNumFlags
flags= 0,
556TStringToNumFlags
flags= 0,
583TStringToNumFlags
flags= 0);
611TStringToNumFlags
flags,
630TStringToNumFlags
flags= 0,
654 static intHexChar(
charch);
671 template<
typenameTNumeric>
679 template<
typenameTStrictId>
683 returnNumericToString(
value.Get(),
flags, base);
703 template<
typenameTNumeric>
707x_NumericToString(out_str,
value,
flags, base);
724 static stringIntToString(
int value, TNumToStringFlags
flags= 0,
727 static stringIntToString(
unsigned int value, TNumToStringFlags
flags= 0,
746 static voidIntToString(
string& out_str,
int value,
747TNumToStringFlags
flags= 0,
750 static voidIntToString(
string& out_str,
unsigned int value,
751TNumToStringFlags
flags= 0,
768 static stringUIntToString(
unsigned int value,
769TNumToStringFlags
flags= 0,
772 static stringUIntToString(
int value,
773TNumToStringFlags
flags= 0,
792 static voidUIntToString(
string& out_str,
unsigned int value,
793TNumToStringFlags
flags= 0,
796 static voidUIntToString(
string& out_str,
int value,
797TNumToStringFlags
flags= 0,
814 static stringLongToString(
long value, TNumToStringFlags
flags= 0,
833 static voidLongToString(
string& out_str,
long value,
834TNumToStringFlags
flags= 0,
851 static stringULongToString(
unsigned long value,
852TNumToStringFlags
flags= 0,
871 static voidULongToString(
string& out_str,
unsigned long value,
872TNumToStringFlags
flags= 0,
890TNumToStringFlags
flags= 0,
910TNumToStringFlags
flags= 0,
928TNumToStringFlags
flags= 0,
947 static voidUInt8ToString(
string& out_str,
Uint8 value,
948TNumToStringFlags
flags= 0,
979 static stringUInt8ToString_DataSize(
Uint8 value,
980TNumToStringFlags
flags= 0,
981 unsigned intmax_digits = 3);
996 static voidUInt8ToString_DataSize(
string& out_str,
998TNumToStringFlags
flags= 0,
999 unsigned intmax_digits = 3);
1020TNumToStringFlags
flags= 0);
1043 static voidDoubleToString(
string& out_str,
double value,
1045TNumToStringFlags
flags= 0);
1069TNumToStringFlags
flags= 0);
1129 int* dec,
int* sign);
1145 static stringSizetToString(
size_t value,
1146TNumToStringFlags
flags= 0,
1159 static voidPtrToString(
string& out_str,
const void* ptr);
1169 static stringPtrToString(
const void* ptr);
1179 static const stringBoolToString(
bool value);
1200 static stringFormatVarargs(
const char*
format, va_list args);
1275 static intCompareCase(
const char* s1,
const char* s2);
1343 static int CompareNocase(
const char* s1,
const char* s2);
1380 const char* s2, ECase use_case = eCase);
1421 static int Compare(
const char* s1,
const char* s2,
1422ECase use_case = eCase);
1441ECase use_case = eCase);
1492 static boolEqualCase(
const char* s1,
const char* s2);
1556 static boolEqualNocase(
const char* s1,
const char* s2);
1591 const char* s2, ECase use_case = eCase);
1631 static boolEqual(
const char* s1,
const char* s2,
1632ECase use_case = eCase);
1649ECase use_case = eCase);
1666 static int strcmp(
const char* s1,
const char* s2);
1682 static int strncmp(
const char* s1,
const char* s2,
size_t n);
1696 static int strcasecmp(
const char* s1,
const char* s2);
1711 static int strncasecmp(
const char* s1,
const char* s2,
size_t n);
1715 static size_tstrftime(
char* s,
size_tmaxsize,
const char*
format,
1716 const structtm* timeptr);
1820 static string& ToLower(
string&
str);
1828 static char* ToLower(
char*
str);
1836 static string& ToUpper(
string&
str);
1844 static char* ToUpper(
char*
str);
1867 ECaseuse_case = eCase);
1879 ECaseuse_case = eCase);
1891 ECaseuse_case = eCase);
1903 ECaseuse_case = eCase);
1972ECase use_case = eCase,
1973EDirection direction = eForwardSearch,
2027EOccurrence which = eFirst,
2028ECase use_case = eCase);
2033{
returnFindCase(
str, pattern, start); }
2091EOccurrence which = eFirst);
2150EOccurrence which = eFirst);
2158 static const string* Find (
constlist<string>& lst,
2160ECase use_case = eCase);
2162 static const string* FindCase (
constlist<string>& lst,
2165 static const string* FindNoCase(
constlist<string>& lst,
2168 static const string* Find (
constvector<string>& vec,
2170ECase use_case = eCase);
2172 static const string* FindCase (
constvector<string>& vec,
2175 static const string* FindNoCase(
constvector<string>& vec,
2196ECase use_case = eCase,
2197EDirection direction = eForwardSearch);
2233 ECaseuse_case = eCase) {
2234 returnFindWord(
str, word, use_case, which == eFirst ? eForwardSearch : eReverseSearch);
2254 static stringTruncateSpaces(
const string&
str,
2255ETrunc where = eTrunc_Both);
2273ETrunc where = eTrunc_Both);
2280 ETruncwhere = eTrunc_Both) {
2281 returnTruncateSpaces_Unsafe(
str, where);
2289 ETruncwhere = eTrunc_Both) {
2290 returnTruncateSpaces_Unsafe(
str, where);
2301 static voidTruncateSpacesInPlace(
string&
str, ETrunc where = eTrunc_Both);
2302 static voidTruncateSpacesInPlace(
CTempString&, ETrunc where = eTrunc_Both);
2316 static voidTrimPrefixInPlace(
string&
str,
const CTempStringprefix,
2317ECase use_case = eCase);
2319ECase use_case = eCase);
2341ECase use_case = eCase);
2353 static voidTrimSuffixInPlace(
string&
str,
const CTempStringsuffix,
2354ECase use_case = eCase);
2356ECase use_case = eCase);
2378ECase use_case = eCase);
2409 static string& Replace(
const string& src,
2410 const string& search,
2411 const string& replace,
2446 static stringReplace(
const string& src,
2447 const string& search,
2448 const string& replace,
2482 static string& ReplaceInPlace(
string& src,
2483 const string& search,
2484 const string& replace,
2500fSplit_MergeDelimiters = 1 << 0,
2501fSplit_Truncate_Begin = 1 << 1,
2502fSplit_Truncate_End = 1 << 2,
2503fSplit_Truncate = fSplit_Truncate_Begin | fSplit_Truncate_End,
2504fSplit_ByPattern = 1 << 3,
2505fSplit_CanEscape = 1 << 4,
2506fSplit_CanSingleQuote = 1 << 5,
2507fSplit_CanDoubleQuote = 1 << 6,
2508fSplit_CanQuote = fSplit_CanSingleQuote | fSplit_CanDoubleQuote,
2510fSplit_Tokenize = fSplit_MergeDelimiters | fSplit_Truncate
2517eMergeDelims = fSplit_MergeDelimiters | fSplit_Truncate,
2548TSplitFlags
flags= 0,
2549vector<SIZE_TYPE>* token_pos =
NULL);
2551 staticvector<string>& Split(
2554vector<string>&
arr,
2555TSplitFlags
flags= 0,
2556vector<SIZE_TYPE>* token_pos =
NULL);
2558 staticlist<CTempString>& Split(
2561list<CTempString>&
arr,
2562TSplitFlags
flags= 0,
2563vector<SIZE_TYPE>* token_pos =
NULL,
2566 staticvector<CTempString>& Split(
2569vector<CTempString>&
arr,
2570TSplitFlags
flags= 0,
2571vector<SIZE_TYPE>* token_pos =
NULL,
2574 staticlist<CTempStringEx>& Split(
2577list<CTempStringEx>&
arr,
2578TSplitFlags
flags= 0,
2579vector<SIZE_TYPE>* token_pos =
NULL,
2582 staticvector<CTempStringEx>& Split(
2585vector<CTempStringEx>&
arr,
2586TSplitFlags
flags= 0,
2587vector<SIZE_TYPE>* token_pos =
NULL,
2622TSplitFlags
flags= 0);
2628TSplitFlags
flags= 0,
2635TSplitFlags
flags= 0,
2641 staticlist<string>& SplitByPattern(
2645TSplitFlags
flags= 0,
2646vector<SIZE_TYPE>* token_pos =
NULL);
2648 staticvector<string>& SplitByPattern(
2651vector<string>&
arr,
2652TSplitFlags
flags= 0,
2653vector<SIZE_TYPE>* token_pos =
NULL);
2655 staticlist<CTempString>& SplitByPattern(
2658list<CTempString>&
arr,
2659TSplitFlags
flags= 0,
2660vector<SIZE_TYPE>* token_pos =
NULL,
2663 staticvector<CTempString>& SplitByPattern(
2666vector<CTempString>&
arr,
2667TSplitFlags
flags= 0,
2668vector<SIZE_TYPE>* token_pos =
NULL,
2671 staticlist<CTempStringEx>& SplitByPattern(
2674list<CTempStringEx>&
arr,
2675TSplitFlags
flags= 0,
2676vector<SIZE_TYPE>* token_pos =
NULL,
2679 staticvector<CTempStringEx>& SplitByPattern(
2682vector<CTempStringEx>&
arr,
2683TSplitFlags
flags= 0,
2684vector<SIZE_TYPE>* token_pos =
NULL,
2697 template<
typenameTContainer>
2701 returnx_Join(begin(
arr), end(
arr), delim);
2703 template<
typenameTValue>
2707 returnx_Join(begin(
arr), end(
arr), delim);
2709 template<
typenameTInputIterator>
2713 returnx_Join(from, to, delim);
2715 template<
typenameTInputIterator>
2719 returnx_Join( from, to, delim);
2721 template<
typenameTIterator,
typenameFTransform>
2731eNewLine_Quote = fNewLine_Quote,
2732fNewLine_Passthru = 1,
2733eNewLine_Passthru = fNewLine_Passthru,
2734fNonAscii_Passthru = 0,
2735fNonAscii_Quote = 2,
2736fPrintable_Full = 64
2783 charescape_char =
'\\');
2796 static stringUnescape(
const CTempString str,
charescape_char =
'\\');
2818 static stringQuote(
const CTempString str,
charquote_char =
'"',
charescape_char =
'\\');
2831 static stringUnquote(
const CTempString str,
charescape_char =
'\\');
2845fSS_Reject = 1 << 11,
2849fSS_Remove = 1 << 12,
2850fSS_NoMerge = 1 << 13,
2851fSS_NoTruncate_Begin = 1 << 14,
2852fSS_NoTruncate_End = 1 << 15,
2853fSS_NoTruncate = fSS_NoTruncate_Begin | fSS_NoTruncate_End
2932 charreject_replacement =
' ',
2933TSS_Flags
flags= 0);
2941eEscSeqRange_Standard,
2943eEscSeqRange_FirstByte,
2973EEscSeqRange
mode= eEscSeqRange_Standard,
2974 charuser_char =
'?');
3002 static stringCEncode(
const CTempString str, EQuoted quoted = eQuoted);
3029eXmlEnc_Contents = 0,
3032eXmlEnc_CommentSafe = 1 << 0,
3036eXmlEnc_Unsafe_Skip = 1 << 1,
3037eXmlEnc_Unsafe_Throw = 1 << 2
3050fHtmlEnc_EncodeAll = 0,
3051fHtmlEnc_SkipLiteralEntities = 1 << 1,
3052fHtmlEnc_SkipNumericEntities = 1 << 2,
3053fHtmlEnc_SkipEntities = fHtmlEnc_SkipLiteralEntities | fHtmlEnc_SkipNumericEntities,
3054fHtmlEnc_CheckPreencoded = 1 << 3
3069fHtmlDec_CharRef_Entity = 1,
3070fHtmlDec_CharRef_Numeric = 1 << 1,
3071fHtmlDec_Encoding_Changed = 1 << 2
3115 static stringJsonEncode(
const CTempString str, EJsonEncode encoding = eJsonEnc_UTF8);
3140 static stringShellEncode(
const string&
str);
3195{
returnSQLEncode(
str, eSqlEnc_Plain); }
3200 static voidURLDecodeInPlace(
string&
str,
EUrlDecodeflag = eUrlDec_All);
3213 static stringBase64Encode(
const CTempString str,
size_tline_len = 0);
3230fWrap_Hyphenate = 0x1,
3231fWrap_HTMLPre = 0x2,
3232fWrap_FlatFile = 0x4
3264 template<
typename_D>
3265 static voidWrapIt(
const string&
str,
SIZE_TYPEwidth,
3267 const string* prefix = 0,
3268 const string* prefix1 = 0);
3286m_list.push_back(s);
3291m_list.back().assign(s.
data(), s.
length());
3295 static voidWrap(
const string&
str,
SIZE_TYPEwidth,
3296IWrapDest& dest, TWrapFlags
flags,
3297 const string* prefix,
3298 const string* prefix1);
3300 staticlist<string>& Wrap(
const string&
str,
SIZE_TYPEwidth,
3301list<string>&
arr, TWrapFlags
flags= 0,
3302 const string* prefix = 0,
3303 const string* prefix1 = 0);
3305 staticlist<string>& Wrap(
const string&
str,
SIZE_TYPEwidth,
3306list<string>&
arr, TWrapFlags
flags,
3307 const string& prefix,
3308 const string* prefix1 = 0);
3310 staticlist<string>& Wrap(
const string&
str,
SIZE_TYPEwidth,
3311list<string>&
arr, TWrapFlags
flags,
3312 const string& prefix,
3313 const string& prefix1);
3345 staticlist<string>& WrapList(
constlist<string>&
l,
SIZE_TYPEwidth,
3346 const string& delim, list<string>&
arr,
3347TWrapFlags
flags= 0,
3348 const string* prefix = 0,
3349 const string* prefix1 = 0);
3351 staticlist<string>& WrapList(
constlist<string>&
l,
SIZE_TYPEwidth,
3352 const string& delim, list<string>&
arr,
3354 const string& prefix,
3355 const string* prefix1 = 0);
3357 staticlist<string>& WrapList(
constlist<string>&
l,
SIZE_TYPEwidth,
3358 const string& delim, list<string>&
arr,
3360 const string& prefix,
3361 const string& prefix1);
3410fDedent_NormalizeEmptyLines = 1 << 0,
3414fDedent_SkipFirstLine = 1 << 1,
3415fDedent_SkipEmptyFirstLine = 1 << 2,
3549 template<
typenameTNumeric,
typenameTSource>
3553 returnx_ReportLimitsError(
str,
flags);
3557 template<
typenameTNumeric,
typenameTSource>
3562 returnx_ReportLimitsError(
str,
flags);
3567 template<
typenameTNumeric>
3571 int n= StringToInt(
str,
flags, base);
3572 returnx_VerifyIntLimits<TNumeric>(
n,
str,
flags) ? (TNumeric)
n: 0;
3574 template<
typenameTNumeric>
3578 unsigned int n= StringToUInt(
str,
flags, base);
3579 returnx_VerifyIntLimits<TNumeric>(
n,
str,
flags) ? (TNumeric)
n: 0;
3582 template<
typenameTNumeric>
3586 returnStringToInt(
str,
flags, base);
3588 template<
typenameTNumeric>
3592 returnStringToUInt(
str,
flags, base);
3594 template<
typenameTNumeric>
3598 returnStringToLong(
str,
flags, base);
3600 template<
typenameTNumeric>
3604 returnStringToULong(
str,
flags, base);
3606 template<
typenameTNumeric>
3612 template<
typenameTNumeric>
3616 returnStringToUInt8(
str,
flags, base);
3618 template<
typenameTStrictId>
3622 returnTStrictId(StringToNumeric<typename TStrictId::TId>(
str,
flags, base));
3625 template<
typenameTNumeric>
3629 double n= StringToDouble(
str,
flags);
3630 returnx_VerifyFloatLimits<TNumeric>(
n,
str,
flags) ? (TNumeric)
n: 0;
3632 template<
typenameTNumeric>
3636 returnStringToDouble(
str,
flags);
3639 template<
typenameTNumeric>
3643 int n= StringToInt(
str,
flags, base);
3645 if(( !
n&& errno ) || !x_VerifyIntLimits<TNumeric>(
n,
str,
flags)) {
3651 template<
typenameTNumeric>
3655 unsigned int n= StringToUInt(
str,
flags, base);
3657 if(( !
n&& errno ) || !x_VerifyIntLimits<TNumeric>(
n,
str,
flags)) {
3663 template<
typenameTNumeric>
3668 return(*
value|| !errno);
3670 template<
typenameTNumeric>
3675 return(*
value|| !errno);
3681 return(*
value|| !errno);
3687 return(*
value|| !errno);
3689 template<
typenameTNumeric>
3694 return(*
value|| !errno);
3696 template<
typenameTNumeric>
3701 return(*
value|| !errno);
3706 double n= StringToDouble(
str,
flags);
3708 if(( !
n&& errno ) || !x_VerifyFloatLimits<float>(
n,
str,
flags)) {
3718 return(*
value|| !errno);
3720 template<
typenameTStrictId>
3724 returnx_StringToNumeric(
str, &
value->Set(),
flags, base);
3728 template<
typenameTNumeric>
3734 template<
typenameTNumeric>
3748ULongToString(out_str,
value,
flags, base);
3750 #if NCBI_COMPILER_MSVC && (_MSC_VER < 1900) 3752x_NumericToString(
string& out_str,
Int8 value, TNumToStringFlags
flags,
intbase)
3757x_NumericToString(
string& out_str,
Uint8 value, TNumToStringFlags
flags,
intbase)
3759UInt8ToString(out_str,
value,
flags, base);
3762 template<
typenameTNumeric>
3768 template<
typenameTNumeric>
3772UInt8ToString(out_str,
value,
flags, base);
3774 template<
typenameTNumeric>
3780 template<
typenameTStrictId>
3784 returnx_NumericToString(out_str,
value.Get(),
flags, base);
3789 template<
typenameTIterator>
3792 template<
typenameTIterator>
3800 template<
typenameTIterator>
3805 returnxx_Join(from, to, delim);
3808 template<
typenameTValue>
3812 returnxx_Join(from, to, delim);
3815 template<
typenameTIterator>
3820 returnTransformJoin( from, to, delim, [](
const typename TIterator::value_type&
i){
returnNumericToString(
i);});
3823 template<
typenameTValue>
3827 returnTransformJoin( from, to, delim, [](
constTValue&
i){
returnNumericToString(
i);});
3850os.write((
const char*)
str.data(),
str.size() *
sizeof(
TCharUCS2));
3888 returnx_Append(u8,src,encoding,
validate);
3891 #if defined(HAVE_WSTRING) 3901 returnx_Append(u8,src,lcl);
3911 template<
typenameTChar>
3916 returnx_Append(u8, src.data(), src.size());
3926 template<
typenameTChar>
3931 returnx_Append(u8, src, tchar_count);
3942 template<
typenameTChar>
3946 returnx_Append(dest, src.data(), src.size());
3960 template<
typenameTChar>
3964 returnx_Append(dest, src, tchar_count);
3975 template<
typenameTChar>
3979 returnx_Append(dest, &ch, 1);
3999 returnx_Append(dest,src,encoding,
validate);
4002 #if defined(HAVE_WSTRING) 4017 returnx_Append(dest,src,lcl);
4041 #if defined(HAVE_WSTRING) 4076 static stringAsSingleByteString
4078 const char* substitute_on_error = 0, EValidate
validate= eNoValidate);
4080 #if defined(HAVE_WSTRING) 4081 static stringAsSingleByteString
4083 const char* substitute_on_error = 0, EValidate
validate= eNoValidate);
4100 template<
typenameTChar>
4104 returnx_AsBasicString(src,substitute_on_error,
validate);
4107 template<
typenameTChar>
4111 returnx_AsBasicString<TChar>(src,
nullptr,eNoValidate);
4155 returnx_EvalFirst(ch, more);
4165 returnx_EvalNext(ch);
4195 static stringEncodingToString(
EEncodingencoding);
4216 #if defined(HAVE_WSTRING) 4238 #if defined(HAVE_WSTRING) 4309 #ifndef NCBI_COMPILER_WORKSHOP 4349 #if defined(HAVE_WSTRING) 4352 template<
typenameTChar>
4354 template<
typenameTChar>
4357 template<
typenameTChar>
4358 staticbasic_string<TChar> x_AsBasicString
4362 template<
typenameTIterator>
4366 static boolx_EvalFirst(
charch,
SIZE_TYPE& more);
4367 static boolx_EvalNext(
charch);
4389 template<
classTBase>
4402 case eErr:
return "eErr";
4412 EErrCodeerr_code,
const string& message,
4414: TBase(
info, prev_exception, message, severity, 0),
m_Pos(pos)
4416this->x_Init(
info,
4438 out<<
"m_Pos = "<< (
unsignedlong)
m_Pos;
4444 virtual const char*
GetType(
void)
const override 4445{
return "CParseTemplException"; }
4452(
TErrCode) this->x_GetErrCode() :
4462 const string& message,
4464: TBase(
info, prev_exception, message, severity,
flags),
m_Pos(pos)
4466this->x_Init(
info,
4510 virtual const char* GetErrCodeString(
void)
const override;
4586 template<
classTContainer>
4727 ITERATE(list<string>, it, lst) {
4767 const string& arg_sep,
4768 const string& val_sep,
4775 if( !ret.empty() ) {
4784ret += it->first + val_sep + it->second;
4828 bool IsEncoded(
void)
const{
returnm_Encoded.get() != 0; }
4833{
returnIsEncoded() ? *m_Encoded : m_Original; }
4836 bool IsEmpty(
void)
const{
returnm_Original.empty(); }
4856 template<
typenameT>
4860 int Compare(
const T& s1,
const T& s2)
const;
4863 bool Less(
const T& s1,
const T& s2)
const;
4866 bool Equals(
const T& s1,
const T& s2)
const;
4886 template<
typenameT>
4893 bool Less(
const T& s1,
const T& s2)
const;
4916 template<
typenameT>
4930 int Compare(
const T& s1,
const T& s2)
const;
4933 bool Less(
const T& s1,
const T& s2)
const;
4936 bool Equals(
const T& s1,
const T& s2)
const;
4957 template<
typenameT>
4965 returnthis->
Equals(s1, s2);
4983 template<
typenameT>
4997 returnthis->
Equals(s1, s2);
5016 size_tlen1 = s1.
size(), len2 = s2.
size();
5017 returnlen1 < len2 ||
5018(len1 == len2 && ::memcmp(s1.
data(), s2.
data(), len1) < 0);
5029 template<
classArg1,
classArg2,
classPred>
5033 returnpr.Equals(x, y);
5051 #if !defined(NCBI_OS_MSWIN) && \ 5052 !(defined(NCBI_OS_LINUX) && \ 5053 (defined(NCBI_COMPILER_GCC) || defined(NCBI_COMPILER_ANY_CLANG))) 5057 const string*
str= m_Str;
5058 return str? *
str: FirstGet();
5061 # ifdef HAVE_WSTRING 5065 constwstring*
str= m_Str;
5066 return str? *
str: FirstGet();
5173 unsigned intmax_digits
)
5192 unsigned intrc = ch -
'0';
5196rc = (ch |
' ') -
'a';
5197 returnrc <= 5 ?
int(rc + 10) : -1;
5216 #if defined(HAVE_STRICMP) 5217 #if NCBI_COMPILER_MSVC && (_MSC_VER >= 1400) 5218return ::_stricmp(s1, s2);
5220return ::stricmp(s1, s2);
5223 #elif defined(HAVE_STRCASECMP_LC) 5228 for( ;; ++s1, ++s2) {
5231diff =
tolower((
unsigned char) c1) -
tolower((
unsigned char)(*s2));
5243 #if defined(HAVE_STRICMP) 5244 #if NCBI_COMPILER_MSVC && (_MSC_VER >= 1400) 5245return ::_strnicmp(s1, s2,
n);
5247return ::strnicmp(s1, s2,
n);
5250 #elif defined(HAVE_STRCASECMP_LC) 5255 for( ; ; ++s1, ++s2, --
n) {
5260diff =
tolower((
unsigned char) c1) -
tolower((
unsigned char)(*s2));
5271 const structtm* timeptr)
5275return ::strftime(s, maxsize, x_format.c_str(), timeptr);
5292 const char* s2,
ECaseuse_case)
5321 returns1.
substr(pos,
n) == s2;
5327 returns1.
substr(pos,
n) == s2;
5333 size_t n= strlen(s1);
5334 if(
n!= strlen(s2)) {
5361 size_t n= strlen(s1);
5362 if(
n!= strlen(s2)) {
5379 const char* s2,
ECaseuse_case)
5408 return str.size() >= start.
size() &&
5409 Equal(
str.substr(0, start.
size()), start, use_case);
5415 return!
str.empty() &&
5416(use_case ==
eCase? (
str[0] == start)
5417: (
str[0] == start ||
5418 toupper((
unsigned char)
str[0]) == start ||
5426 return str.size() >= end.
size() &&
5433 if(!
str.empty()) {
5435 returnuse_case ==
eCase? (
last== end)
5448 if(s1[
i] != s2[
i]) {
5462 if(s1[len1 -
i] != s2[len2 -
i]) {
5489 return(pos ==
NPOS|| (pos + pattern.
length()) > end) ?
NPOS: pos;
5492 return(pos ==
NPOS|| pos < start) ?
NPOS: pos;
5552 template<
typenameTIterator,
typenameFTransform>
5559 string result(fnTransform(*from++));
5560 for( ; from != to; ++from) {
5561 result.append(delim).append(fnTransform(*from));
5566 template<
typenameTIterator>
5574 size_tsz_all = 0, sz_delim = delim.
size();
5576sz_all +=
string(*f).size() + sz_delim;
5579 for( ; from != to; ++from) {
5580 result.append(delim).append(
string(*from));
5588 const string* prefix1)
5596 const string& prefix1)
5603 const string& delim, list<string>&
arr,
5605 const string* prefix1)
5612 const string& delim, list<string>&
arr,
5614 const string& prefix1)
5624 return Justify(
str, width, par, &pfx, pfx1);
5632 return Justify(
str, width, par, &pfx, &pfx1);
5654 return(err-src.
begin());
5659 #ifndef NCBI_COMPILER_WORKSHOP 5676 template<
typenameTChar> basic_string<TChar>
5684basic_string<TChar>
result;
5688 for(; src != to; ++src) {
5690 if(
sizeof(
TChar) > 2 && ch >= 0xD800 && ch <= 0xDBFF) {
5692ch = (ch - 0xD800) * 0x400 + (
ch2- 0xDC00) + 0x10000;
5694 if(ch > max_char) {
5695 if(
sizeof(
TChar) == 2) {
5703 if(substitute_on_error) {
5704 result.append(substitute_on_error);
5708 "Failed to convert symbol to wide character",
5709(src -
str.begin()));
5717 template<
typenameTChar>
bool 5720 if( *src >= 0xD800 && *src <= 0xDBFF &&
5721*(src+1) >= 0xDC00 && *(src+1) <= 0xDFFF &&
sizeof(
TChar) == 2) {
5722ch = (*(src) - 0xD800) * 0x400 + (*(src+1) - 0xDC00) + 0x10000;
5732 const TChar* srcBuf;
5736 for(pos=0, srcBuf=src;
5737(to ==
NPOS) ? (*srcBuf != 0) : (pos<to); ++pos, ++srcBuf) {
5748u8str.reserve(
max(u8str.capacity(),u8str.length()+needed+1));
5749 for(pos=0, srcBuf=src;
5750(to ==
NPOS) ? (*srcBuf != 0) : (pos<to); ++pos, ++srcBuf) {
5776 template<
typenameT>
5783 template<
typenameT>
5790 template<
typenameT>
5797 template<
typenameT>
5801 returnLess(s1, s2);
5811 template<
typenameT>
5818 template<
typenameT>
5825 template<
typenameT>
5832 template<
typenameT>
5836 returnLess(s1, s2);
5843 template<
typenameT>
5846: m_CaseSensitive(cs)
5849 template<
typenameT>
5856 template<
typenameT>
5863 template<
typenameT>
5870 template<
typenameT>
5874 returnLess(s1, s2);
void x_Assign(CObject_id &dst, const CObject_id &src)
ncbi::TMaskedQueryRegions mask
Incapsulate compile time information such as __FILE__, __LINE__, NCBI_MODULE, current function.
CParseTemplException â.
URL-decoder for string pairs parser.
URL-encoder for string pairs parser.
Template for parsing string into pairs of name and value or merging them back into a single string.
Helper class to allocate memory for CTempString[Ex] on demand in the functions which need to modify t...
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Encoder interface. Names and values can be encoded with different rules.
static enable_if< is_integral< TNumeric >::value &&is_unsigned< TNumeric >::value &&(sizeof(TNumeric)< sizeof(unsigned int)), TNumeric >::type x_StringToNumeric(const CTempString str, TStringToNumFlags flags, int base)
static enable_if< is_integral< TNumeric >::value &&is_unsigned< TNumeric >::value &&(sizeof(TNumeric)<=sizeof(unsigned int) &&!is_same< TNumeric, unsigned long >::value), void >::type x_NumericToString(string &out_str, TNumeric value, TNumToStringFlags flags, int base)
static enable_if< is_arithmetic< TValue >::value, string >::type x_Join(TValue *from, TValue *to, const CTempString &delim)
static enable_if< is_convertible< typename TIterator::iterator_category, forward_iterator_tag >::value &&is_convertible< typename TIterator::value_type, string >::value, string >::type x_Join(TIterator from, TIterator to, const CTempString &delim)
static enable_if< is_integral< TNumeric >::value &&is_unsigned< TNumeric >::value &&(sizeof(TNumeric)< sizeof(unsigned int)), bool >::type x_StringToNumeric(const CTempString str, TNumeric *value, TStringToNumFlags flags, int base)
Define Case-insensitive string equality (not less-than) comparison method Case sensitivity can be tur...
Define Case-insensitive string equality (not less-than) comparison method.
Define Case-insensitive string comparison methods.
static vector< string > arr
std::ofstream out("events_result.xml")
main entry point for tests
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
static const char * str(char *buf, int n)
static const char * validate(DSNINFO *di)
Go looking for trouble.
void reset(element_type *p=0, EOwnership ownership=eTakeOwnership)
Reset will delete the old pointer (if owned), set content to the new value, and assume the ownership ...
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
element_type * get(void) const
Get pointer.
@ eTakeOwnership
An object can take ownership of another.
@ eNoOwnership
No ownership is assumed.
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Error
Error message.
#define NCBI_THROW2(exception_class, err_code, message, extra)
Throw exception with extra parameter.
EErrCode
Error types that an application can generate.
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
#define EXCEPTION_VIRTUAL_BASE
Do not use virtual base classes in exception declaration at all, because in this case derived class s...
@ eInvalid
To be used ONLY as a return value; please, NEVER throw an exception with this code.
sequence::ECompare Compare(const CSeq_loc &loc1, const CSeq_loc &loc2, CScope *scope)
Returns the sequence::ECompare containment relationship between CSeq_locs.
int64_t Int8
8-byte (64-bit) signed integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
EStringToNumFlags EConvErrFlags
Formerly split out.
EJsonEncode
Json-encode flags.
CParseTemplException(const CDiagCompileInfo &info, const CException *prev_exception, const string &message, string::size_type pos, EDiagSev severity, CException::TFlags flags)
bool operator()(const CTempString s1, const CTempString s2) const
static void NumericToString(string &out_str, TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static bool x_StringToNumeric(const CTempString str, double *value, TStringToNumFlags flags, int)
static enable_if< is_integral< TNumeric >::value &&is_signed< TNumeric >::value &&(sizeof(TNumeric)< sizeof(int)), TNumeric >::type x_StringToNumeric(const CTempString str, TStringToNumFlags flags, int base)
static bool x_TCharToUnicodeSymbol(TUnicodeSymbol &u, const TChar *src)
static bool x_StringToNumeric(const CTempString str, unsigned long *value, TStringToNumFlags flags, int base)
static void x_Validate(const CTempString &str)
NCBI_NS_STD::string::size_type SIZE_TYPE
virtual void Append(const string &s)=0
static string SizetToString(size_t value, TNumToStringFlags flags=0, int base=10)
Convert size_t to string.
CParseTemplException(void)
Constructor.
PEqualNocase_Generic< const char * > PEqualNocase_CStr
vector< pair< string, string > > TStringPairsVector
static TUnicodeSymbol x_Decode(TIterator &src)
static enable_if< is_integral< TChar >::value &&(1< sizeof(TChar)), basic_string< TChar > >::type AsBasicString(const CTempString &src, const TChar *substitute_on_error, EValidate validate=eNoValidate)
Convert UTF8 string into Unicode.
static bool x_VerifyIntLimits(TSource v, const CTempString str, TStringToNumFlags flags)
static CStringUTF8 & AppendAsUTF8(CStringUTF8 &dest, const CTempString &src, EEncoding encoding, EValidate validate=eNoValidate)
Convert non-Unicode C++ string into UTF8 and append it to existing string.
EPrintableMode
How to display printable strings.
static void x_NumericToString(string &out_str, unsigned long value, TNumToStringFlags flags, int base)
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
EDedentFlags
Flags for Dedent() method.
int Compare(const T &s1, const T &s2) const
Return difference between "s1" and "s2".
PCase_Generic< string > PCase
PNocase_Generic< const char * > PNocase_CStr
ESS_Flags
Flags for Sanitize().
int TDedentFlags
Bitwise OR of EDedentFlags.
EStringToNumFlags
String to number conversion flags.
string::size_type m_Pos
Error position.
EErrCode
Error types that for exception class.
void Parse(const CTempString str, NStr::EMergeDelims merge_argsep=NStr::eMergeDelims)
Parse the string.
static CStringUTF8 & x_Append(CStringUTF8 &u8str, const CTempString &src, EEncoding encoding, EValidate validate)
CStringPairs(IStringDecoder *decoder=NULL, EOwnership own_decoder=eTakeOwnership, IStringEncoder *encoder=NULL, EOwnership own_encoder=eTakeOwnership)
Create parser with the specified decoder/encoder and default separators.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
string Merge(void) const
Merge name-value pairs into a single string using the currently set separators and the provided encod...
CParseTemplException(const CDiagCompileInfo &info, const CException *prev_exception, EErrCode err_code, const string &message, string::size_type pos, EDiagSev severity=eDiag_Error)
Constructor.
static bool StringToNumeric(const CTempString str, TNumeric *value, TStringToNumFlags flags=0, int base=10)
Convert string to a numeric value.
static enable_if< is_integral< typename TStrictId::TId >::value &&is_member_function_pointer< decltype(&TStrictId::Get)>::value, void >::type x_NumericToString(string &out_str, TStrictId value, TNumToStringFlags flags, int base)
char16_t TCharUCS2
Type for character in UCS-2 encoding.
ESqlEncode
SQL encode flags.
ESplitFlags
Flags for Split*() methods.
EWrapFlags
How to wrap the words in a string to a new line.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
CNcbiOstream & operator<<(CNcbiOstream &os, const TStringUCS2 &str)
Operator for writing TStringUCS2 to stream.
EUrlEncode
URL-encode flags.
EMergeDelims
Whether to merge adjacent delimiters.
AutoPtr< IStringDecoder > m_Decoder
CWrapDestStringList(list< string > &l)
EOccurrence
Whether it is the first or last occurrence.
static string Merge(const TStrPairs &pairs, const string &arg_sep, const string &val_sep, IStringEncoder *encoder=NULL, EOwnership own=eTakeOwnership)
Merge name-value pairs from the provided container, separators and encoder.
static void x_NumericToString(string &out_str, long value, TNumToStringFlags flags, int base)
static enable_if< is_integral< TChar >::value &&(1< sizeof(TChar)), CStringUTF8 >::type AsUTF8(const TChar *src, SIZE_TYPE tchar_count=NCBI_NS_STD::string::npos)
Convert into UTF8 from a Unicode character buffer.
const string & GetEncodedString(void) const
Get encoded string.
int TPrintableMode
Bitwise OR of EPrintableMode flags.
TStrPairs & GetPairs(void)
Get non-const data.
int TNumToStringFlags
Bitwise OR of "ENumToStringFlags".
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
virtual string Encode(const CTempString src, EStringType stype) const =0
Encode the string.
void SetDecoder(IStringDecoder *decoder, EOwnership own=eTakeOwnership)
Set string decoder.
CParseTemplException(const CParseTemplException< TBase > &other)
Constructor.
const char * impl_ToCString(const char *s)
CStringPairs(const CTempString arg_sep, const CTempString val_sep, IStringDecoder *decoder=NULL, EOwnership own_decoder=eTakeOwnership, IStringEncoder *encoder=NULL, EOwnership own_encoder=eTakeOwnership)
Create parser with the specified parameters.
EUrlDecode
URL decode flags.
static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
bool Less(const T &s1, const T &s2) const
Return TRUE if s1 < s2.
static CTempString TruncateSpaces_Unsafe(const CTempString &str, NStr::ETrunc side=NStr::eTrunc_Both)
Truncate whitespace in the string.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static SIZE_TYPE x_BytesNeeded(TUnicodeSymbol ch)
static string LongToString(long value, TNumToStringFlags flags=0, int base=10)
Convert Int to string.
unique_ptr< string > m_Encoded
static int strcmp(const char *s1, const char *s2)
String compare.
EDirection
Search direction for Find() methods.
EXmlEncode
XML-encode flags.
NStr::ECase m_CaseSensitive
case sensitive when TRUE
static bool EvaluateNext(char ch)
Check that the character is valid continuation byte of an UTF8 byte sequence.
PEqualNocase_Conditional_Generic< string > PEqualNocase_Conditional
bool IsEmpty(void) const
Check if the string is empty.
virtual void Append(const CTempString &s)
static string TransformJoin(TIterator from, TIterator to, const CTempString &delim, FTransform fnTransform)
static SIZE_TYPE GetSymbolCount(const CTempString &src)
Get the number of symbols (code points) in UTF8 string.
static int strncasecmp(const char *s1, const char *s2, size_t n)
Case-insensitive comparison of two zero-terminated strings, narrowed to the specified number of chara...
static CTempString TruncateSpaces(const CTempString str, ETrunc where=eTrunc_Both)
IStringEncoder * GetEncoder(void)
Get encoder or NULL. Does not affect encoder ownership.
static string Join(const initializer_list< TValue > &arr, const CTempString &delim)
PEqualNocase_Generic< string > PEqualNocase
static TNumeric StringToNumeric(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to a numeric value.
static string Join(TInputIterator from, TInputIterator to, const CTempString &delim)
static string JoinNumeric(TInputIterator from, TInputIterator to, const CTempString &delim)
ENumToStringFlags
Number to string conversion flags.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static CStringUTF8 TruncateSpaces(const CTempString &str, NStr::ETrunc side=NStr::eTrunc_Both)
Truncate whitespace in the string.
static SIZE_TYPE CommonSuffixSize(const CTempString s1, const CTempString s2)
Determine the common suffix of two strings.
virtual const char * GetType(void) const override
Get exception class type.
string::size_type GetPos(void) const noexcept
Get error position.
int Compare(const T &s1, const T &s2) const
Return difference between "s1" and "s2".
virtual void ReportExtra(ostream &out) const override
Report error position.
void SetEncoder(IStringEncoder *encoder, EOwnership own=eTakeOwnership)
Set string encoder.
static string DedentR(const CTempString str)
const string & GetOriginalString(void) const
Get the original unencoded string.
NCBI_EXCEPTION_DEFAULT2(CStringException, CParseTemplException< CCoreException >, std::string::size_type)
CStringPairs(NStr::EUrlDecode decode_flag, NStr::EUrlEncode encode_flag)
Create parser with the selected URL-encoding/decoding options and default separators.
static string Dedent(const CTempString str, TDedentFlags flags=0)
Dedent multi-line string, removing common whitespace prefix for each line.
EErrCode
Error types that string classes can generate.
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
static CStringUTF8 AsUTF8(const CTempString &src, const locale &lcl)
Convert into UTF8 from a C/C++ string.
PNocase_Generic< string > PNocase
const char * const_iterator
static SIZE_TYPE GetValidSymbolCount(const CTempString &src)
Get the number of valid UTF-8 symbols (code points) in buffer.
static int HexChar(char ch)
Convert character to integer.
static void ToUpper(const char *)
Privatized ToUpper() with const char* parameter to prevent passing of constant strings.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static void Parse(TStrPairs &pairs, const CTempString str, const CTempString arg_sep, const CTempString val_sep, IStringDecoder *decoder=NULL, EOwnership own=eTakeOwnership, NStr::EMergeDelims merge_argsep=NStr::eMergeDelims)
Parse the string using the provided decoder, put data into the container.
virtual ~IStringEncoder(void)
virtual ~IStringDecoder(void)
int TSplitFlags
Bitwise OR of ESplitFlags.
static enable_if< is_integral< typename TStrictId::TId >::value &&is_member_function_pointer< decltype(&TStrictId::Get)>::value, string >::type NumericToString(TStrictId value, TNumToStringFlags flags=0, int base=10)
ETrunc
Which end to truncate a string.
static bool EqualCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive equality of a substring with another string.
static basic_string< TChar > x_AsBasicString(const CTempString &src, const TChar *substitute_on_error, EValidate validate)
const char * data(void) const
Return a pointer to the array represented.
static string UInt8ToString_DataSize(Uint8 value, TNumToStringFlags flags=0, unsigned int max_digits=3)
Convert UInt8 to string using "software" qualifiers.
virtual ~CParseTemplException(void) noexcept
Destructor.
AutoPtr< IStringEncoder > m_Encoder
basic_string< TUnicodeSymbol > TStringUnicode
Unicode string.
const wchar_t *const kEmptyWCStr
char32_t TUnicodeSymbol
Unicode character.
bool operator()(const T &s1, const T &s2) const
Return TRUE if s1 < s2 ignoring case.
static TUnicodeSymbol DecodeFirst(char ch, SIZE_TYPE &more)
Begin converting first character of UTF8 sequence into Unicode.
static int strcasecmp(const char *s1, const char *s2)
Case-insensitive comparison of two zero-terminated strings.
EStringType
Type of string to be decoded.
TStringUnicode TStringUCS4
static enable_if< is_integral< TNumeric >::value &&is_signed< TNumeric >::value &&(sizeof(TNumeric)<=sizeof(int) &&!is_same< TNumeric, long >::value), void >::type x_NumericToString(string &out_str, TNumeric value, TNumToStringFlags flags, int base)
static bool x_VerifyFloatLimits(TSource v, const CTempString str, TStringToNumFlags flags)
bool AStrEquiv(const Arg1 &x, const Arg2 &y, Pred pr)
Check equivalence of arguments using predicate.
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
virtual ~CStringPairs(void)
static SIZE_TYPE FindCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case sensitive search.
CStringPairs< TStringPairsVector > CStringPairsParser
static int Compare(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Compare of a substring with another string.
static size_t strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)
Wrapper for the function strftime() that corrects handling D and T time formats on MS Windows.
static CStringUTF8 SQLEncode(const CStringUTF8 &str)
virtual const CException * x_Clone(void) const override
Helper clone method.
static CStringUTF8 & x_AppendChar(CStringUTF8 &u8str, TUnicodeSymbol ch)
virtual void Append(const string &s)
static enable_if< is_integral< TChar >::value &&(1< sizeof(TChar)), CStringUTF8 & >::type AppendAsUTF8(CStringUTF8 &dest, TChar ch)
Convert Unicode symbol into UTF8 and append it to existing string.
static CStringUTF8 AsUTF8(const CTempString &src, EEncoding encoding, EValidate validate=eNoValidate)
Convert into UTF8 from a C/C++ string.
bool Equals(const T &s1, const T &s2) const
Return TRUE if s1 == s2.
basic_string< TCharUCS2 > TStringUCS2
Type for string in UCS-2 encoding.
EQuoted
Define that string is quoted or not.
IStringDecoder * GetDecoder(void)
Get decoder or NULL. Does not affect decoder ownership.
static list< string > & WrapList(const list< string > &l, SIZE_TYPE width, const string &delim, list< string > &arr, TWrapFlags flags=0, const string *prefix=0, const string *prefix1=0)
Wrap the list using the specified criteria.
static enable_if< is_integral< TChar >::value &&(1< sizeof(TChar)), CStringUTF8 & >::type AppendAsUTF8(CStringUTF8 &dest, const TChar *src, SIZE_TYPE tchar_count=NCBI_NS_STD::string::npos)
Convert Unicode character buffer into UTF8 and append it to existing string.
static string xx_Join(TIterator from, TIterator to, const CTempString &delim)
virtual void Append(const CTempString &s)=0
EStringType
Type of string to be decoded.
virtual string Decode(const CTempString src, EStringType stype) const =0
Decode the string.
static SIZE_TYPE x_GetValidSymbolCount(const CTempString &src, CTempString::const_iterator &err)
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
PNocase_Conditional_Generic(NStr::ECase case_sens=NStr::eCase)
Construction.
const TStrPairs & GetPairs(void) const
Read data.
static enable_if< is_integral< TChar >::value &&(1< sizeof(TChar)), basic_string< TChar > >::type AsBasicString(const CTempString &src)
bool IsEncoded(void) const
Check if the original string was encoded.
static enable_if< is_integral< typename TStrictId::TId >::value &&is_member_function_pointer< decltype(&TStrictId::Get)>::value, bool >::type x_StringToNumeric(const CTempString str, TStrictId *value, TStringToNumFlags flags, int base)
EHtmlEncode
HTML-decode flags.
bool Equals(const T &s1, const T &s2) const
Return TRUE if s1 == s2.
static enable_if< is_integral< TChar >::value &&(1< sizeof(TChar)), CStringUTF8 >::type AsUTF8(const basic_string< TChar > &src)
Convert into UTF8 from a Unicode C++ string.
bool operator()(const T &s1, const T &s2) const
Return TRUE if s1 < s2.
static TUnicodeSymbol DecodeNext(TUnicodeSymbol chU, char ch)
Convert next character of UTF8 sequence into Unicode.
static SIZE_TYPE FindWord(const CTempString str, const CTempString word, EOccurrence which, ECase use_case=eCase)
Find given word in the string.
static enable_if< is_convertible< TValue, string >::value, string >::type x_Join(TValue *from, TValue *to, const CTempString &delim)
static CStringUTF8 & AppendAsUTF8(CStringUTF8 &dest, char ch, const locale &lcl)
Convert non-Unicode character into UTF8 and append it to existing string.
static bool x_StringToNumeric(const CTempString str, float *value, TStringToNumFlags flags, int)
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
bool Less(const T &s1, const T &s2) const
Return TRUE if s1 < s2.
size_type length(void) const
Return the length of the represented array.
bool Equals(const T &s1, const T &s2) const
Return TRUE if s1 == s2.
static string ULongToString(unsigned long value, TNumToStringFlags flags=0, int base=10)
Convert unsigned long to string.
static bool x_StringToNumeric(const CTempString str, long *value, TStringToNumFlags flags, int base)
TContainer::value_type TStrPair
The container's value type must be pair<string, string> or a compatible type.
int TSS_Flags
Bitwise OR of ESS_Flags.
static list< string > & Justify(const CTempString str, SIZE_TYPE width, list< string > &par, const CTempString *pfx=0, const CTempString *pfx1=0)
Justify the specified string into a series of lines of the same width.
static const wstring & Get(void)
Get string.
static string Sanitize(CTempString str, TSS_Flags flags=fSS_print)
Sanitize a string, allowing only specified classes of characters.
PNocase_Conditional_Generic< string > PNocase_Conditional
CTempString substr(size_type pos) const
Obtain a substring from this string, beginning at a given offset.
static CStringUTF8 & AppendAsUTF8(CStringUTF8 &dest, char ch, EEncoding encoding, EValidate validate=eNoValidate)
Convert non-Unicode character into UTF8 and append it to existing string.
bool operator()(const T &s1, const T &s2) const
Return TRUE if s1 < s2 ignoring case.
static CTempString TruncateSpaces(const char *str, ETrunc where=eTrunc_Both)
static void ToLower(const char *)
Privatized ToLower() with const char* parameter to prevent passing of constant strings.
static TUnicodeSymbol Decode(const char *&src)
Convert sequence of UTF8 code units into Unicode code point.
static CStringUTF8 & AppendAsUTF8(CStringUTF8 &dest, const CTempString &src, const locale &lcl)
Convert non-Unicode C++ string into UTF8 and append it to existing string.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
EHtmlDecode
HTML-decode flags.
void SetCase(NStr::ECase case_sens)
Set comparison type.
ECase
Which type of string comparison.
static int strncmp(const char *s1, const char *s2, size_t n)
String compare up to specified number of characters.
TErrCode GetErrCode(void) const
Get error code.
static enable_if< is_same< typename TIterator::iterator_category, input_iterator_tag >::value &&is_convertible< typename TIterator::value_type, string >::value, string >::type x_Join(TIterator from, TIterator to, const CTempString &delim)
int TWrapFlags
Bitwise OR of "EWrapFlags".
int TStringToNumFlags
Bitwise OR of "EStringToNumFlags".
bool Less(const T &s1, const T &s2) const
Return TRUE if s1 < s2.
NStr::ECase GetCase() const
Get comparison type.
static SIZE_TYPE GetValidBytesCount(const CTempString &src)
Get the number of valid UTF-8 bytes (code units) in buffer.
static void Wrap(const string &str, SIZE_TYPE width, IWrapDest &dest, TWrapFlags flags, const string *prefix, const string *prefix1)
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
int Compare(const T &s1, const T &s2) const
Return difference between "s1" and "s2".
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
EValidate
How to verify character encoding of the source data.
static const string & Get(void)
Get string.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
bool operator()(const T &s1, const T &s2) const
Return TRUE if s1 < s2 ignoring case.
static enable_if< is_integral< TChar >::value &&(1< sizeof(TChar)), CStringUTF8 & >::type AppendAsUTF8(CStringUTF8 &dest, const basic_string< TChar > &src)
Convert Unicode C++ string into UTF8 and append it to existing string.
const char *const kEmptyCStr
Empty "C" string (points to a '\0').
PNocase_Conditional_Generic< const char * > PNocase_Conditional_CStr
bool operator()(const T &s1, const T &s2) const
Return TRUE if s1 < s2 ignoring case.
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, SIZE_TYPE start)
Wrapper for backward-compatibility.
size_type size(void) const
Return the length of the represented array.
static enable_if< is_integral< TNumeric >::value &&is_signed< TNumeric >::value &&(sizeof(TNumeric)< sizeof(int)), bool >::type x_StringToNumeric(const CTempString str, TNumeric *value, TStringToNumFlags flags, int base)
PCase_Generic< const char * > PCase_CStr
static int CompareCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive compare of a substring with another string.
static string UInt8ToString(Uint8 value, TNumToStringFlags flags=0, int base=10)
Convert UInt8 to string.
TStringToNumFlags TConvErrFlags
Formerly split out.
PEqualNocase_Conditional_Generic< const char * > PEqualNocase_Conditional_CStr
PEqualNocase_Conditional_Generic(NStr::ECase case_sens=NStr::eCase)
Construction.
EEscSeqRange
C-style escape sequences parsing mode.
static bool EvaluateFirst(char ch, SIZE_TYPE &more)
Check that the character is valid first byte of an UTF8 byte sequence.
static SIZE_TYPE CommonPrefixSize(const CTempString s1, const CTempString s2)
Determine the common prefix of two strings.
const_iterator begin() const
Return an iterator to the string's starting position.
virtual const char * GetErrCodeString(void) const override
Translate from the error code value to its string representation.
static int StringToNumeric(const string &str)
@ eEncoding_ISO8859_1
Note: From the point of view of the C++.
@ fDedent_SkipEmptyFirstLine
Ignore first line and skip it from the result, if it is empty only.
@ eSqlEnc_Plain
Always produce '...', with no tag.
@ eUrlEnc_ProcessMarkChars
Convert all non-alphanumeric chars, spaces are converted to '+'.
@ eUrlEnc_URIQueryValue
Encode query part of an URI, arg value.
@ eUrlEnc_PercentOnly
Convert all non-alphanumeric chars including space and '' to %## format.
@ eUrlEnc_URIHost
Encode host part of an URI.
@ eUrlEnc_URIQueryName
Encode query part of an URI, arg name.
@ eUrlEnc_URIPath
Encode path part of an URI.
@ eUrlEnc_Path
Same as ProcessMarkChars but preserves valid path characters ('/', '.')
@ eUrlEnc_URIScheme
Encode scheme part of an URI.
@ eUrlEnc_URIUserinfo
Encode userinfo part of an URI.
@ eUrlEnc_SkipMarkChars
Do not convert chars like '!', '(' etc.
@ eUrlEnc_Cookie
Same as SkipMarkChars with encoded ','.
@ eUrlEnc_URIFragment
Encode fragment part of an URI.
@ eFirst
First occurrence.
@ eUrlDec_All
Decode '+' to space.
@ eReverseSearch
Search in a backward direction.
@ eForwardSearch
Search in a forward direction.
@ eConvert
Failure to convert string.
@ eBadArgs
Bad arguments to string methods.
@ eTrunc_Both
Truncate whitespace at both begin and end of string.
@ eTrunc_End
Truncate trailing whitespace only.
@ eTrunc_Begin
Truncate leading whitespace only.
@ eQuoted
String is quoted.
@ eNocase
Case insensitive compare.
@ eCase
Case sensitive compare.
@ eEscSeqRange_Throw
Throw an exception.
@ eEscSeqRange_Errno
Set errno to ERANGE, return empty string.
enum ENcbiOwnership EOwnership
Ownership relations between objects.
#define NCBI_XNCBI_EXPORT
unsigned int
A callback function used to compare two keys in a database.
The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format
vector< CSeq_align const * >::const_iterator TIterator
const TYPE & Get(const CNamedParameterList *param)
constexpr int CompareNocase(const std::string_view &l, const std::string_view &r)
double value_type
The numeric datatype used by the parser.
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
int strncmp(const char *str1, const char *str2, size_t count)
int strcmp(const char *str1, const char *str2)
static const BitmapCharRec ch2
Defines NCBI C++ Toolkit portable error codes.
static bool IsWhiteSpace(char c)
static const char * locale
static const char delimiter[]
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
Define Case-sensitive string comparison methods.
Define Case-insensitive string comparison methods.
PQuickStringLess implements an ordering of strings, that is more efficient than usual lexicographical...
void Encode(const CRawScoreVector< Key, Score > &, vector< char > &)
void Decode(const vector< char > &, CRawScoreVector< Key, Score > &)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4