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/ncbi__config_8cpp_source.html below:

NCBI C++ ToolKit: src/corelib/ncbi_config.cpp Source File

46 #define NCBI_USE_ERRCODE_X Corelib_Config 58 template

<

class

ResultSet>

59 void s_List2Set

(

const

list<string>& src, ResultSet* dst)

61  ITERATE

(list<string>, it, src) {

86  const string

& element_name,

87  const string

& element_value)

92  if

( existing_node ) {

93

existing_node->

GetValue

().value = element_value;

105

list<string> name_list;

106

list<TParamTree*> node_list;

110

tree_root->

FindNodes

(name_list, &node_list);

111  return

node_list.empty() ? 0 : *node_list.rbegin();

121

list<string> sub_list;

127  ITERATE

(TSubSet, sub_it, sub_set) {

129  size_t

pos = sub_it->rfind(

'/'

);

130  if

(pos == string::npos) {

131

sub_node->GetKey() = *sub_it;

134

sub_node->GetKey() = sub_it->substr(pos + 1, sub_it->length());

136

inc_sections[sub_node.get()].

insert

(*sub_it);

137

rm_sections.

insert

(*sub_it);

138

parent_node->

AddNode

(sub_node.release());

148  if

(node == parent) {

163  for

( ; sub_it != sub_end; ++sub_it) {

185

current = inc_sections.

find

(node);

188

current = inc_sections.

begin

();

189

node = current->first;

191  if

(current != inc_sections.

end

()) {

200

<< node->

GetKey

() <<

"->"

<< *inc_it);

206

inc_sections.

erase

(current);

211  for

( ; sub_it != sub_end; ++sub_it) {

233  if

( parent && !node.

GetValue

().value.empty() ) {

244  bool

started_section =

false

;

245  for

(

auto

iter =

tree

->SubNodeBegin(); iter !=

tree

->SubNodeEnd(); ++iter ) {

247  if

( node->IsLeaf() ) {

248  if

( !started_section ) {

249

cout <<

"["

<< section <<

"]\n"

;

250

started_section =

true

;

252

cout << node->GetKey() <<

"="

<< node->GetValue().value <<

"\n"

;

255  for

(

auto

iter =

tree

->SubNodeBegin(); iter !=

tree

->SubNodeEnd(); ++iter ) {

257  if

( !node->IsLeaf() ) {

258  x_Print

(node, section + (section.empty()?

""

:

"/"

) + node->GetKey());

267  const bool debug

= 0;

270

list<string> sections;

273

cout <<

"Sections:\n"

;

274  for

(

auto

& s : sections ) {

290  const string

& section_name = *name_it;

292  if

(section_name.find(

'/'

) == string::npos) {

294

node->GetKey() = section_name;

295

tree_root->AddNode(node_ptr = node.release());

297

list<string> sub_node_list;

303  bool

have_explicit_name =

false

;

309

cout <<

"Entries of "

<< section_name <<

":\n"

;

316  const string

& element_name = *eit;

317  const string

& element_value = reg.

Get

(section_name, element_name);

320

have_explicit_name =

true

;

323

list<string> inc_list;

324  NStr::Split

(element_value,

",; \t\n\r"

, inc_list,

326  s_List2Set

(inc_list, &inc_sections[node_ptr]);

338

cout <<

"["

<< section_name <<

"]: "

<<element_name<<

"="

<<element_value<<

"\n"

;

343  if

( !have_explicit_name ) {

362

(*rm_it)->GetParent()->RemoveNode(*rm_it);

433  x_Print

(tree_root.get(),

""

);

436  return

tree_root.release();

441

: m_ParamTree(param_tree, own)

473  const string

& param_name,

475  const string

& default_value,

476  const

list<string>* synonyms)

479

on_error, default_value, synonyms);

484  const string

& param_name,

486  const

list<string>* synonyms)

494  const string

& param_name,

496  const string

& default_value,

497  const

list<string>* synonyms)

499

list<const TParamTree*> tns;

502  if

(tn && !tn->

GetValue

().value.empty())

505  ITERATE

(list<string>, it, *synonyms) {

507  if

(tn && !tn->

GetValue

().value.empty())

513  return

default_value;

515  string msg

=

"Cannot init plugin "

+ driver_name +

516  ", missing parameter:"

+ param_name;

518  ITERATE

(list<string>, it, *synonyms) {

519  if

( it == synonyms->begin() )

msg

+=

" or "

;

527  if

(tns.size() > 1 ) {

528  string msg

=

"There are more then 1 synonyms parameters ("

;

529  ITERATE

(list<const TParamTree*>, it, tns) {

530  if

(it != tns.begin())

msg

+=

", "

;

531  msg

+= (*it)->GetKey();

535  msg

+=

" for driver "

+ driver_name +

". Default value is used."

;

537  return

default_value;

539  msg

=

"Cannot init plugin "

+ driver_name +

". "

+

msg

;

542  return

(*tns.begin())->GetValue().value;

547  const string

& param_name,

550  const

list<string>* synonyms)

552  const string

& param =

GetString

(driver_name, param_name, on_error, synonyms);

556  string msg

=

"Cannot init "

+ driver_name +

557  ", empty parameter:"

+ param_name;

560  return

default_value;

570  string msg

=

"Cannot init "

+ driver_name +

571  ", incorrect parameter format:"

+

572

param_name +

" : "

+ param +

576  string msg

=

"Configuration error "

+ driver_name +

577  ", incorrect parameter format:"

+

578

param_name +

" : "

+ param +

579  " "

+ ex.what() +

". Default value is used"

;

583  return

default_value;

587  const string

& param_name,

589  unsigned int

default_value,

590  const

list<string>* synonyms)

592  const string

& param =

GetString

(driver_name, param_name, on_error, synonyms);

596  string msg

=

"Cannot init "

+ driver_name +

597  ", empty parameter:"

+ param_name;

600  return

default_value;

610  string msg

=

"Cannot init "

+ driver_name +

611  ", incorrect parameter format:"

+

612

param_name +

" : "

+ param +

616  string msg

=

"Configuration error "

+ driver_name +

617  ", incorrect parameter format:"

+

618

param_name +

" : "

+ param +

619  " "

+ ex.what() +

". Default value is used"

;

623  return

default_value;

628  const string

& param_name,

631  const

list<string>* synonyms)

633  const string

& param =

GetString

(driver_name, param_name, on_error, synonyms);

637  string msg

=

"Cannot init "

+ driver_name +

638  ", empty parameter:"

+ param_name;

641  return

default_value;

651  string msg

=

"Cannot init "

+ driver_name +

652  ", incorrect parameter format:"

+

653

param_name +

" : "

+ param +

657  string msg

=

"Configuration error "

+ driver_name +

658  ", incorrect parameter format:"

+

659

param_name +

" : "

+ param +

660  " "

+ ex.what() +

". Default value is used"

;

664  return

default_value;

668  const string

& param_name,

670  double

default_value,

671  const

list<string>* synonyms)

673  const string

& param =

GetString

(driver_name, param_name, on_error, synonyms);

677  string msg

=

"Cannot init "

+ driver_name +

678  ", empty parameter:"

+ param_name;

681  return

default_value;

691  string msg

=

"Cannot init "

+ driver_name +

692  ", incorrect parameter format:"

+

693

param_name +

" : "

+ param +

697  string msg

=

"Configuration error "

+ driver_name +

698  ", incorrect parameter format:"

+

699

param_name +

" : "

+ param +

700  " "

+ ex.what() +

". Default value is used"

;

704  return

default_value;

definition of a Culling tree

container_type::iterator iterator

const_iterator begin() const

const_iterator end() const

iterator_bool insert(const value_type &val)

const_iterator find(const key_type &key) const

iterator_bool insert(const value_type &val)

Include a standard set of the NCBI C++ Toolkit most basic headers.

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

#define ITERATE(Type, Var, Cont)

ITERATE macro to sequence through container elements.

@ eTakeOwnership

An object can take ownership of another.

@ eNoOwnership

No ownership is assumed.

#define ERR_POST_X_ONCE(err_subcode, message)

Error posting only once during program execution with default error code and given error subcode.

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.

TErrCode GetErrCode(void) const

virtual const char * GetErrCodeString(void) const

Get error code interpreted as text.

EErrAction

Defines how to behave when parameter is missing.

Uint8 GetDataSize(const string &driver_name, const string &param_name, EErrAction on_error, unsigned int default_value, const list< string > *synonyms=NULL)

Utility function to get an integer element of parameter tree Throws an exception when mandatory param...

double GetDouble(const string &driver_name, const string &param_name, EErrAction on_error, double default_value, const list< string > *synonyms=NULL)

Utility function to get a double element of parameter tree Throws an exception when mandatory paramet...

CTreePair< string, string, PEqualNocase_Conditional > TParamValue

Instantiation parameters tree.

static TParamTree * ConvertRegToTree(const IRegistry &reg, NStr::ECase use_case=NStr::eNocase)

Reconstruct param tree from the application registry.

TParamValue::TPairTreeNode TParamTree

int GetInt(const string &driver_name, const string &param_name, EErrAction on_error, int default_value, const list< string > *synonyms=NULL)

Utility function to get an integer element of parameter tree Throws an exception when mandatory param...

const string & x_GetString(const string &driver_name, const string &param_name, EErrAction on_error, const string &default_value, const list< string > *synonyms)

string GetString(const string &driver_name, const string &param_name, EErrAction on_error, const string &default_value, const list< string > *synonyms=NULL)

Utility function to get an element of parameter tree Throws an exception when mandatory parameter is ...

AutoPtr< TParamTree > m_ParamTree

bool GetBool(const string &driver_name, const string &param_name, EErrAction on_error, bool default_value, const list< string > *synonyms=NULL)

Utility function to get an integer element of parameter tree Throws an exception when mandatory param...

CConfig(TParamTree *param_tree, EOwnership own=eTakeOwnership, NStr::ECase use_case=NStr::eNocase)

Optionally takes ownership on passed param_tree.

virtual const char * GetErrCodeString(void) const override

Translate from the error code value to its string representation.

@ eErr_NoThrow

Return default value on error.

@ eErr_Throw

Throw an exception on error.

@ eParameterMissing

Missing mandatory parameter.

@ eInvalidParameter

Invalid parameter value.

uint64_t Uint8

8-byte (64-bit) unsigned integer

virtual void EnumerateSections(list< string > *sections, TFlags flags=fAllLayers) const

Enumerate section names.

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

Get the parameter value.

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

Enumerate parameter names for a specified section.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

static bool StringToBool(const CTempString str)

Convert string to bool.

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 double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)

Convert string to double.

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

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

ECase

Which type of string comparison.

@ fDecimalPosixOrLocal

StringToDouble*(): For decimal point, try both C and current locale.

@ fSplit_MergeDelimiters

Merge adjacent delimiters.

TNodeList::iterator TNodeList_I

const TKeyType & GetKey(void) const

const TTreeType * FindNode(const TKeyType &key, TNodeSearchMode sflag=eImmediateAndTop) const

Search for node.

Fun TreeDepthFirstTraverse(TTreeNode &tree_node, Fun func)

Depth-first tree traversal algorithm.

void RemoveNode(TTreeType *subnode)

Remove subnode of the current node.

ETreeTraverseCode

Tree traverse code returned by the traverse predicate function.

TNodeList_CI SubNodeBegin(void) const

Return first const iterator on subnode list.

void FindNodes(const TKeyList &node_path, TNodeList *res)

Find tree nodes corresponding to the path from the top.

const TKeyEqual & GetKeyEqual() const

Return key equal predicate.

TNodeList::const_iterator TNodeList_CI

void AddNode(TTreeType *subnode)

Add new subnode.

const TTreeType * FindSubNode(const TKeyType &key) const

Non recursive linear scan of all subnodes, with key comparison.

TNodeList_CI SubNodeEnd(void) const

Return last const iterator on subnode list.

const TValue & GetValue(void) const

Return node's value.

TTreeType * FindOrCreateNode(const TKeyList &node_path)

Find or create tree node corresponding to the path from the top.

const TTreeType * GetParent(void) const

Get node's parent.

@ eTreeTraverse

Keep traversal.

@ eImmediateSubNodes

Search direct subnodes.

enum ENcbiOwnership EOwnership

Ownership relations between objects.

Definition of all error codes used in corelib (xncbi.lib).

static bool s_IsParentNode(TParamTree *parent, TParamTree *child)

map< TParamTree *, set< string > > TSectionMap

static const char * kNodeName

static bool s_IsSubNode(const string &str)

static TParamTree * s_FindSubNode(const string &path, TParamTree *tree_root)

static void s_AddOrReplaceSubNode(TParamTree *node_ptr, const string &element_name, const string &element_value)

static const char * kSubSection

static const char * kSubNode

static const char * kIncludeSections

static void s_ExpandSubNodes(TSectionMap &inc_sections, TParamTree *tree_root, TParamTree *node)

void s_List2Set(const list< string > &src, ResultSet *dst)

static void s_IncludeNode(TParamTree *parent_node, const TParamTree *inc_node)

CConfig::TParamTree TParamTree

static void s_ParseSubNodes(const string &sub_nodes, TParamTree *parent_node, TSectionMap &inc_sections, set< string > &rm_sections)

CConfig::TParamValue TParamValue

static void x_Print(const CConfig::TParamTree *tree, const string &section)

Parameters initialization model.

Define class Dll and for Portable DLL handling.

Process information in the NCBI Registry, including working with configuration files.

static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)

Node data template for id-value trees.

set< TParamTree * > TNodeSet

ETreeTraverseCode operator()(TParamTree &node, int)

SNodeNameUpdater(TNodeSet &node_set)

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