A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/cgiapp_8cpp_source.html below:

NCBI C++ ToolKit: src/cgi/cgiapp.cpp Source File

60 #define NCBI_USE_ERRCODE_X Cgi_Application 68

CGI_PRINT_HTTP_REFERER);

74

CGI_PRINT_USER_AGENT);

86

CGI_PRINT_REQUEST_METHOD);

98

CGI_CLIENT_CONNECTION_INTERRUPTION_OKAY);

112

CGI_CLIENT_CONNECTION_INTERRUPTION_SEVERITY);

127  size_t

* bytes_read = 0);

142  if

(x_read > 0 ||

count

== 0) {

149

*bytes_read = x_read;

161

CGI_COUNT_TRANSFERED);

179  size_t

* bytes_written = 0);

210

m_ErrorReported(

false

),

214

m_UsedChunkedTransfer(

false

)

238  size_t

* bytes_written)

259  ERR_POST_X

(16,

"CCgiStreamWrapperWriter::Write() -- attempt to " 260  "write data after finishing chunked transfer."

);

263  ERR_POST_X

(15,

"CCgiStreamWrapperWriter::Write() -- attempt to " 264  "write data after sending headers on HEAD request."

);

275  const char

* cbuf =

static_cast<const char

*

>

(

buf

);

283  count

-= chunk_count;

284

written += chunk_count;

287  if

