41 #include <misc/error_codes.hpp>
47 #include <type_traits>
49 #define NCBI_USE_ERRCODE_X Misc_EutilsClient
64 const vector<string>& args,
69 static const STimeout five_seconds = { 5, 0 };
72 if ( ! data.empty() ) {
95 return "Phrase not found";
97 return "Field not found";
99 return "Phrase ignored";
101 return "Quoted phrase not found";
103 return "Output message";
105 return "Unknown error";
109 template<
class T>
static void s_FormatIds(ostream& osm,
const vector<T>& uids) {
113 for (
auto it = uids.begin()+1; it != uids.end(); ++it) {
122 for (
auto it = uids.begin(); it != uids.end(); ++it) {
123 if (it != uids.begin()) {
130 "Argument list contains seq-ids of mixed types");
137 "Argument list contains seq-ids of mixed types");
140 osm << seh.GetSeqId()->GetSeqIdString(
true);
151 for (
auto it = uids.begin()+1; it != uids.end(); ++it) {
155 osm <<
"&idtype=acc";
160 return NStr::StringToNumeric<T>(
str);
185 const string & message)
const
199 const string& message)
const
215 const string& message)
const
222 !IsTaxidQuery(message))
275 void GetErrors(list<string>& errors) { errors = m_Errors; }
287 m_Text_chunks.clear();
289 if ( !m_Path.empty() ) {
298 bool result = OnEndElement();
300 string::size_type pos = m_Path.find_last_of(
"/");
301 if (pos != string::npos) {
307 bool text(
const string& contents)
309 m_Text_chunks.push_back(contents);
337 : m_MessageHandler(message_handler)
360 ITERATE(list<TMessage>,
i, m_ResultWarnings) {
362 i->first,
i->second);
364 m_ResultWarnings.clear();
365 ITERATE(list<TMessage>,
i, m_ResultErrors) {
367 i->first,
i->second);
369 m_ResultErrors.clear();
373 typedef pair<CEUtilsException::EErrCode, string>
TMessage;
378 string::size_type pos = s.rfind(
suffix);
379 return (pos != string::npos && pos == s.size() - strlen(
suffix));
385 string contents = GetText();
387 if (m_Path ==
"eSearchResult/Count") {
390 else if (x_IsSuffix(m_Path,
"/IdList/Id")) {
391 m_Uids.push_back(s_ParseId<T>(contents));
393 else if (x_IsSuffix(m_Path,
"/ErrorList/PhraseNotFound")) {
395 m_ResultErrors.push_back(message);
397 else if (x_IsSuffix(m_Path,
"/ErrorList/FieldNotFound")) {
399 m_ResultErrors.push_back(message);
401 else if (x_IsSuffix(m_Path,
"/WarningList/PhraseIgnored")) {
403 m_ResultWarnings.push_back(message);
405 else if (x_IsSuffix(m_Path,
"/WarningList/QuotedPhraseNotFound")) {
407 m_ResultWarnings.push_back(message);
409 else if (x_IsSuffix(m_Path,
"/WarningList/OutputMessage")) {
411 m_ResultWarnings.push_back(message);
413 else if (m_Path ==
"ERROR" || m_Path ==
"eSearchResult/ERROR") {
415 m_Errors.push_back(contents);
444 : m_LinkName(dbfrom +
"_" + dbto)
453 m_LinkName = link_name;
462 if (name ==
"LinkSetDb") {
471 if ( GetText() == m_LinkName) {
476 m_Uids.push_back(s_ParseId<T>( GetText() ));
493 : m_CachedHostNameCount(0), m_RetMax(
kMax_Int)
502 : m_CachedHostNameCount(0),
567 params +=
"&retmode=xml&retmax=1";
574 LOG_POST(
Trace <<
"Executing: db=" << db <<
" query=" << term);
575 bool success =
false;
578 for (
int retries = 0; retries < 10; ++retries) {
580 string path =
"/entrez/eutils/esearch.fcgi";
594 "error parsing xml: " + msgs.
print());
608 int sleep_secs = ::sqrt(retries);
616 "failed to execute query: " + term);
631 vector<CSeq_id_Handle>& uids)
637 vector<string>& uids)
643 vector<TEntrezId>& uids)
658 "error parsing xml: " + msgs.
print());
667 "error returned from query: " + msg);
683 vector<CSeq_id_Handle>& uids)
689 vector<string>& uids)
695 vector<TEntrezId>& uids)
707 "failed to open file: " + xml_file);
716 const string& xml_path)
718 return x_Search(db, term, uids, xml_path);
724 vector<CSeq_id_Handle>& uids,
725 const string& xml_path)
727 return x_Search(db, term, uids, xml_path);
732 vector<string>& uids,
733 const string& xml_path)
735 return x_Search(db, term, uids, xml_path);
741 vector<TEntrezId>& uids,
742 const string& xml_path)
744 return x_Search(db, term, uids, xml_path);
751 const string& xml_path)
756 params +=
"&retmode=xml";
764 params +=
"&idtype=gi";
766 params +=
"&idtype=acc";
772 LOG_POST(
Trace <<
"Executing: db=" << db <<
" query=" << term);
773 bool success =
false;
776 for (
int retries = 0; retries < 10; ++retries) {
778 string path =
"/entrez/eutils/esearch.fcgi";
785 if(!xml_path.empty()) {
795 "Failure while writing entrez xml response"
796 " to file: " + xml_file);
819 int sleep_secs = ::sqrt(retries);
827 "failed to execute query: " + term);
847 oss <<
"&usehistory=y";
850 x_Get(
"/entrez/eutils/esearch.fcgi", oss.str(), ostr);
856 const string& web_env,
872 oss <<
"&usehistory=y"
879 const string& web_env,
886 if ( query_key > 0 ) {
891 x_Get(
"/entrez/eutils/esearch.fcgi", oss.str(), ostr);
896 const string& web_env,
903 oss <<
"&query_key=" << query_key <<
"&idtype=acc";
905 x_Get(
"/entrez/eutils/esearch.fcgi", oss.str(), ostr);
910 const string& web_env,
911 const string& query_key,
917 oss <<
"&query_key=" << query_key <<
"&idtype=acc";
919 x_Get(
"/entrez/eutils/esearch.fcgi", oss.str(), ostr);
923 #define HOST_NAME_REFRESH_FREQ 100
941 static const char kEutils[] =
"eutils.ncbi.nlm.nih.gov";
942 static const char kEutilsLB[] =
"eutils_lb";
956 string scheme(
"http");
960 buf,
sizeof(
buf), kEutils);
961 host =
string(web && *web ? web : kEutils);
971 string const& params,
974 bool success =
false;
977 string extra_params{ params };
979 for (
int retries = 0; retries < 10; ++retries) {
984 istr << extra_params;
988 string reply_str = reply.str();
989 istringstream reply_istr(reply.str());
990 vector<TEntrezId> uids;
1006 int sleep_secs = ::sqrt(retries);
1014 msg <<
"Failed to execute request: "
1027 const string& db_to,
1028 const vector<int>& uids_from,
1029 vector<int>& uids_to,
1030 const string& xml_path,
1034 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1039 const string& db_to,
1040 const vector<CSeq_id_Handle>& uids_from,
1041 vector<CSeq_id_Handle>& uids_to,
1042 const string& xml_path,
1045 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1049 const string& db_to,
1050 const vector<string>& uids_from,
1051 vector<string>& uids_to,
1052 const string& xml_path,
1055 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1059 const string& db_to,
1060 const vector<TEntrezId>& uids_from,
1061 vector<TEntrezId>& uids_to,
1062 const string& xml_path,
1065 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1070 const string& db_to,
1071 const vector<int>& uids_from,
1072 vector<TEntrezId>& uids_to,
1073 const string& xml_path,
1076 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1080 const string& db_to,
1081 const vector<TEntrezId>& uids_from,
1082 vector<int>& uids_to,
1083 const string& xml_path,
1086 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1091 const string& db_to,
1092 const vector<TEntrezId>& uids_from,
1093 vector<CSeq_id_Handle>& uids_to,
1094 const string& xml_path,
1097 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1101 const string& db_to,
1102 const vector<CSeq_id_Handle>& uids_from,
1103 vector<TEntrezId>& uids_to,
1104 const string& xml_path,
1107 x_Link(db_from, db_to, uids_from, uids_to, xml_path,
command);
1110 template<
class T1,
class T2>
1112 const string& db_to,
1113 const vector<T1>& uids_from,
1114 vector<T2>& uids_to,
1115 const string& xml_path,
1118 std::ostringstream oss;
1125 string params = oss.str();
1128 bool success =
false;
1131 for (
int retries = 0; retries < 10; ++retries) {
1133 string path =
"/entrez/eutils/elink.fcgi";
1144 if(!xml_path.empty()) {
1155 "Failure while writing entrez xml response"
1156 " to file: " + xml_file);
1171 "error parsing xml: " + msgs.
print());
1181 int sleep_secs = ::sqrt(retries);
1189 "failed to execute elink request: " + params);
1195 const string& db_to,
1196 const vector<int>& uids_from,
1205 const string& db_to,
1206 const vector<CSeq_id_Handle>& uids_from,
1214 const string& db_to,
1215 const vector<string>& uids_from,
1223 const string& db_to,
1224 const vector<TEntrezId>& uids_from,
1233 const string& db_to,
1234 const vector<T>& uids_from,
1238 std::ostringstream oss;
1245 string params = oss.str();
1248 bool success =
false;
1251 for (
int retries = 0; retries < 10; ++retries) {
1253 string path =
"/entrez/eutils/elink.fcgi";
1269 int sleep_secs = ::sqrt(retries);
1277 "failed to execute elink request: " + params);
1282 const string& db_to,
1283 const string& web_env,
1287 std::ostringstream oss;
1292 <<
"&WebEnv=" << web_env
1293 <<
"&query_key=" << query_key;
1295 x_Get(
"/entrez/eutils/elink.fcgi", oss.str(), ostr);
1299 const string& db_to,
1300 const string& web_env,
1304 std::ostringstream oss;
1309 <<
"&WebEnv=" << web_env
1310 <<
"&query_key=" << query_key
1313 x_Get(
"/entrez/eutils/elink.fcgi", oss.str(), ostr);
1317 const string& db_to,
1318 const string& web_env,
1319 const string& query_key,
1322 std::ostringstream oss;
1327 <<
"&WebEnv=" << web_env
1328 <<
"&query_key=" << query_key
1331 x_Get(
"/entrez/eutils/elink.fcgi", oss.str(), ostr);
1336 const vector<int>& uids,
1346 const vector<objects::CSeq_id_Handle>& uids,
1354 const vector<string>& uids,
1362 const vector<TEntrezId>& uids,
1370 const vector<T>& uids,
1379 string params = oss.str();
1382 bool success =
false;
1385 for (
int retries = 0; retries < 10; ++retries) {
1387 string path =
"/entrez/eutils/elink.fcgi?";
1389 string url =
x_BuildUrl(hostname, path, params);
1392 m_Url.push_back(url);
1399 string docstr(sb.str());
1414 <<
": error parsing xml: " << e.
what());
1421 int sleep_secs = ::sqrt(retries);
1429 "failed to execute esummary request: " + params);
1436 const vector<int>& uids,
1445 const vector<CSeq_id_Handle>& uids,
1453 const vector<string>& uids,
1461 const vector<TEntrezId>& uids,
1470 const vector<T>& uids,
1482 string params = oss.str();
1485 bool success =
false;
1488 for (
int retries = 0; retries < 10; ++retries) {
1490 string path =
"/entrez/eutils/esummary.fcgi?";
1492 string url =
x_BuildUrl(hostname, path, params);
1495 m_Url.push_back(url);
1502 string docstr(sb.str());
1510 docsums.
swap(xmldoc);
1517 <<
": error parsing xml: " << e.
what());
1524 int sleep_secs = ::sqrt(retries);
1532 "failed to execute esummary request: " + params);
1538 const string& web_env,
1545 <<
"&WebEnv=" << web_env;
1547 if ( retstart > 0 ) {
1548 oss <<
"&retstart=" << retstart;
1552 oss <<
"&retmax=" << retmax;
1562 const string& web_env,
1570 oss <<
"&query_key=" << query_key;
1571 x_Get(
"/entrez/eutils/esummary.fcgi?", oss.str(), ostr);
1575 const string& web_env,
1583 oss <<
"&query_key=" << query_key
1585 x_Get(
"/entrez/eutils/esummary.fcgi?", oss.str(), ostr);
1589 const string& web_env,
1590 const string& query_key,
1597 oss <<
"&query_key=" << query_key
1599 x_Get(
"/entrez/eutils/esummary.fcgi?", oss.str(), ostr);
1604 const vector<int>& uids,
1606 const string& retmode)
1608 x_Fetch(db, uids, ostr, retmode);
1613 const vector<CSeq_id_Handle>& uids,
1615 const string& retmode)
1617 x_Fetch(db, uids, ostr, retmode);
1621 const vector<string>& uids,
1623 const string& retmode)
1625 x_Fetch(db, uids, ostr, retmode);
1629 const vector<TEntrezId>& uids,
1631 const string& retmode)
1633 x_Fetch(db, uids, ostr, retmode);
1638 const vector<T>& uids,
1640 const string& retmode)
1647 string params = oss.str();
1650 bool success =
false;
1653 for (
int retries = 0; retries < 10; ++retries) {
1655 string path =
"/entrez/eutils/efetch.fcgi";
1671 int sleep_secs = ::sqrt(retries);
1679 "failed to execute efetch request: " + params);
1685 switch (content_type) {
1703 const string& web_env,
1710 <<
"&WebEnv=" << web_env;
1711 if ( retstart > 0 ) {
1712 oss <<
"&retstart=" << retstart;
1716 oss <<
"&retmax=" << retmax;
1721 const string& web_env,
1729 oss <<
"&query_key=" << query_key;
1731 x_Get(
"/entrez/eutils/efetch.fcgi", oss.str(), ostr);
1735 const string& web_env,
1738 EContentType content_type,
1743 oss <<
"&query_key=" << query_key
1746 x_Get(
"/entrez/eutils/efetch.fcgi", oss.str(), ostr);
1750 const string& web_env,
1751 const string& query_key,
1758 oss <<
"&query_key=" << query_key
1761 x_Get(
"/entrez/eutils/efetch.fcgi", oss.str(), ostr);
1775 const string ¶ms)
1777 string url = host + path;
1778 if(!params.empty()) {
1779 url +=
'?' + params;
1790 oss <<
'&' << param.first <<
'=' << param.second;
1792 params += oss.str();
Helper hook-up class that installs default logging/registry/locking (but only if they have not yet be...
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
CConn_PipeStream for command piping.
void SetLinkName(const string &link_name)
bool end_element(const string &name)
CELinkParser(const string &dbfrom, const string &dbto, vector< T > &uids)
pair< CEUtilsException::EErrCode, string > TMessage
CEutilsClient::CMessageHandler & m_MessageHandler
list< TMessage > m_ResultErrors
List of error messages from the E-Utils request.
Uint8 GetCount(void) const
bool x_IsSuffix(const string &s, const char *suffix)
CESearchParser(vector< T > &uids, CEutilsClient::CMessageHandler &message_handler)
void ProcessMessages(void)
Processes the warning and error messages from E-Utils, delivering them to the message handler and cle...
list< TMessage > m_ResultWarnings
List of warning messages from the E-Utils request.
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
bool end_element(const string &name)
void GetErrors(list< string > &errors)
virtual bool OnEndElement(void)
bool text(const string &contents)
string GetText(void) const
bool start_element(const string &name, const attrs_type &attrs)
list< string > m_Errors
List of parsing errors.
list< string > m_Text_chunks
bool error(const string &message)
bool HasError(void) const
Subclass this to override how messages (warnings and errors) are handled.
const list< CTime > GetTime(void) const
void LinkOut(const string &db, const vector< objects::CSeq_id_Handle > &uids, xml::document &docsums, const string &cmd="llinks")
void Fetch(const string &db, const vector< objects::CSeq_id_Handle > &uids, CNcbiOstream &ostr, const string &retmode="xml")
void SetMaxReturn(int ret_max)
int m_CachedHostNameCount
CRef< CMessageHandler > m_MessageHandler
void SearchHistory(const string &db, const string &term, const string &web_env, Int8 query_key, int retstart, CNcbiOstream &ostr)
Uint8 Search(const string &db, const string &term, vector< objects::CSeq_id_Handle > &uids, const string &xml_path=kEmptyStr)
TParamList m_AdditionalParams
const list< string > GetUrl(void) const
static string x_BuildUrl(const string &host, const string &path, const string ¶ms)
void x_AddAdditionalParameters(string ¶ms)
void x_Fetch(const string &db, const vector< T > &uids, CNcbiOstream &ostr, const string &retmode="xml")
void x_Summary(const string &db, const vector< T > &uids, xml::document &docsums, const string &version="")
void AddParameter(const string &name, const string &value)
void Summary(const string &db, const vector< objects::CSeq_id_Handle > &uids, xml::document &docsums, const string &version="")
void SetLinkName(const string &link_name)
void ClearAddedParameters()
void x_Link(const string &db_from, const string &db_to, const vector< T1 > &uids_from, vector< T2 > &uids_to, const string &xml_path, const string &command)
Uint8 x_Search(const string &db, const string &term, vector< T > &uids, const string &xml_path=kEmptyStr)
void SetMessageHandlerDiagPost(void)
Equivalent to: ERR_POST(Warning|Error << ...).
void x_Get(string const &path, string const ¶ms, CNcbiOstream &ostr)
Uint8 x_ParseSearchResults(const string &xml_file, vector< T > &uids)
void SetMessageHandlerThrowOnError(void)
Equivalent to: NCBI_THROW, ERR_POST, LOG_POST as appropriate.
void Link(const string &db_from, const string &db_to, const vector< objects::CSeq_id_Handle > &uids_from, vector< objects::CSeq_id_Handle > &uids_to, const string &xml_path=kEmptyStr, const string &command="neighbor")
const string & x_GetHostName(void) const
void SetMessageHandler(CMessageHandler &message_handler)
Set custom message handler.
void SetMessageHandlerDefault(void)
Default is to log all messages at informational level.
void SetUserTag(const string &tag)
Uint8 ParseSearchResults(CNcbiIstream &istr, vector< objects::CSeq_id_Handle > &uids)
void FetchHistory(const string &db, const string &web_env, Int8 query_key, int retstart, EContentType content_type, CNcbiOstream &ostr)
void LinkHistory(const string &db_from, const string &db_to, const string &web_env, Int8 query_key, CNcbiOstream &ostr)
Uint8 Count(const string &db, const string &term)
void SummaryHistory(const string &db, const string &web_env, Int8 query_key, int retstart, const string &version, CNcbiOstream &ostr)
void x_LinkOut(const string &db, const vector< T > &uids, xml::document &doc, const string &cmd)
virtual void HandleMessage(EDiagSev severity, CEUtilsException::EErrCode err_code, const string &message) const
Pure virtual function, to be implemented by subclass.
virtual void HandleMessage(EDiagSev severity, CEUtilsException::EErrCode err_code, const string &message) const
Pure virtual function, to be implemented by subclass.
bool IsTaxidQuery(const string &message) const
virtual void HandleMessage(EDiagSev severity, CEUtilsException::EErrCode err_code, const string &message) const
Pure virtual function, to be implemented by subclass.
container_type::value_type value_type
The xml::document class is used to hold the XML tree and various bits of information about it.
void swap(document &other)
Swap one xml::document object for another.
The xml::error_messages class is used to store all the error message which are collected while parsin...
bool has_fatal_errors(void) const
Check if there are fatal errors in the error messages.
bool has_errors(void) const
Check if there are errors in the error messages.
std::string print(void) const
Convert error messages into a single printable string.
The xml::event_parser is used to parse an XML document by calling member functions when certain thing...
std::map< std::string, std::string > attrs_type
a type for holding XML node attributes
bool parse_stream(std::istream &stream, error_messages *messages, warnings_as_errors_type how=type_warnings_not_errors)
Parse what ever data that can be read from the given stream.
bool parse_file(const char *filename, error_messages *messages, warnings_as_errors_type how=type_warnings_not_errors)
Call this member function to parse the given file.
The xml::parser_exception class is used to store parsing and validating exception information.
virtual const char * what() const noexcept
Convert error messages into a printable C-style string.
The NCBI C++ standard methods for dealing with std::string.
void s_FormatIds< string >(ostream &osm, const vector< string > &uids)
static const char * s_GetErrCodeString(CEUtilsException::TErrCode err_code)
string s_ParseId< string >(const string &str)
void s_FormatIds< CSeq_id_Handle >(ostream &osm, const vector< CSeq_id_Handle > &uids)
static void s_SearchHistoryQuery(ostringstream &oss, const string &db, const string &term, const string &web_env, int retstart, int retmax)
CSeq_id_Handle s_ParseId< CSeq_id_Handle >(const string &str)
static string s_GetContentType(CEutilsClient::EContentType content_type)
static void s_FetchHistoryQuery(ostream &oss, const string &db, const string &web_env, int retstart, int retmax, CEutilsClient::EContentType content_type)
#define HOST_NAME_REFRESH_FREQ
static void s_SummaryHistoryQuery(ostream &oss, const string &db, const string &web_env, int retstart, const string version, int retmax)
static void s_FormatIds(ostream &osm, const vector< T > &uids)
static T s_ParseId(const string &str)
This file contains the definition of the xml::event_parser class.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
int GetStatusCode(void) const
Get the last seen HTTP status code, if available.
CPipe & GetPipe(void)
Return an underlying CPipe; it's valid for as long as the stream exists.
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
const CNcbiDiag & GetRef(void) const
Some compilers (e.g.
static const char * SeverityName(EDiagSev sev)
Get a common symbolic name for the severity levels.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
EDiagSev
Severity level for the posted diagnostics.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error – guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Trace(CExceptionArgs_Base &args)
void Warning(CExceptionArgs_Base &args)
void Info(CExceptionArgs_Base &args)
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
EIO_Status CloseHandle(EChildIOHandle handle)
Close the specified child's pipe handle (even for CPipe opened with OpenSelf()).
@ fStdErr_Share
Keep stderr (share it with child)
int64_t Int8
8-byte (64-bit) signed integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
SSERV_Info * SERV_GetInfo(const char *service, TSERV_Type types, unsigned int preferred_host, const SConnNetInfo *net_info)
Same as "SERV_GetInfoEx(., ., ., ., 0, 0, 0)" – i.e.
static string ntoa(unsigned int host)
BSD-like API. NB: when int, "host" must be in network byte order.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
bool NcbiStreamCopy(CNcbiOstream &os, CNcbiIstream &is)
Copy the entire contents of stream "is" to stream "os".
size_t NcbiStreamToString(string *s, CNcbiIstream &is, size_t pos=0)
Input the entire contents of an istream into a string (NULL causes drain).
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static Uint8 StringToUInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to Uint8.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
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.
static string URLEncode(const CTempString str, EUrlEncode flag=eUrlEnc_SkipMarkChars)
URL-encode string.
static string & ToLower(string &str)
Convert string to lower case – string& version.
@ eCurrent
Use current time. See also CCurrentTime.
const char * ConnNetInfo_GetValue(const char *service, const char *param, char *value, size_t value_size, const char *def_value)
SConnNetInfo * ConnNetInfo_Create(const char *service)
void ConnNetInfo_Destroy(SConnNetInfo *net_info)
@ e_Gi
GenInfo Integrated Database.
@ e_not_set
No variant selected.
string Execute(const string &cmmd, const vector< string > &args, const string &data=kEmptyStr)
void SleepSec(unsigned long sec, EInterruptOnSignal onsignal=eRestartOnSignal)
Sleep.
static const char * suffix[]
static const char * str(char *buf, int n)