61 #include <unordered_map>
63 #define GRID_APP_NAME "cgi2rcgi"
67 #define HTTP_NCBI_JSID "NCBI-JSID"
87 void CheckEntry(
const string& name,
const string&
value,
bool is_requested =
true);
138 "Invalid " <<
name <<
" value (not shown for safety reasons)");
162 if (((found ==
m_Entries.end()) || !found->Check(
value)) && is_requested) {
178 for (
const auto& job_id : rv) {
189 if (!
value.empty()) {
235 auto message =
m_Registry->
GetString(
"CGI",
"Exception_Message",
"Some exception was thrown (not shown for safety reasons)");
236 return message.empty() ? what : message;
263 string GetSelfURL(
bool include_entries =
true)
const;
274 string&
value)
const;
329 m_InputValidator(input_validator),
331 m_CustomHTTPHeader(custom_http_header),
333 m_NeedRenderPage(
true)
339 const string kNoMetaRefreshHeader =
"X_NCBI_RETRY_NOMETAREFRESH";
348 if (!include_entries) {
356 const string& name = it->first;
357 const string&
value = it->second;
358 if (!name.empty() && !
value.empty()) {
372 const string& entry_name)
const
385 string v = eit->second;
398 string v = eit->second;
412 const string& entry_name,
string&
value,
int pulling)
447 AddTagMap(
"QUERY_STRING:" + eit->first, eit->second, encode_mode);
460 new CHTMLText(
"<@HEADER_" + view_name +
"@>"));
483 int ifd,
int ofd,
int flags);
493 void ListenJobs(
const string& job_ids_value,
const string& timeout_value);
556 string grid_cgi_section(
"grid_cgi");
559 config.Set(
"CGI",
"EnableVersionRequest",
"false");
562 if (!
config.HasEntry(
"netservice_api",
"error_on_unexpected_reply")) {
563 config.Set(
"netservice_api",
"error_on_unexpected_reply",
"true");
590 config.GetBool(grid_cgi_section,
"automatic_cleanup",
593 config.GetBool(grid_cgi_section,
"use_progress",
611 arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
612 "Cgi2RCgi application");
614 arg_desc->AddOptionalKey(
"Cancel",
623 string cgi2rcgi_section(
"cgi2rcgi");
630 "html_pass_through",
false);
638 "Remote CGI Status Checker");
643 string incs =
config.GetString(cgi2rcgi_section,
"html_template_includes",
644 "cgi2rcgi.inc.html");
669 vector<string> affinity_methods;
671 "affinity_source",
"GET"),
", ;&|", affinity_methods,
673 for (vector<string>::const_iterator it = affinity_methods.begin();
674 it != affinity_methods.end(); ++it) {
677 else if (*it ==
"POST")
681 "Invalid affinity_source value '" << *it <<
'\'');
685 "narrow_affinity_set_to", 0);
692 if (
config.GetBool(cgi2rcgi_section,
"donot_parse_content",
700 "date_format",
"D B Y, h:m:s");
703 "elapsed_time_format",
"S");
719 int ifd,
int ofd,
int flags)
733 size_t content_length = 0;
745 out, ifd, ofd,
flags | (content_length > 0 &&
751 "<FORM METHOD=\"GET\" ACTION=\"<@SELF_URL@>\">\n"
752 "<@HIDDEN_FIELDS@>\n<@STAT_VIEW@>\n"
763 const string& test_pattern);
770 const string& test_pattern)
777 stringstream node_stream;
783 return regexp.
IsMatch(node_stream.str());
786 #define CALLBACK_PARAM "callback="
792 if (callback_pos ==
NPOS)
796 const char* callback_end = strchr(query_string->c_str() +
798 if (callback_end !=
NULL)
799 query_string->erase(callback_pos,
800 callback_end - query_string->data() - callback_pos + 1);
801 else if (callback_pos == 0)
802 query_string->clear();
803 else if (query_string->at(callback_pos - 1) ==
'&')
804 query_string->erase(callback_pos - 1);
832 m_Page->AddTagMap(
"VIEW", stat_view);
834 catch (exception& e) {
835 ERR_POST(
"Failed to create " <<
m_Title <<
" HTML page: " << e.what());
858 if (jquery_callback_it !=
entries.end()) {
860 entries.erase(jquery_callback_it);
861 string query_string_param(
863 string query_string =
env.Get(query_string_param);
864 if (!query_string.empty()) {
866 env.Set(query_string_param, query_string);
874 if (!listen_jobs.empty()) {
888 catch (exception& ex) {
889 ERR_POST(
"Job's reported as failed: " << ex.what());
899 catch (exception& e) {
901 " HTML page: " << e.what());
910 switch (job_status) {
928 struct SJobs : unordered_map<string, SJob>
937 if (job_ids.empty())
return;
941 for (
const auto& job_id : job_ids) {
942 jobs.emplace(job_id, job_id);
952 bool wait_notifications =
true;
954 for (
auto&& j : jobs) {
955 const auto& job_id = j.first;
956 auto& job = j.second;
958 wait_notifications = wait_notifications && !deadline.IsExpired();
961 if (wait_notifications) {
962 tie(job.status, ignore, job.progress_msg) =
978 if (wait_notifications) {
979 while (
handler.WaitForNotification(deadline)) {
982 auto it = jobs.find(parser(
"job_key"));
985 if (it != jobs.end()) {
986 auto& job = it->second;
988 job.progress_msg = parser(
"msg");
989 job.progress_msg_truncated = !parser(
"msg_truncated").empty();
996 for (
auto&& j : jobs) {
997 auto& job = j.second;
1000 job.progress_msg_truncated =
false;
1007 job.progress_msg.clear();
1021 catch (exception& e) {
1024 ERR_POST(
Warning <<
"Failed to write jobs and their states to client: " << e.what());
1031 out <<
"Content-type: application/json\nStatus: 200 OK\n\n";
1033 for (
const auto& j : jobs) {
1034 const auto& job_id = j.first;
1035 const auto& job = j.second;
1039 out <<
delimiter <<
"\n \"" << job_id <<
"\":\n {\n \"Status\": \"" << status <<
"\"";
1041 if (!job.progress_msg.empty()) {
1042 out <<
",\n \"Message\": " << message;
1043 if (job.progress_msg_truncated)
out <<
",\n \"Truncated\": true";
1050 out <<
"\n}" << endl;
1105 if (!affinity.empty()) {
1108 crc32.AddChars(affinity.data(), affinity.length());
1129 if (!saved_content.empty())
1130 os.write(saved_content.data(), saved_content.length());
1165 catch (exception& ex) {
1181 string hidden_fields;
1185 hidden_fields +=
"<INPUT TYPE=\"HIDDEN\" NAME=\"" + it->first
1187 m_Page->AddTagMap(
"HIDDEN_FIELDS",
1192 m_Page->AddTagMap(
"DATE",
1195 if (!since_time.empty()) {
1196 grid_ctx.
AddTagMap(
"SINCE_TIME", since_time);
1200 m_Page->AddTagMap(
"SINCE",
1203 m_Page->AddTagMap(
"ELAPSED_TIME_MSG_HERE",
1205 m_Page->AddTagMap(
"ELAPSED_TIME",
1212 string progress_message;
1217 ERR_POST(
"Could not retrieve progress message for " <<
1236 vector<string>::const_iterator it;
1239 m_Page->LoadTemplateLibFile(lib, &page_filter);
1243 stringstream header_stream;
1253 } status_line_status = eNoStatusLine;
1255 while (header_stream.good()) {
1256 getline(header_stream, header_line);
1257 if (header_line.empty())
1259 if (status_line_status == eReadingStatusLine) {
1260 if (
isspace(header_line[0])) {
1261 status_line += header_line;
1264 status_line_status = eGotStatusLine;
1267 status_line_status = eReadingStatusLine;
1268 status_line = header_line;
1271 out << header_line <<
"\r\n";
1273 if (status_line_status != eNoStatusLine) {
1275 status_line.data() + (
sizeof(
"Status:") - 1),
1276 status_line.size() - (
sizeof(
"Status:") - 1));
1280 status_code, reason,
1291 catch (exception& e) {
1298 " HTML page: " << e.what());
1306 const string& url,
int idelay)
1312 "<META HTTP-EQUIV=Refresh "
1313 "CONTENT=\"<@REDIRECT_DELAY@>; URL=<@REDIRECT_URL@>\">");
1314 m_Page->AddTagMap(
"REDIRECT", redirect);
1317 m_Page->AddTagMap(
"REDIRECT_DELAY", delay);
1324 "no-cache, no-store, max-age=0, private, must-revalidate");
1344 ERR_POST(
"Failed to retrieve job status for " <<
1374 "Failed to retrieve job status: " + e.
GetMsg()));
1384 const string kFormat =
"M/D/Y h:m:G";
1387 parser.
Reset(event);
1394 }
while (name != kTimestamp);
1401 const string kStatus =
"status: ";
1402 const string kEvent1 =
"event1: ";
1408 while (
output.ReadLine(line)) {
1487 bool no_jquery =
ctx.GetJqueryCallback().empty();
1492 ctx.NeedRenderPage(
false);
1498 while (getline(is, header_line)) {
1500 if (header_line.empty())
1504 out << header_line <<
"\r\n";
1506 out <<
"Content-Type: text/javascript\r\n";
1508 out << header_line <<
"\r\n";
1520 out <<
ctx.GetJqueryCallback() <<
'(';
1524 ctx.NeedRenderPage(
false);
1530 catch (exception& ex) {
1531 err_msg = ex.
what();
1535 ERR_POST(
"Failed to read job output: " << err_msg);
1538 ERR_POST(
Warning <<
"Failed to write job output to client: " << err_msg);
1539 ctx.NeedRenderPage(
false);
1541 ERR_POST(
"Failed while relaying job output: " << err_msg);
1553 ctx.SelectView(
"JOB_DONE");
1565 const char* str_page;
1569 str_page =
"<html><head><title>Empty Result</title>"
1570 "</head><body>Empty Result</body></html>";
1579 ctx.GetHTMLPage().SetTemplateString(str_page);
1588 ctx.SelectView(
"JOB_FAILED");
1594 ctx.GetHTMLPage().AddTagMap(
"MSG",
1599 int main(
int argc,
const char* argv[])
1605 return app.
AppMain(argc, argv);
static const string kSinceTime
Checksum and hash calculation classes.
ENextAttributeType NextAttribute(CTempString *attr_name, string *attr_value, size_t *attr_column)
void Reset(const char *position, const char *eol)
CChecksum – Checksum calculator.
Pool of recycled CCompoundID objects.
Grid CGI Context Context in which a request is processed.
void SetJobProgressMessage(const string &msg)
void DefinePersistentEntry(const string &entry_name, const string &value)
void PullUpPersistentEntry(const string &entry_name)
CHTMLPage & GetHTMLPage()
bool NeedRenderPage() const
const string & GetJobProgressMessage() const
Grid Client (the submitter).
Client API for NetCache server.
Client API for NCBI NetSchedule server.
void GetQueueInfo(CNetServer server, const string &queue_name, TQueueInfo &queue_info)
void DumpJob(CNcbiOstream &out, const string &job_key)
NetSchedule internal exception.
CNetScheduleAPI::EJobStatus WaitForJobEvent(const string &job_key, CDeadline &deadline, CNetScheduleAPI ns_api, TJobStatusMask status_mask, int last_event_index=kMax_Int, int *new_event_index=NULL)
Smart pointer to the job submission part of the NetSchedule API.
CNetServer GetServer(unsigned host, unsigned short port)
CNetServiceIterator ExcludeServer(CNetServer::TInstance server)
Start iteration excluding 'server' (return the next server after 'server' or NULL).
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
CTimeout – Timeout interval.
container_type::const_iterator const_iterator
container_type::iterator iterator
const_iterator begin() const
const_iterator end() const
const_iterator find(const key_type &key) const
container_type::iterator iterator
void(*)(CSeq_entry_Handle seh, IWorkbench *wb, const CSerialObject &obj) handler
The NCBI C++ standard methods for dealing with std::string.
std::ofstream out("events_result.xml")
main entry point for tests
static void get_results(DBPROCESS *dbproc, int start)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static SQLCHAR output[256]
static const char * column
#define GRID_APP_CHECK_VERSION_ARGS()
NetSchedule Framework specs.
CNcbiEnvironment & SetEnvironment(void)
Get a non-const copy of the application's cached environment.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
CNcbiRegistry & GetRWConfig(void)
Get the application's cached configuration parameters, accessible for read-write for an application's...
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
@ eString
An arbitrary string.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
const CCgiRequest & GetRequest(void) const
void SetRequestFlags(int flags)
Set cgi parsing flag.
void Init(void) override
This method is called on the CGI application initialization – before starting to process a HTTP reque...
void RegisterDiagFactory(const string &key, CDiagFactory *fact)
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments extended with CGI parameters.
void SetRequestId(const string &rid, bool is_done)
virtual CCgiContext * CreateContextWithFlags(CNcbiArguments *args, CNcbiEnvironment *env, CNcbiIstream *inp, CNcbiOstream *out, int ifd, int ofd, int flags)
The same as CreateContext(), but allows for a custom set of flags to be specified in the CCgiRequest ...
const string & GetSelfURL(ESelfUrlPort) const
Using HTTP environment variables, compose the CGI's own URL as: SCHEME://SERVER_NAME[:SERVER_PORT]/SC...
#define NCBI_CGI_THROW_WITH_STATUS(exception, err_code, message, status)
const TCgiEntries & GetEntries(void) const
Get a set of entries(decoded) received from the client.
static SIZE_TYPE ParseEntries(const string &str, TCgiEntries &entries)
Decode the URL-encoded(FORM or ISINDEX) string "str" into a set of entries <"name",...
void SetHeaderValue(const string &name, const string &value)
void Serialize(CNcbiOstream &os) const
Serialize/Deserialize a request to/from a stream.
CNcbiOstream & out(void) const
Get output stream. Throw exception if GetOutput() is NULL.
void SetStatus(unsigned int code, const string &reason=kEmptyStr)
void RequireWriteHeader(bool require)
Define if WriteHeader() must be called or can be skipped.
const string & GetProperty(ECgiProp prop) const
Get value of a "standard" property (return empty string if not defined)
const string & GetContent(void) const
Get request content.
void SetContentType(const string &type)
Set content type (text/html by default if not provided)
const string & GetRandomProperty(const string &key, bool http=true) const
Get value of a random client property; if "http" is TRUE then add prefix "HTTP_" to the property name...
CNcbiOstream & WriteHeader(void) const
Write HTTP response header to the output stream.
int TFlags
Startup initialization.
static const string GetPropertyName(ECgiProp prop)
Get name (not value!) of a "standard" property.
@ fSaveRequestContent
Save request content (available through GetContent())
@ fDoNotParseContent
do not automatically parse the request's content body (from "istr")
@ fCaseInsensitiveArgs
use case insensitive CGI arguments
CDiagContext_Extra & Print(const string &name, const string &value)
The method does not print the argument, but adds it to the string.
CDiagContext & GetDiagContext(void)
Get diag context instance.
CDiagContext_Extra Extra(void) const
Create a temporary CDiagContext_Extra object.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
static void SetOldPostFormat(bool value)
Set old/new format flag.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
TErrCode GetErrCode(void) const
Get error code.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
void Warning(CExceptionArgs_Base &args)
string ReportAll(TDiagPostFlags flags=eDPF_Exception) const
Report all exceptions.
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
#define FORMAT(message)
Format message using iostreams library.
virtual CNCBINode * MapTag(const string &name)
Resolve <@XXX> tag.
class CHTMLPage::CTemplateLibFilter TTemplateLibFilter
Interface for a filter, which must be passed to one the LoadTemplateLib methods to select relevant pa...
virtual void AddTagMap(const string &name, BaseTagMapper *mapper)
Tag mappers.
virtual CNcbiOstream & Print(CNcbiOstream &out, TMode mode=eHTML)
@ eJSONEncode
Encode for JSON output.
@ eNoEncode
Do not encode prior to printing.
@ eHTMLEncode
Encode for HTML output.
vector< SEntry > m_Entries
static vector< string > GetListenJobs(const string &value)
CCgiContext & m_CgiContext
bool m_InterceptJQueryCallback
unique_ptr< CHTMLPage > m_Page
CNcbiRegistry * m_Registry
EJobStatus
Job status codes.
bool CheckIfJobDone(CGridCgiContext &, CNetScheduleAPI::EJobStatus)
TCgiEntries m_ParsedQueryString
unique_ptr< CHTMLPage > m_CustomHTTPHeader
void SetJobProgressMessage(const string &msg)
CNetScheduleSubmitter GetSubmitter()
Create an instance of CNetScheduleSubmitter.
SExceptionMessage m_ExceptionMessage
void SubmitJob(CCgiRequest &request, CGridCgiContext &grid_ctx)
CHTMLPlainText::EEncodeMode m_TargetEncodeMode
string m_ElapsedTimeFormat
void DefinePersistentEntry(const string &entry_name, const string &value)
void PullUpPersistentEntry(const string &entry_name)
Save this entry as a cookie add it to serf url.
void Clear()
Remove all persisted entries from cookie and self url.
void DefineRefreshTags(CGridCgiContext &grid_ctx, const string &url, int delay)
CRegexpTemplateFilter(CHTMLPage *page)
CHTMLPage & GetHTMLPage(void)
Get an HTML page.
CNetScheduleAPI::EJobStatus GetStatus(CGridCgiContext &)
CHTMLPage & m_CustomHTTPHeader
void NeedRenderPage(bool value)
EJobStatus GetJobDetails(CNetScheduleJob &job, time_t *job_exptime=NULL, ENetScheduleQueuePauseMode *pause_mode=NULL)
Get job details.
static void s_RemoveCallbackParameter(string *query_string)
const TPersistentEntries & GetPersistentEntries() const
function< void(const string &)> m_Func
CNetScheduleAPI::EJobStatus GetStatusAndCtgTime(CGridCgiContext &grid_ctx)
void GetQueryStringEntryValue(const string &entry_name, string &value) const
bool s_IsPendingOrRunning(CNetScheduleAPI::EJobStatus job_status)
void SelectView(const string &view_name)
SExceptionMessage(CNcbiRegistry *registry=nullptr)
string operator()(const string &what)
map< string, string > TPersistentEntries
CNetCacheAPI m_NetCacheAPI
static void CheckGetResults(const string &value)
void CheckEntry(const string &name, const string &value, bool is_requested=true)
TPersistentEntries m_PersistentEntries
string GetSelfURL(void) const
Get Self URL.
CNetScheduleAPI::EJobStatus status
virtual bool TestAttribute(const string &attr_name, const string &test_pattern)
static const string kPlainTextView
static string StatusToString(EJobStatus status)
Printable status type.
bool NeedMetaRefresh() const
bool NeedRenderPage() const
void ReadJob(istream &, CGridCgiContext &)
void s_GetCtgTime(CGridCgiContext &grid_ctx, string event)
SInputValidator m_InputValidator
static const string kGridCgiForm
void LoadQueryStringTags(CHTMLPlainText::EEncodeMode encode_mode)
const string & GetJobKey(void) const
Get Current job key.
virtual CCgiContext * CreateContextWithFlags(CNcbiArguments *args, CNcbiEnvironment *env, CNcbiIstream *inp, CNcbiOstream *out, int ifd, int ofd, int flags)
The same as CreateContext(), but allows for a custom set of flags to be specified in the CCgiRequest ...
virtual int ProcessRequest(CCgiContext &ctx)
This is the method you should override.
static CDeadline GetDeadline(const string &value)
SInputValidator & m_InputValidator
static void CheckCancel(const string &value)
void PopulatePage(CGridCgiContext &grid_ctx)
virtual void Init()
This method is called on the CGI application initialization – before starting to process a HTTP reque...
CCgiResponse * m_Response
int main(int argc, const char *argv[])
void AddAffinityEntry(string name)
const string & GetPersistentEntryValue(const string &entry_name) const
void GetRequestEntryValue(const string &entry_name, string &value) const
void OnJobFailed(const string &msg, CGridCgiContext &ctx)
void OnJobDone(CGridCgiContext &)
void CheckJob(CGridCgiContext &grid_ctx)
void ListenJobs(const string &job_ids_value, const string &timeout_value)
static void CheckCtgTime(const string &value)
CNetScheduleAPIExt m_NetScheduleAPI
static void CheckJobKey(const string &value)
unique_ptr< CGridClient > m_GridClient
bool Check(const string &value)
static EJobStatus StringToStatus(const CTempString &status_str)
Parse status string into enumerator value.
CNetScheduleAdmin GetAdmin()
friend CNcbiOstream & operator<<(CNcbiOstream &out, SJobs jobs)
bool progress_msg_truncated
string job_id
Output job key.
string & GetJqueryCallback()
static void CheckAffinity(const string &value)
CGridCgiContext(CHTMLPage &page, CCgiContext &ctx)
vector< string > m_HtmlIncs
void AddTagMap(const string &n, const string &v, CHTMLPlainText::EEncodeMode m=CHTMLPlainText::eHTMLEncode)
@ eDone
Job is ready (computed successfully)
@ eCanceled
Explicitly canceled.
@ eRunning
Running on a worker node.
@ eJobNotFound
No such job.
@ ePending
Waiting for execution.
@ eFailed
Failed to run (execution timeout)
uint64_t Uint8
8-byte (64-bit) unsigned integer
bool IsMatch(CTempString str, TMatch flags=fMatch_default)
Check existence substring which match a specified pattern.
virtual string GetString(const string §ion, const string &name, const string &default_value, TFlags flags=0) const
Get the parameter string value.
@ eReturn
Return default value.
static const char * kHeader_Url
static const char * kHeader_Delay
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
bool NcbiStreamCopy(CNcbiOstream &os, CNcbiIstream &is)
Copy the entire contents of stream "is" to stream "os".
static bool StringToBool(const CTempString str)
Convert string to bool.
NCBI_NS_STD::string::size_type SIZE_TYPE
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
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.
static bool MatchesMask(CTempString str, CTempString mask, ECase use_case=eCase)
Match "str" against the "mask".
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
static string HtmlEncode(const CTempString str, THtmlEncode flags=fHtmlEnc_EncodeAll)
Encode a string for HTML.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
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 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.
static Uint8 StringToUInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to Uint8.
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.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
static string Sanitize(CTempString str, TSS_Flags flags=fSS_print)
Sanitize a string, allowing only specified classes of characters.
static string JsonEncode(const CTempString str, EJsonEncode encoding=eJsonEnc_UTF8)
Encode a string for JSON.
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 TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
@ eJsonEnc_Quoted
Quote resulting string.
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
@ eUrlEnc_URIPath
Encode path part of an URI.
@ eTrunc_End
Truncate trailing whitespace only.
@ eNocase
Case insensitive compare.
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
string AsString(const CTimeFormat &fmt=kEmptyStr) const
Transform time span to string.
void Set(EType type)
Set special value.
CTime GetFastLocalTime(void)
Quick and dirty getter of local time.
CTime & SetTimeT(const time_t t)
Set time using time_t time value.
@ eZero
Zero timeout, equal to CTimeout(0,0).
where both of them are integers Note
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
Miscellaneous common-use basic types and functionality.
static const string kStatus
static const char delimiter[]
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
void AddToClientNode(const string &data)
CCompoundIDPool GetCompoundIDPool()
Meaningful information encoded in the NetSchedule key.
C++ wrappers for the Perl-compatible regular expression (PCRE) library.
static wxAcceleratorEntry entries[3]