MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / str2Array

Method str2Array

src/utilities/ntrace/TracePluginImpl.cpp:769–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

767
768
769void TracePluginImpl::str2Array(const Firebird::string& str, GdsCodesArray& arr)
770{
771 // input: string with comma-delimited list of gds codes values and\or gds codes names
772 // output: sorted array of gds codes values
773
774 const char *sep = " ,";
775
776 FB_SIZE_T p1 = 0, p2 = 0;
777 while (p2 < str.length())
778 {
779 p2 = str.find_first_of(sep, p1);
780 if (p2 == string::npos)
781 p2 = str.length();
782
783 string s = str.substr(p1, p2 - p1);
784
785 ISC_STATUS code = atol(s.c_str());
786
787 if (!code && !(code = MsgUtil::getCodeByName(s.c_str())))
788 {
789 fatal_exception::raiseFmt(
790 "Error parsing error codes filter: \n"
791 "\t%s\n"
792 "\tbad item is: %s, at position: %d",
793 str.c_str(), s.c_str(), p1 + 1);
794 }
795
796 // avoid duplicates
797
798 FB_SIZE_T ins_pos;
799 if (!arr.find(code, ins_pos))
800 arr.insert(ins_pos, code);
801
802 p1 = str.find_first_not_of(sep, p2);
803 }
804}
805
806
807void TracePluginImpl::appendParams(ITraceParams* params)

Callers

nothing calls this directly

Calls 7

lengthMethod · 0.45
find_first_ofMethod · 0.45
substrMethod · 0.45
c_strMethod · 0.45
findMethod · 0.45
insertMethod · 0.45
find_first_not_ofMethod · 0.45

Tested by

no test coverage detected