(!

m_Out

->good()) {

289

written -= chunk_count;

298  if

(

m_Out

->good()) {

310

*bytes_written = written;

345  m_Out

->exceptions(ios_base::goodbit);

346  m_Out

->setstate(ios_base::badbit);

361

list<CNcbiOstream*> slist;

362

slist.push_back(

m_Out

);

363

slist.push_back(&stream);

486 #if defined(NCBI_OS_UNIX) 488  if

( !TParamAllowSigpipe::GetDefault() ) {

489

signal(SIGPIPE, SIG_IGN);

490  struct

sigaction sigterm, sigtermold;

491

memset(&sigterm, 0,

sizeof

(sigterm));

493

sigterm.sa_flags = SA_RESETHAND;

494  if

(sigaction(SIGTERM, &sigterm, &sigtermold) == 0

495

&& sigtermold.sa_handler != SIG_DFL) {

496

sigaction(SIGTERM, &sigtermold, 0);

511  bool

skip_stat_log =

false

;

512

unique_ptr<CCgiStatistics> stat(is_stat_log ?

CreateStat

() : 0);

517

unique_ptr<CNcbiOstream> new_stream;

518

shared_ptr<CCgiContext>

context

;

519

unique_ptr<ICache> cache;

522  _TRACE

(

"(CGI) CCgiApplication::Run: calling ProcessRequest"

);

543

}

catch

(

const

exception& ex) {

544  ERR_POST_X

(1,

"Couldn't create cache : "

<< ex.what());

546  bool

skip_process_request =

false

;

548  if

(cache && caching_needed) {

553  if

(!skip_process_request) {

556  context

->GetResponse().GetOutput());

561

list<CNcbiOstream*> slist;

562

orig_stream =

context

->GetResponse().GetOutput();

563

slist.push_back(orig_stream);

564

slist.push_back(&result_copy);

567  context

->GetResponse().SetOutput(new_stream.get());

585  context

->GetResponse().Finalize();

589  context

->GetResponse().AbortChunkedTransfer();

591  context

->GetResponse().FinishChunkedTransfer();

593  context

->GetResponse().Flush();

602

}

else if

(caching_needed) {

619  context

->GetResponse().FinishChunkedTransfer();

631  if

( is_stat_log && !skip_stat_log ) {

633

stat->Submit(stat->Compose());

635

is_stat_log =

false

;

638  _TRACE

(

"CCgiApplication::Run: flushing"

);

639  context

->GetResponse().Flush();

644  catch

(exception& e) {

646  context

->GetResponse().AbortChunkedTransfer();

661  string msg

=

"(CGI) CCgiApplication::ProcessRequest() failed: "

;

666  msg

= stat->Compose();

668

skip_stat_log =

true

;

676  if

( !TClientConnIntOk::GetDefault() ) {

678  "Connection interrupted"

);

687 #ifndef NCBI_OS_MSWIN 689  if

( is_stat_log && !skip_stat_log ) {

691

stat->Submit(stat->Compose());

709  if

( !ref.empty() ) {

723  const auto

& req =

ctx

.GetRequest();

727  if

(TPrintRequestMethodParam::GetDefault()) {

729  string

method = req.GetRequestMethodName();

730  if

(!method.empty()) {

731

diag.Extra().Print(

"REQUEST_METHOD"

, method);

734  if

( TPrintSelfUrlParam::GetDefault() ) {

736  string

self_url =

ctx

.GetSelfURL();

737  if

( !self_url.empty() ) {

739

req.GetRandomProperty(

"REDIRECT_QUERY_STRING"

,

false

);

740  if

( args.empty() ) {

743  if

( !args.empty() ) {

744

self_url +=

"?"

+ args;

749  if

( !target_url.empty() ) {

750  bool

secure =

AStrEquiv

(req.GetRandomProperty(

"HTTPS"

,

752  string

host = (secure ?

"https://"

:

"http://"

) + diag.GetHost();

754  if

(!port.empty() && port != (secure ?

"443"

:

"80"

)) {

757

target_url = host + target_url;

759  if

( !self_url.empty() || !target_url.empty() ) {

760

diag.Extra().Print(

"SELF_URL"

, self_url).

761  Print

(

"TARGET_URL"

, target_url);

765  if

( TPrintRefererParam::GetDefault() ) {

767  if

( !

str

.empty() ) {

768

diag.Extra().Print(

"HTTP_REFERER"

,

str

);

772  if

( TPrintUserAgentParam::GetDefault() ) {

774  if

( !

str

.empty() ) {

775

diag.Extra().Print(

"USER_AGENT"

,

str

);

786  string

name = it->substr(5);

789  env

[name] = rq_env.

Get

(*it);

806  ERR_POST_X

(2,

"CCgiApplication::GetContext: no context set"

);

807  throw

runtime_error(

"no context set"

);

816  ERR_POST_X

(3,

"CCgiApplication::GetResource: no resource set"

);

817  throw

runtime_error(

"no resource set"

);

833  ERR_POST_X

(17,

"CCgiApplication::GetResource: no processor set"

);

834  throw

runtime_error(

"no request processor set"

);

848  if

(processor !=

nullptr

)

delete

processor;

861

CGI_MERGE_LOG_LINES);

867  if

( TMergeLogLines::GetDefault() ) {

940  bool

need_output_wrapper =

941

TCGI_Count_Transfered::GetDefault() ||

947  if

( TCGI_Count_Transfered::GetDefault() ) {

958  if

( need_output_wrapper ) {

977

(errbuf_size >= 0) ? (

size_t

) errbuf_size : 256,

1030

m_CaughtSigterm(

false

),

1080  if

(!pprocessor)

break

;

1088  if

(!s.empty()) req_ctx.SetSrcTraceState(s);

1090  if

(!s.empty()) req_ctx.SetSrcTraceParent(s);

1100

.AllowBadSymbolsInArgNames()

1101

.Print(collector.

GetArgs

());

1114  auto

span = req_ctx.GetTracerSpan();

1117  if

(!s.empty()) span->SetName(s);

1127  if

( args.empty() ) {

1130  if

( !args.empty() ) {

1162

extra.

Print

(it->name, it->value);

1172  if

(!pprocessor)

break

;

1178  if

( !

in

.good() ) {

1184  catch

(

const

exception&) {

1189  if

( !

out

.good() ) {

1196  catch

(

const

exception&) {

1207  if

(!pprocessor)

break

;

1224  if

(TClientConnIntOk::GetDefault() ||

1298  string

dest = request.

GetEntry

(

"diag-destination"

, &is_set);

1315  string

threshold = request.

GetEntry

(

"diag-threshold"

, &is_set);

1319  if

(threshold ==

"fatal"

) {

1321

}

else if

(threshold ==

"critical"

) {

1323

}

else if

(threshold ==

"error"

) {

1325

}

else if

(threshold ==

"warning"

) {

1327

}

else if

(threshold ==

"info"

) {

1329

}

else if

(threshold ==

"trace"

) {

1342

TFlagMap& flagmap = s_FlagMap.

Get

();

1359  if

(flagmap.empty()) {

1381

list<string>

flags

;

1385

TFlagMap::const_iterator it;

1386  if

((it = flagmap.find(*flag)) != flagmap.end()) {

1387

new_flags |= it->second;

1388

}

else if

((*flag)[0] ==

'!' 1389

&& ((it = flagmap.find(flag->substr(1)))

1390

!= flagmap.end())) {

1391

new_flags &= ~(it->second);

1392

}

else if

(*flag ==

"default"

) {

1393

new_flags |= defaults;

1448  const char

*

const

* argv)

1453  if

(argc != 2 || !argv[1]) {

1479  string

checksum, content;

1488  CRStream

cache_reader(reader.get());

1491

}

catch

(

const

exception& ex) {

1492  ERR_POST_X

(5,

"Couldn't read cached request : "

<< ex.what());

1500  string

checksum, content;

1508  CWStream

cache_writer(writer.get());

1511

}

catch

(

const

exception& ex) {

1512  ERR_POST_X

(6,

"Couldn't cache request : "

<< ex.what());

1522

unique_ptr<IWriter> writer( cache.

GetWriteStream

(rid, 0,

"NS_JID"

) );

1524  CWStream

cache_stream(writer.get());

1527

}

catch

(

const

exception& ex) {

1528  ERR_POST_X

(7,

"Couldn't save request : "

<< ex.what());

1538

unique_ptr<IReader> reader(cache.

GetReadStream

(rid, 0,

"NS_JID"

));

1540  CRStream

cache_stream(reader.get());

1541

unique_ptr<CCgiRequest> request(

new CCgiRequest

);

1542

request->Deserialize(cache_stream, 0);

1543  return

request.release();

1545

}

catch

(

const

exception& ex) {

1546  ERR_POST_X

(8,

"Couldn't read saved request : "

<< ex.what());

1556  string

cookie_name =

GetConfig

().

Get

(

"CGI-LB"

,

"Name"

);

1557  if

( cookie_name.empty() )

1560  int

life_span = reg.

GetInt

(

"CGI-LB"

,

"LifeSpan"

, 0, 0,

1563  string

domain = reg.

GetString

(

"CGI-LB"

,

"Domain"

,

".ncbi.nlm.nih.gov"

);

1565  if

( domain.empty() ) {

1566  ERR_POST_X

(9,

"CGI-LB: 'Domain' not specified."

);

1568  if

(domain[0] !=

'.'

) {

1569

domain.insert(0,

"."

);

1573  string

path = reg.

Get

(

"CGI-LB"

,

"Path"

);

1575  bool

secure = reg.

GetBool

(

"CGI-LB"

,

"Secure"

,

false

,

1588

host = reg.

Get

(

"CGI-LB"

,

"Host"

);

1589  if

( host.empty() ) {

1590  if

(

m_Caf

.get() ) {

1591  char

host_ip[64] = {0,};

1592  m_Caf

->GetHostIP(host_ip,

sizeof

(host_ip));

1597  ERR_POST_X

(10,

"CGI-LB: 'Host' not specified."

);

1603  CCgiCookie

cookie(cookie_name, host, domain, path);

1604  if

(life_span > 0) {

1610

cookies.

Add

(cookie);

1622  string

x_moz =

context

.GetRequest().GetRandomProperty(

"X_MOZ"

);

1625  "Prefetch is not allowed for CGIs"

);

1653  string

log_path =

"/log/"

;

1660  size_t

min_pos = exe_path.length();

1664  if

(!it->empty() && (*it)[0] !=

'/'

) {

1666  string mask

=

"/"

+ *it;

1667  if

(

mask

[

mask

.length() - 1] !=

'/'

) {

1670  size_t

pos = exe_path.find(

mask

);

1671  if

(pos < min_pos) {

1678  if

(exe_path.substr(0, it->length()) == *it) {

1684  if

( !web_dir.empty() ) {

1688  const char

* port = ::getenv(

"SERVER_PORT"

);

1689  return

port ? log_path +

string

(port) : log_path +

"srv"

;

1720  bool

this_wc =

m_Type

==

"*"

;

1721  bool

other_wc = entry.

m_Type

==

"*"

;

1722  if

(this_wc != other_wc)

return

!this_wc;

1726  if

(this_wc != other_wc)

return

!this_wc;

1756  if

(!TEnableHelpRequest::GetDefault())

return false

;

1759  bool

found =

false

;

1761  if

( !found )

return false

;

1798  bool

use_alt_name =

false

;

1799  string

vparam = TEnableVersionRequest::GetDefault();

1800  if

( vparam.empty() )

return false

;

1803  if

(!is_enabled)

return false

;

1806

use_alt_name =

true

;

1810  bool

found =

false

;

1811  if

( use_alt_name ) {

1812

ver_type = request.

GetEntry

(vparam, &found);

1815

ver_type = request.

GetEntry

(

"ncbi_version"

, &found);

1817  if

( !found )

return false

;

1820  if

(ver_type.empty() || ver_type ==

"short"

) {

1823  else if

(ver_type ==

"full"

) {

1828  "Unsupported ncbi_version argument value"

);

1845  bool

found =

false

;

1846  string

cmd_name = request.

GetEntry

(

"ncbi_admin_cmd"

, &found);

1852  if

( path_info.empty() )

return false

;

1853

cmd_name = path_info;

1886

CGI_VALIDATE_CSRF_TOKEN);

1900  const char

* p = getenv(

"FCGI_STANDALONE_SERVER"

);

1904

path =

GetConfig

().

Get

(

"FastCGI"

,

"StandaloneServer"

);

1920  if

(x_iterations > 0) {

1921

ret = (

unsigned int

) x_iterations;

1923  ERR_POST_X

(6,

"CCgiApplication::x_RunFastCGI: invalid " 1924  "[FastCGI].Iterations config.parameter value: " 1932  if

(iterations_rnd_inc > 0) {

1935

ret +=

r

.GetRand(0, iterations_rnd_inc);

1938  _TRACE

(

"CCgiApplication::Run: FastCGI limited to " 1939

<< ret <<

" iterations"

);

1946  return GetConfig

().

GetBool

(

"FastCGI"

,

"Complete_Request_On_Sigterm"

,

false

);

1952  const string

& orig_filename =

GetConfig

().

Get

(

"FastCGI"

,

"WatchFile.Name"

);

1953  if

( !orig_filename.empty() ) {

1956  if

(filename != orig_filename) {

1957  _TRACE

(

"Adjusted relative CGI watch file name "

<< orig_filename

1958

<<

" to "

<< filename);

1960  int

limit =

GetConfig

().

GetInt

(

"FastCGI"

,

"WatchFile.Limit"

, -1, 0,

1975  if

( have_watcher ) {

1976  ERR_POST_X

(7,

"CCgiApplication::x_RunFastCGI: non-positive " 1977  "[FastCGI].WatchFile.Timeout conf.param. value ignored: "

<< ret);

1981  return

(

unsigned int

) ret;

1988  if

(ret <= 0)

return

0;

1992  double r

= rand() / (RAND_MAX + 1.0);

1993  return

1 + (

int

)(ret *

r

);

2022  const int

kDefaultMaxThreads = 8;

2024  if

(ret <= 0) ret = kDefaultMaxThreads;

2025  return

(

unsigned int

)ret;

2032  if

( !

CDirEntry

(filename).GetTime(&mtime) ) {

2034  "Cannot get modification time of the CGI executable " 2049  ERR_POST

(

"Could not check self memory usage"

);

2051  else if

(memory_usage.

total

> limit) {

2053  ") is above the configured limit ("

<<

2070  if

(restart_reason !=

eSR_None

)

return

restart_reason;

2075  if

( mtimeNew != mtime) {

2076  _TRACE

(

"CCgiApplication::x_RunFastCGI: " 2077  "the program modification date has changed"

);

2079

}

else if

( watcher && watcher->

HasChanged

()) {

2083  "Scheduling restart of Fast-CGI, as its watch file has changed"

);

2088  if

(restart_time->IsEmpty()) {

2090

restart_time->SetCurrent();

2091

restart_time->AddSecond(delay);

2092  _TRACE

(

"Will restart Fast-CGI in "

<< delay <<

" seconds, at " 2093

<< restart_time->GetLocalTime().AsString(

"h:m:s"

));

2096  return

restart_reason;

2119

: m_CgiApp(cgi_app), m_LogDelim(

";"

)

2131  const

std::exception* ex)

2146  TSeconds

time_cutoff = reg.

GetInt

(

"CGI"

,

"TimeStatCutOff"

, 0, 0,

2148  if

(time_cutoff > 0) {

2150  if

(diff < time_cutoff) {

2155  string msg

, tmp_str;

2158  if

( !tmp_str.empty() ) {

2159  msg

.append(tmp_str);

2164  if

( !tmp_str.empty() ) {

2165  msg

.append(tmp_str);

2173  if

( !tmp_str.empty() ) {

2174  msg

.append(tmp_str);

2180  if

( !tmp_str.empty() ) {

2181  msg

.append(tmp_str);

2185  if

( !tmp_str.empty() ) {

2186  msg

.append(tmp_str);

2224  string

log_args = reg.

Get

(

"CGI"

,

"LogArgs"

);

2225  if

( log_args.empty() )

2234  bool

is_entry_found;

2235  const string

& arg = *

i

;

2237  size_t

pos = arg.find_last_of(

'='

);

2240

}

else if

(pos != string::npos) {

2241  string key

= arg.substr(0, pos);

2243  if

( is_entry_found ) {

2244  string

alias = arg.

substr

(pos+1, arg.length());

2246  msg

.append(

"='"

);

2253  if

( is_entry_found ) {

2255  msg

.append(

"='"

);

2287  return

(

int

)

in

.gcount();

2294

: m_Filename(filename), m_Limit(limit), m_Buf(new char[limit])

2298  ERR_POST_X

(2,

"Failed to open CGI watch file "

<< filename);

2344  string

content_type;

2346  if

( !

format

.empty() ) {

2347  string

fname_fmt = base_name +

".help."

+

format

;

2348  if

(

CFile

(fname_fmt).Exists() ) {

2353

fname_fmt =

"help."

+

format

;

2354  if

(

CFile

(fname_fmt).Exists() ) {

2363  if

( fname.empty() ) {

2367  string

fname_accept = base_name +

".help."

+ it->m_Subtype + it->m_MediaRangeParams;

2368  if

(

CFile

(fname_accept).Exists() ) {

2369

fname = fname_accept;

2370

content_type = it->m_Type +

"/"

+ it->m_Subtype;

2374  if

( fname.empty() ) {

2376  string

fname_accept =

"help."

+ it->m_Subtype + it->m_MediaRangeParams;

2377  if

(

CFile

(fname_accept).Exists() ) {

2378

fname = fname_accept;

2379

content_type = it->m_Type +

"/"

+ it->m_Subtype;

2387  if

( fname.empty() ) {

2389  string

fname_std = base_name +

".help."

+

kStdFormats

[

i

];

2397  if

( fname.empty() ) {

2400  if

(

CFile

(fname_std).Exists() ) {

2409  if

( !fname.empty() ) {

2413  bool

ct_found =

false

;

2419  if

( eol.empty() ) {

2428  if

( !content_type.empty()) {

2444  "Can not find help for CGI application"

);

2452  string format

=

"plain"

;

2453  string

content_type =

"text/plain"

;

2457  if

(it->m_Subtype ==

"xml"

|| it->m_Subtype ==

"json"

||

2458

(it->m_Type ==

"text"

&& it->m_Subtype ==

"plain"

)) {

2460

content_type = it->m_Type +

"/"

+ it->m_Subtype;

2469  if

(

format

==

"plain"

) {

2479  else if

(

format

==

"xml"

) {

2489  else if

(

format

==

"json"

) {

2501  "Unsupported version format"

);

2528  if

(!TParamValidateCSRFToken::GetDefault())

return true

;

2538  if

( !ref.empty() ) {

2540  if

( !args.empty() ) ref +=

"?"

+ args;

2548

CGI_EXCEPTION_MESSAGE);

2555  string

status_str =

"500 Server Error"

;

2556  string

message =

""

;

2565

message = ce->

GetMsg

();

2579

status_str =

"400 Malformed HTTP Request"

;

2593  string

expt_msg = TExceptionMessage::GetDefault();

2594  if

( !expt_msg.empty() ) {

2600

os <<

"Status: "

<< status_str <<

HTTP_EOL

;

2617  ERR_POST_X

(4,

"CCgiApplication::OnException() failed to send error page" 2618  " back to the client"

);

2622  catch

(

const

exception& ex) {

2638  m_Context

->GetResponse().SetStatus(status, reason);

2662  if

(accept.empty())

return

;

2663

list<string>

types

;

2668  if

( parts.empty() )

continue

;

2674

list<string>::const_iterator ext_it = parts.begin();

2676  bool

aparams =

false

;

2677  while

(ext_it != parts.end()) {

2678  string

name,

value

;

2684  if

(entry.

m_Quality

== 0 && errno != 0) {

ncbi::TMaskedQueryRegions mask

cache (ICache) external reference using hash key(CRC32, MD5)

Exception classes used by the NCBI CGI framework.

NCBI_PARAM_DEF_EX(bool, CGI, Print_Http_Referer, true, eParam_NoThread, CGI_PRINT_HTTP_REFERER)

const char * kWebDirToPort

NCBI_PARAM_ENUM_DEF_EX(EDiagSev, CGI, Client_Connection_Interruption_Severity, eDiag_Error, eParam_NoThread, CGI_CLIENT_CONNECTION_INTERRUPTION_SEVERITY)

const char * kToolkitRcPath

typedef NCBI_PARAM_TYPE(CGI, Print_Http_Referer) TPrintRefererParam

DEFINE_STATIC_FAST_MUTEX(s_RestartReasonMutex)

static const char * kStdFormats[]

NCBI_PARAM_ENUM_ARRAY(EDiagSev, CGI, Client_Connection_Interruption_Severity)

NCBI_PARAM_DEF(bool, CGI, DisableTrackingCookie, false)

string FindContentType(CTempString format)

static void s_CleanupProcessor(CCgiRequestProcessor *processor, void *)

static const char * kStdContentTypes[]

NCBI_PARAM_DECL(bool, CGI, Print_Http_Referer)

static const char * kCSRFTokenName

CAsBodyDiagFactory(CCgiApplication *app)

virtual CDiagHandler * New(const string &)

Factory method interface.

virtual ERW_Result Read(void *buf, size_t count, size_t *bytes_read=0)

Read as many as "count" bytes into a buffer pointed to by the "buf" argument.

virtual ERW_Result PendingCount(size_t *)

Via parameter "count" (which is guaranteed to be supplied non-NULL) return the number of bytes that a...

CCGIStreamReader(istream &is)

bool GetHashedContent(const string &hash_str, const string &hashed_content, string *ref_value)

Get hashed content Method compares both hash value and hashed content.

void StoreHashedContent(const string &hash_str, const string &hashed_content, const string &ref_value)

Store hashed content.

CCgiRequestException –.

Base class for request processors.

void FinishChunkedTransfer(const CCgiStreamWrapper::TTrailer *trailer)

void SetCacheStream(CNcbiOstream &stream)

virtual ERW_Result Write(const void *buf, size_t count, size_t *bytes_written=0)

Write up to "count" bytes from the buffer pointed to by the "buf" argument onto the output device.

CCgiStreamWrapper::EStreamMode GetMode(void) const

bool m_UsedChunkedTransfer

void x_WriteChunk(const char *buf, size_t count)

CCgiStreamWrapper::EStreamMode m_Mode

virtual ~CCgiStreamWrapperWriter(void)

void AbortChunkedTransfer(void)

void x_SetChunkSize(size_t sz)

void SetMode(CCgiStreamWrapper::EStreamMode mode)

virtual ERW_Result Flush(void)

Flush pending data (if any) down to the output device.

CCgiStreamWrapperWriter(CNcbiOstream &out)

IWriter which can write simultaneously to the different streams.

static CNcbiApplication * Instance(void)

Singleton method.

Note about the "buf_size" parameter for streams in this API.

Reader-writer-based stream buffer.

@ fOwnReader

Own the underlying reader.

@ fOwnWriter

Own the underlying writer.

T & Get(void)

Create the variable if not created yet, return the reference.

virtual CDiagHandler * New(const string &)

Factory method interface.

CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...

Writer-based output stream.

BLOB cache read/write/maintenance interface.

virtual IWriter * GetWriteStream(const string &key, TBlobVersion version, const string &subkey, unsigned int time_to_live=0, const string &owner=kEmptyStr)=0

Return sequential stream interface to write BLOB data.

virtual IReader * GetReadStream(const string &key, TBlobVersion version, const string &subkey)=0

Return sequential stream interface to read BLOB data.

A very basic data-read interface.

A very basic data-write interface.

container_type::const_iterator const_iterator

const_iterator end() const

const_iterator find(const key_type &key) const

void Print(const CCompactSAMApplication::AlignInfo &ai)

std::ofstream out("events_result.xml")

main entry point for tests

static const struct name_t names[]

static const char * str(char *buf, int n)

static const struct type types[]

static string GetAppName(EAppNameType name_type=eBaseName, int argc=0, const char *const *argv=NULL)

const CNcbiEnvironment & GetEnvironment(void) const

Get the application's cached environment.

const string & GetProgramExecutablePath(EFollowLinks follow_links=eIgnoreLinks) const

Get the application's executable path.

virtual void Init(void)

Initialize the application.

const CNcbiRegistry & GetConfig(void) const

Get the application's cached configuration parameters (read-only).

virtual const CArgs & GetArgs(void) const

Get parsed command line arguments.

CVersionInfo GetVersion(void) const

Get the program version information.

virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)

Setup the command line argument descriptions.

EPreparseArgs

Result of PreparseArgs()

#define ITERATE(Type, Var, Cont)

ITERATE macro to sequence through container elements.

void SetStdioFlags(TStdioSetupFlags stdio_flags)

Adjust the behavior of standard I/O streams.

const CArgDescriptions * GetArgDescriptions(void) const

Get argument descriptions (set by SetupArgDescriptions)

element_type * get(void) const

Get pointer.

virtual void Exit(void)

Cleanup on application exit.

const string & GetProgramDisplayName(void) const

Get the application's "display" name.

void DisableArgDescriptions(TDisableArgDesc disable=fDisableStdArgs)

CNcbiRegistry & GetRWConfig(void)

Get the application's cached configuration parameters, accessible for read-write for an application's...

const CVersionAPI & GetFullVersion(void) const

Get the program version information.

const CNcbiArguments & GetArguments(void) const

Get the application's cached unprocessed command-line arguments.

@ fBinaryCout

treat standard output as binary

@ fBinaryCin

treat standard input as binary

@ ePreparse_Exit

Exit the application with zero exit code.

@ ePreparse_Continue

Continue application execution.

virtual string & PrintUsage(string &str, bool detailed=false) const

Print usage message to end of specified string.

virtual void PrintUsageXml(CNcbiOstream &out) const

Print argument description in XML format.

CArgs & Assign(const CArgs &other)

Copy contents of another object into this one.

void SetArgsType(EArgSetType args_type)

Set type of argument description (cmdline vs CGI).

void ConvertKeys(CArgs *args, const T &arg_map, bool update) const

Convert argument map (key-value pairs) into arguments in accordance with the argument descriptions.

@ eCgiArgs

CGI application.

void x_InitArgs(void) const

void SetHTTPStatus(unsigned int status, const string &reason=kEmptyStr)

virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)

Setup the command line argument descriptions.

EAdminCommand

Admin commands passed through ncbi_admin_cmd argument.

virtual string Compose_Entries(void)

virtual void Init(void)

This method is called on the CGI application initialization – before starting to process a HTTP reque...

virtual int OnException(std::exception &e, CNcbiOstream &os)

This method is called if an exception is thrown during the processing of HTTP request.

unsigned int GetFastCGIWatchFileTimeout(bool have_watcher) const

bool GetRequestStartPrinted(void) const

virtual string Compose_ErrMessage(void)

const CCgiResponse & GetResponse(void) const

virtual ~CCgiStatistics()

void SetOutputBroken(bool val)

const CCgiContext & GetContext(void) const

Get current server context. Throw exception if the context is not set.

void SetRequestStartPrinted(bool val)

bool GetFastCGIComplete_Request_On_Sigterm(void) const

bool CheckMemoryLimit(void)

virtual string Compose_Result(void)

CCgiStatistics(CCgiApplication &cgi_app)

virtual bool x_RunFastCGI(int *result, unsigned int def_iter=10)

void SetErrorStatus(bool val)

const CCgiRequest & GetRequest(void) const

unsigned int GetFastCGIIterations(unsigned int def_iter) const

shared_ptr< CCgiContext > m_Context

CCgiStreamWrapperWriter * m_Writer

bool GetOutputBroken(void) const

unsigned int GetFastCGIMTMaxThreads(void) const

void AbortChunkedTransfer(void)

friend class CCgiRequestProcessor

CDiagFactory * FindDiagFactory(const string &key)

CAtomicCounter m_Iteration

virtual void ProcessVersionRequest(CCgiApplication::EVersionType ver_type)

virtual void ConfigureDiagFormat(CCgiContext &context)

int GetFastCGIWatchFileRestartDelay(void) const

CCgiApplication(const SBuildInfo &build_info=NCBI_SBUILDINFO_DEFAULT())

virtual CCgiRequestProcessor * CreateRequestProcessor(void)

Create request processor to process the request.

virtual void ConfigureDiagnostics(CCgiContext &context)

virtual int ProcessRequest(CCgiContext &context)

Process request provided by the context. By default calls application's ProcessRequest.

static CTime GetFileModificationTime(const string &filename)

string m_MediaRangeParams

Media range parameters.

int m_RequestFlags

Bit flags for CCgiRequest.

CCgiRequestProcessor & x_GetProcessor(void) const

bool ProcessAdminRequest_Base(CCgiApplication::EAdminCommand cmd)

virtual void Exit(void)

This method is called on the CGI application exit.

virtual ~CCgiRequestProcessor(void)

virtual void ConfigureDiagDestination(CCgiContext &context)

bool x_IsSetProcessor(void) const

virtual ICgiSessionStorage * GetSessionStorage(CCgiSessionParameters &params) const

Get instance of CGI session storage interface.

virtual EPreparseArgs PreparseArgs(int argc, const char *const *argv)

Check the command line arguments before parsing them.

virtual bool ProcessAdminRequest(CCgiApplication::EAdminCommand cmd)

bool GetFastCGIStatLog(void) const

void RegisterDiagFactory(const string &key, CDiagFactory *fact)

CCgiApplication::SAcceptEntry TAcceptEntry

void SetInputStream(CNcbiIstream *in)

unique_ptr< CNcbiResource > m_Resource

CCgiWatchFile(const string &filename, int limit=1024)

void SetCacheStream(CNcbiOstream &stream)

CNcbiResource & x_GetResource(void) const

virtual const CArgs & GetArgs(void) const

Get parsed command line arguments extended with CGI parameters.

bool GetFastCGIStopIfFailed(void) const

static bool ProcessCORSRequest(const CCgiRequest &request, CCgiResponse &response)

Process cross-origin resource sharing (CORS) request.

bool x_ProcessHelpRequest(CCgiRequestProcessor &processor)

virtual void OnEvent(EEvent event, int status)

This method is called after each request, or when the CGI is forced to skip a request,...

CNcbiOstream & GetOutputStream(void)

virtual void OnEvent(CCgiApplication::EEvent event, int status)

virtual void ProcessHelpRequest(const string &format)

float m_Quality

Quality factor or "1" if not set (or not numeric).

virtual void Reset(const CTime &start_time, int result, const std::exception *ex=0)

bool GetErrorStatus(void) const

EStreamMode GetWriterMode(void)

virtual void ConfigureDiagThreshold(CCgiContext &context)

string GetFastCGIStandaloneServer(void) const

static ERestartReason ShouldRestart(CTime &mtime, CCgiWatchFile *watcher, int delay)

virtual bool ProcessAdminRequest(EAdminCommand cmd)

Process admin command passed through ncbi_admin_cmd argument.

bool operator<(const SAcceptEntry &entry) const

CCgiContext & x_GetContext(void) const

void SetRequestId(const string &rid, bool is_done)

void SetHTTPStatus(unsigned int status, const string &reason=kEmptyStr)

Set HTTP status code in the current request context and in the current CHttpResponse if one exists.

bool x_ProcessAdminRequest(CCgiRequestProcessor &processor)

virtual void AppStart(void)

Prepare properties and print the application start message.

virtual CCgiContext * CreateContext(CNcbiArguments *args=0, CNcbiEnvironment *env=0, CNcbiIstream *inp=0, CNcbiOstream *out=0, int ifd=-1, int ofd=-1)

Factory method for the Context object construction.

void x_OnEvent(CCgiRequestProcessor *pprocessor, EEvent event, int status)

bool x_DoneHeadRequest(CCgiContext &context) const

void ParseAcceptHeader(TAcceptEntries &entries) const

virtual ICache * GetCacheStorage(void) const

unique_ptr< CCookieAffinity > m_Caf

virtual string Compose(void)

CCgiApplication::TAcceptEntries TAcceptEntries

virtual int OnException(std::exception &e, CNcbiOstream &os)

virtual string Compose_ProgramName(void)

void SetWriterMode(EStreamMode mode)

bool IsSetOutputStream(void) const

virtual int Run(void)

Do not override this method yourself! – it includes all the CGI specific machinery.

ELogOpt GetLogOpt(void) const

virtual bool ValidateSynchronizationToken(void)

string GetRID(void) const

TDiagFactoryMap m_DiagFactories

ELogOpt

Analyze registry settings ([CGI] Log) and return current logging option.

virtual bool ValidateSynchronizationToken(void)

Validate synchronization token (cross-site request forgery prevention).

virtual bool IsCachingNeeded(const CCgiRequest &request) const

friend class CCgiStatistics

virtual void Submit(const string &message)

virtual CCgiStatistics * CreateStat()

Class factory for statistics class.

void SetRequestId(const string &rid, bool is_done)

virtual void ProcessHelpRequest(const string &format)

Process help request: set content type, print usage informations etc.

virtual CNcbiResource * LoadResource(void)

virtual string Compose_Timing(const CTime &end_time)

void SaveResultToCache(const CCgiRequest &request, CNcbiIstream &is, ICache &cache)

bool x_ProcessVersionRequest(CCgiRequestProcessor &processor)

bool IsSetInputStream(void) const

void InitArgs(CArgs &args, CCgiContext &context) const

void SetContext(shared_ptr< CCgiContext > context)

CCgiApplication & m_CgiApp

void SaveRequest(const string &rid, const CCgiRequest &request, ICache &cache)

CCgiRequestProcessor * x_GetProcessorOrNull(void) const

void SetOutputStream(CNcbiOstream *out)

bool IsSetContext(void) const

virtual CCgiServerContext * LoadServerContext(CCgiContext &context)

static CCgiApplication * Instance(void)

Singleton.

virtual void ProcessVersionRequest(EVersionType ver_type)

Process version request: set content type, print version informations etc.

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 ...

CCgiContext & GetContext(void)

CCgiRequestProcessor & x_CreateProcessor(void)

CCgiRequest * GetSavedRequest(const string &rid, ICache &cache)

string GetSelfReferer(void) const

Get self-URL to be used as referer.

CCgiRequestProcessor(CCgiApplication &app)

list< SAcceptEntry > TAcceptEntries

CRef< CTls< CCgiRequestProcessor > > m_Processor

CCgiContext * CreateContextWithFlags_Default(CCgiRequestProcessor &processor, CNcbiArguments *args, CNcbiEnvironment *env, CNcbiIstream *inp, CNcbiOstream *out, int ifd, int ofd, int flags)

Default implementation of CreateContextWithFlags.

Client_Connection_Interruption_Okay

virtual int ProcessRequest(CCgiContext &context)=0

This is the method you should override.

void ParseAcceptHeader(TAcceptEntries &entries) const

Parse "Accept:" header, put entries to the list, more specific first.

void SetCafService(CCookieAffinity *caf)

Attach cookie affinity service interface.

bool GetFastCGIDebug(void) const

CCgiWatchFile * CreateFastCGIWatchFile(void) const

unique_ptr< CArgs > m_CgiArgs

CCgiStreamWrapper(CNcbiOstream &out)

Client_Connection_Interruption_Severity

virtual string GetDefaultLogPath(void) const

Get default path for the log files.

CNcbiIstream & GetInputStream(void)

bool GetResultReady(void) const

bool GetResultFromCache(const CCgiRequest &request, CNcbiOstream &os, ICache &cache)

virtual void AppStop(int exit_code)

Prepare properties for application stop message.

void LogRequest(void) const

bool GetFastCGIHonorExitRequest(void) const

TParams m_AcceptParams

Accept parameters.

void VerifyCgiContext(CCgiContext &context)

Check CGI context for possible problems, throw exception with HTTP status set if something is wrong.

void FinishChunkedTransfer(const TTrailer *trailer)

const string & GetSelfURL(ESelfUrlPort) const

Using HTTP environment variables, compose the CGI's own URL as: SCHEME://SERVER_NAME[:SERVER_PORT]/SC...

bool GetFastCGIChannelErrors(void) const

void AddLBCookie(CCgiCookies &cookies)

void ProcessHttpReferer(void)

Set CONN_HTTP_REFERER, print self-URL and referer to log.

@ eAdmin_HealthZ

Report health for this CGI as kubernetes expects.

@ eAdmin_Health

Report health for this CGI only.

@ eAdmin_Unknown

Unrecognized command.

@ eAdmin_HealthDeep

Report health for this CGI and any services used by it.

@ eAdmin_LiveZ

Report if this CGI is alive as kubernetes expects.

@ eAdmin_ReadyZ

Report readyness for this CGI as kubernetes expects.

@ eException

An exception occured during the request processing.

@ eExitRequest

FCGI forced to exit by client's 'exitfastcgi' request.

@ eExit

No more iterations, exiting (called the very last)

@ eWaiting

Periodic awakening while waiting for the next request.

@ eError

The HTTP request was processed, non-zero exit code.

@ eEndRequest

HTTP request processed, all results sent to client.

@ eExecutable

FCGI forced to exit as its modif. time has changed.

@ eWatchFile

FCGI forced to exit as its "watch file" has changed.

@ eExitOnFail

[FastCGI].StopIfFailed set, and the iteration failed

@ eSuccess

The HTTP request was processed, with zero exit code.

#define NCBI_CGI_THROW_WITH_STATUS(exception, err_code, message, status)

EStatusCode GetStatusCode(void) const

static string GetStdStatusMessage(EStatusCode code)

string GetStatusMessage(void) const

@ eStatusNotSet

Internal value - code not set.

bool HaveContentRange(void) const

Check if 'Content-Range' header is set.

void SetSecure(bool secure)

bool CalcChecksum(string &checksum, string &content) const

SIZE_TYPE find(const char *s, SIZE_TYPE pos=0) const

CCgiCookie * Find(const string &name, const string &domain, const string &path)

Return NULL if cannot find this exact cookie.

void Serialize(CNcbiOstream &os) const

Serialize/Deserialize a request to/from a stream.

void GetCGIEntries(CEntryCollector_Base &collector) const

Get full set of arguments (both GET and POST), URL-encoded.

CNcbiOstream & out(void) const

Get output stream. Throw exception if GetOutput() is NULL.

const string & GetValue() const

Get the value as a string, (necessarily) prefetching it all if applicable; the result remains availab...

void SetExpTime(const CTime &exp_time)

const CCgiCookies & GetCookies(void) const

Retrieve the request cookies.

static bool x_ClientSupportsChunkedTransfer(const CNcbiEnvironment &env)

string substr(SIZE_TYPE i=0, SIZE_TYPE n=NPOS) const

void SetOutput(CNcbiOstream *os, int fd=-1)

Set output stream (NULL here means "no output stream").

const string & GetProperty(ECgiProp prop) const

Get value of a "standard" property (return empty string if not defined)

CDiagContext_Extra::TExtraArgs & GetArgs(void)

const string & GetTrackingCookie(void) const

CCgiCookie * Add(const string &name, const string &value, const string &domain=kEmptyStr, const string &path=kEmptyStr, EOnBadCookie on_bad_cookie=eOnBadCookie_SkipAndError)

All Add() functions: if the added cookie has the same {name, domain, path} as an already existing one...

static size_t GetChunkSize(void)

bool IsHeaderWritten() const

bool AcceptRangesBytes(void) const

Check if 'Accept-Ranges' header is set to 'bytes'.

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.

const CCgiEntry & GetEntry(const string &name, bool *is_found=0) const

Get entry value by name.

static const string GetPropertyName(ECgiProp prop)

Get name (not value!) of a "standard" property.

CNcbiOstream * GetOutput(void) const

Get output stream (NULL here means "no output stream").

ERequestMethod GetRequestMethod(void) const

Get request method.

void Set(TValue new_value) THROWS_NONE

Set atomic counter value.

virtual CDiagHandler * New(const string &s)=0

Factory method interface.

void PushDiagPostPrefix(const char *prefix)

Push a string to the list of message prefixes.

void PrintRequestStop(void)

Print request stop message (for request-driven applications)

CDiagContext_Extra & Print(const string &name, const string &value)

The method does not print the argument, but adds it to the string.

void SetBytesWr(Int8 bytes)

void SetDiagPostFlag(EDiagPostFlag flag)

Set the specified flag (globally).

#define LOG_POST_X(err_subcode, message)

static bool IsSetOldPostFormat(void)

Check old/new format flag (for compatibility only)

void PrintStart(const string &message)

Print start/stop etc.

CDiagContext & GetDiagContext(void)

Get diag context instance.

void SetTracerSpanKind(ITracerSpan::ESpanKind kind)

At least Opentememetry tracer allows to set span kind only at span creation time.

void SetAppState(EDiagAppState state)

Set application state.

void PrintRequestStart(const string &message)

Print request start message (for request-driven applications)

CDiagContext_Extra Extra(void) const

Create a temporary CDiagContext_Extra object.

int TDiagPostFlags

Binary OR of "EDiagPostFlag".

void SetProperty(const string &name, const string &value)

Add/change property.

shared_ptr< ITracerSpan > GetTracerSpan(void) const

static CRequestContext & GetRequestContext(void)

Shortcut to CDiagContextThreadData::GetThreadData().GetRequestContext()

void SetRequestStatus(int status)

EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)

Set the threshold severity for posting the messages.

void SetExitCode(int exit_code)

Set exit code.

#define ERR_POST_X(err_subcode, message)

Error posting with default error code and given error subcode.

void Flush(void)

Print the message and reset object.

void SetBytesRd(Int8 bytes)

#define ERR_POST(message)

Error posting with file, line number information but without error codes.

void SetDiagHandler(CDiagHandler *handler, bool can_delete=true)

Set the diagnostic handler using the specified diagnostic handler class.

void Reset(void)

Reset all properties to the initial state.

void SetDiagTrace(EDiagTrace how, EDiagTrace dflt=eDT_Default)

Set the diagnostic trace settings.

EDiagSev

Severity level for the posted diagnostics.

TDiagPostFlags SetDiagPostAllFlags(TDiagPostFlags flags)

Set global post flags to "flags".

void SetDiagTraceFlag(EDiagPostFlag flag)

@ eDPF_Location

Include class and function if any.

@ eDPF_MergeLines

Escape EOLs.

@ eDPF_DateTime

Include date and time.

@ eDPF_ErrorID

Error code and subcode (default)

@ eDPF_Log

Print the posted message only; without severity, location, prefix, etc.

@ eDPF_Severity

Severity (default)

@ eDPF_OmitInfoSev

No sev. indication if eDiag_Info.

@ eDPF_Trace

Default flags to use when tracing.

@ eDPF_File

File name (not full path)

@ eDPF_LongFilename

Full file path.

@ eDPF_Prefix

Prefix (default)

@ eDPF_All

All flags (except for the "unusual" ones!)

@ eDT_Enable

Enable messages of severity "eDiag_Trace".

@ eDiagAppState_RequestEnd

RE.

@ eDiagAppState_RequestBegin

RB.

@ eDiagAppState_Request

R.

@ eDiag_Trace

Trace message.

@ eDiag_Info

Informational message.

@ eDiag_Error

Error message.

@ eDiag_Warning

Warning message.

@ eDiag_Fatal

Fatal error – guarantees exit(or abort)

@ eDiag_Critical

Critical error message.

@ e299_PartialContentBrokenConnection

Non-standard status code - used to indicate broken connection while serving partial-content request.

@ e499_BrokenConnection

Non-standard status code - used to indicate broken connection while serving normal request.

const string & Get(const string &name, bool *found=NULL) const

Get environment value by name.

void Enumerate(list< string > &names, const string &prefix=kEmptyStr) const

Find all variable names starting with an optional prefix.

const string & GetProgramName(EFollowLinks follow_links=eIgnoreLinks) const

Get program name.

#define NCBI_EXCEPTION_VAR(name, exception_class, err_code, message)

Create an instance of the exception to be thrown later.

#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)

#define NCBI_EXCEPTION_THROW(exception_var)

Throw an existing exception object.

#define NCBI_REPORT_EXCEPTION_X(err_subcode, title, ex)

Generate a report on the exception with default error code and given subcode.

static string CreateAbsolutePath(const string &path, ERelativeToWhat rtw=eRelativeToCwd)

Get an absolute path from some, possibly relative, path.

virtual bool Exists(void) const

Check existence of file.

@ eRelativeToExe

Relative to the executable's location.

@ eParam_NoThread

Do not use per-thread values.

uint64_t Uint8

8-byte (64-bit) unsigned integer

static TPid GetPid(void)

Get process identifier (pid) for the current process.

size_t total

Total memory usage.

static bool GetMemoryUsage(SMemoryUsage &usage)

Get current process memory usage.

virtual bool GetBool(const string &section, const string &name, bool default_value, TFlags flags=0, EErrAction err_action=eThrow) const

Get boolean value of specified parameter name.

virtual const string & Get(const string &section, const string &name, TFlags flags=0) const

Get the parameter value.

virtual int GetInt(const string &section, const string &name, int default_value, TFlags flags=0, EErrAction err_action=eThrow) const

Get integer value of specified parameter name.

virtual void EnumerateEntries(const string &section, list< string > *entries, TFlags flags=fAllLayers) const

Enumerate parameter names for a specified section.

virtual string GetString(const string &section, const string &name, const string &default_value, TFlags flags=0) const

Get the parameter string value.

bool Set(const string &section, const string &name, const string &value, TFlags flags=0, const string &comment=kEmptyStr)

Set the configuration parameter value.

@ eReturn

Return default value.

@ eErrPost

Log the error message and return default value.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

ERW_Result

Result codes for I/O operations.

Int8 NcbiStreamposToInt8(NCBI_NS_STD::char_traits< char >::pos_type stream_pos)

Convert stream position to 64-bit int.

IO_PREFIX::ostream CNcbiOstream

Portable alias for ostream.

IO_PREFIX::istream CNcbiIstream

Portable alias for istream.

static streamsize Readsome(CNcbiIstream &is, CT_CHAR_TYPE *buf, streamsize buf_size)

IO_PREFIX::ifstream CNcbiIfstream

Portable alias for ifstream.

bool NcbiStreamCopy(CNcbiOstream &os, CNcbiIstream &is)

Copy the entire contents of stream "is" to stream "os".

@ eRW_NotImplemented

Action / information is not available.

@ eRW_Eof

End of data, should be considered permanent.

@ eRW_Error

Unrecoverable error, no retry possible.

@ eRW_Success

Everything is okay, I/O completed.

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 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 int strcmp(const char *s1, const char *s2)

String compare.

const char * g_GetNcbiString(ENcbiStrings what)

static string HtmlEncode(const CTempString str, THtmlEncode flags=fHtmlEnc_EncodeAll)

Encode a string for HTML.

static Uint8 StringToUInt8_DataSize(const CTempString str, TStringToNumFlags flags=0)

Convert string that can contain "software" qualifiers to Uint8.

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.

bool AStrEquiv(const Arg1 &x, const Arg2 &y, Pred pr)

Check equivalence of arguments using predicate.

static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)

Check if a string starts with a specified prefix value.

static void TrimSuffixInPlace(string &str, const CTempString suffix, ECase use_case=eCase)

Trim suffix from a string (in-place)

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 bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)

Case-insensitive equality of a substring with another string.

static void TrimPrefixInPlace(string &str, const CTempString prefix, ECase use_case=eCase)

Trim prefix from a string (in-place)

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 & 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.

static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)

Truncate whitespace in a string.

static string & ToLower(string &str)

Convert string to lower case – string& version.

@ fConvErr_NoThrow

Do not throw an exception on error.

@ fSplit_MergeDelimiters

Merge adjacent delimiters.

@ eNocase

Case insensitive compare.

void Reset(void)

Reset thread local storage.

void SetValue(TValue *value, FCleanup cleanup=0, void *cleanup_data=0, ENativeThreadCleanup native=eSkipCleanup)

Set value.

TValue * GetValue(void) const

Get the pointer previously stored by SetValue().

Int8 TSeconds

Number of seconds.

CTime & AddSecond(TSeconds seconds=1, EDaylight adl=eDaylightDefault)

Add specified seconds.

string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const

Transform time to string.

CTime CurrentTime(CTime::ETimeZone tz=CTime::eLocal, CTime::ETimeZonePrecision tzp=CTime::eTZPrecisionDefault)

CTimeSpan DiffTimeSpan(const CTime &t) const

Difference in nanoseconds from specified time.

TSeconds DiffSecond(const CTime &t) const

Difference in seconds from specified time.

string AsString(const CTimeFormat &fmt=kEmptyStr) const

Transform time span to string.

@ eCurrent

Use current time. See also CCurrentTime.

@ eGmt

GMT (Greenwich Mean Time)

const TArgs & GetArgs(void) const

Get the const list of arguments.

virtual string Print(void) const

Print version information.

string Print(const string &appname, TPrintFlags flags=fPrintAll) const

Print version data, plain text.

string PrintXml(const string &appname, TPrintFlags flags=fPrintAll) const

Print version data, XML.

string PrintJson(const string &appname, TPrintFlags flags=fPrintAll) const

Print version data, JSON.

@ fPackageShort

Print package info, if available.

@ fVersionInfo

Print version info.

unsigned int

A callback function used to compare two keys in a database.

Definition of all error codes used in cgi (xcgi.lib).

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

const TYPE & Get(const CNamedParameterList *param)

const struct ncbi::grid::netcache::search::fields::KEY key

const GenericPointer< typename T::ValueType > T2 value

Static variables safety - create on demand, destroy on application termination.

String constants used in NCBI C/C++ toolkit.

void SuppressSystemMessageBox(TSuppressSystemMessageBox mode=fSuppress_Default)

Suppress popup messages on execution errors.

const char * s_ArgFullVersion

const char * s_ArgVersion

Defines unified interface to application:

#define GetProgramName

Avoid name clash with the NCBI C Toolkit.

std::istream & in(std::istream &in_, double &x_)

double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)

Defines CRequestContext class for NCBI C++ diagnostic API.

Reader-writer based streams.

static SLJIT_INLINE sljit_ins st(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)

Process memory usage information, in bytes.

This class allows to add build info (date and tag) to application version.

static CS_CONTEXT * context

static wxAcceleratorEntry entries[3]


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