(
isalnum((
unsigned char) ch)
63|| ch ==
'_'|| ch ==
'-'|| ch ==
'.'|| ch ==
'/' 92 boolis_file_comment =
false)
94 if( !comment.length() )
98 const charc_comment = is_file_comment ?
'#':
';';
101 for(
SIZE_TYPEbeg = 0; beg < comment.length();
102beg = endl_pos + 1) {
103 SIZE_TYPEpos = comment.find_first_not_of(
" \t", beg);
104endl_pos = comment.find_first_of(
"\n", beg);
105 if(endl_pos ==
NPOS) {
106endl_pos = comment.length();
108 if(((pos !=
NPOS&& comment[pos] != c_comment) ||
109(pos ==
NPOS&& endl_pos == comment.length())) &&
110(is_file_comment || beg != endl_pos) ) {
111x_comment += c_comment;
113x_comment.append(comment, beg, endl_pos - beg);
123 if(!comment.length())
146 SIZE_TYPElast_non_bs = s.find_last_not_of(
"\\", pos - 1);
147 return(pos - last_non_bs) % 2 == 0;
150 inline string s_FlatKey(
const string& section,
const string& name)
152 returnsection +
'#'+ name;
214list<string> sections;
217 ITERATE(list<string>, section, sections) {
221 if(!(section->empty()))
222os <<
'['<< *section <<
']'<<
Endl();
233os << *entry <<
" = \"" 244list<string> in_section_comments;
246 ITERATE(list<string>, comment, in_section_comments) {
275 _TRACE(
"IRegistry::Get: bad section name \"" 281 _TRACE(
"IRegistry::Get: bad entry name \"" 304 _TRACE(
"IRegistry::HasEntry: bad section name \"" 309 boolis_special_name = clean_name.empty() ||
312 _TRACE(
"IRegistry::HasEntry: bad entry name \"" 325 return value.empty() ? default_value :
value;
335 const string& raw_value =
Get(clean_section, clean_name,
340 if(password.empty()) {
347 "Decryption failed for configuration value [" 348+ clean_section +
"] "+ clean_name +
'.',
353 "Configuration value for ["+ clean_section +
"] " 354+ clean_name +
" should have been encrypted but wasn't.",
367 if(
value.empty()) {
368 returndefault_value;
375 returndefault_value;
378 string msg=
"IRegistry::GetInt(): ["+ section +
']'+ name;
380 if(err_action ==
eThrow) {
382}
else if(err_action ==
eErrPost) {
386 returndefault_value;
396 if(
value.empty()) {
397 returndefault_value;
404 returndefault_value;
407 string msg=
"IRegistry::GetBool(): ["+ section +
']'+ name;
409 if(err_action ==
eThrow) {
411}
else if(err_action ==
eErrPost) {
415 returndefault_value;
425 if(
value.empty()) {
426 returndefault_value;
433 returndefault_value;
436 string msg=
"IRegistry::GetDouble()";
437 msg+=
" Reg entry:"+ section +
":"+ name;
439 if(err_action ==
eThrow) {
441}
else if(err_action ==
eErrPost) {
445 returndefault_value;
457 _TRACE(
"IRegistry::GetComment: bad section name \"" 462 boolis_special_name = clean_name.empty() ||
465 _TRACE(
"IRegistry::GetComment: bad entry name \"" 475list<string>* comments,
488 _TRACE(
"IRegistry::EnumerateInSectionComments: bad section name \"" 528 _TRACE(
"IRegistry::EnumerateEntries: bad section name \"" 568 if(
flags& ~allowed)
569 _TRACE(func <<
"(): extra flags passed: " 570<< resetiosflags(IOS_BASE::basefield)
643 boolwas_empty =
Empty(impact);
644 boolnon_modifying = was_empty && !
Modified(impact);
654 stringin_path = path.empty() ?
kEmptyStr: (
" in "+ path);
670 if(!comment.empty() && !section.empty()) {
671in_section_comments[section] += comment +
"\n";
673in_section_comments[section]), section,
680 switch(
str[beg]) {
692 if(is.peek() == EOF && !section.empty()) {
706 "Invalid registry section"+ in_path
707+
" (']' is missing): `"+
str+
"'", line);
710 if(section.empty()) {
712 "Unnamed registry section"+ in_path +
": `" 716 "Invalid registry section name"+ in_path
717+
": `"+
str+
"'", line);
730 "Invalid registry entry format"+ in_path
731+
": '"+
str+
"'", line);
736 "Invalid registry entry name"+ in_path +
": '" 742 if(
value.empty()) {
765pos < end && pos !=
NPOS;
766pos =
value.find(
'\"', pos + 1)) {
769}
else if(pos == beg) {
771}
else if(pos == end - 1) {
775 "Single(unescaped) '\"' in the middle " 776 "of registry value"+ in_path +
": '" 785 "Badly placed '\\' in the registry value" 786+ in_path +
": '"+
str+
"'", line);
793 const string& old_value =
Get(section, name,
flags);
803<<
"Found multiple ["<< section <<
"] " 804<< name <<
" settings"<< in_path
805<<
"; using the one from line "<< line);
807 Set(section, name,
value, set_flags, comment);
811}
catch(exception& e) {
821 ERR_POST_X(4,
"Error reading the registry after line "<< line
822<< in_path <<
": "<<
str);
825 if( non_modifying ) {
835 const string& comment)
842 _TRACE(
"IRWRegistry::Set: bad section name \"" 848 _TRACE(
"IRWRegistry::Set: bad entry name \"" 855beg =
value.find_first_not_of(
" \r\t\v");
856end =
value.find_last_not_of (
" \r\t\v");
864 if(
x_Set(clean_section, clean_name,
value.substr(beg, end - beg + 1),
882 _TRACE(
"IRWRegistry::Unset: bad section name \"" 888 _TRACE(
"IRWRegistry::Unset: bad entry name \"" 909 _TRACE(
"IRWRegistry::SetComment: bad section name \"" 914 boolis_special_name = clean_name.empty() ||
917 _TRACE(
"IRWRegistry::SetComment: bad entry name \"" 923clean_section, clean_name,
flags)) {
934 if(target.empty()) {
978}
else if(name.empty()) {
982 const string& inner_comment = sit->second.in_section_comment;
983 if(!inner_comment.empty()) {
996 return!eit->second.value.empty();
1002 const string& name,
1005 if(section.empty()) {
1011}
else if(name.empty()) {
1012 returnsit->second.comment;
1014 returnsit->second.in_section_comment;
1025 if(section.empty() &&
1030 _TRACE(
"Deprecated call to x_Enumerate with empty section name, " 1031 " but with no fSections flag set");
1036 entries.push_back(it->first);
1042 if(!comment.empty()) {
1052|| !it->second.value.empty() )) {
1053 entries.push_back(it->first);
1069 const string& comment)
1071 _TRACE(
this<<
": ["<< section <<
']'<< name <<
" = "<<
value);
1073 if(
value.empty()) {
1082sit->second.cleared =
false;
1084 SEntry& entry = sit->second.entries[name];
1087 if(entry.
comment!= comment) {
1093 if( !
value.empty() ) {
1094sit->second.cleared =
false;
1095}
else if( !entry.
value.empty() ) {
1096 _ASSERT( !sit->second.cleared );
1097 boolcleared =
true;
1099 if(&eit->second != &entry && !eit->second.
value.empty() ) {
1104sit->second.cleared = cleared;
1118 _TRACE(
this<<
": ["<< section <<
']'<< name <<
" to be unset");
1129 if(
entries.empty() && sit->second.comment.empty()
1139 const string& section,
const string& name,
1145 if(section.empty()) {
1155sit->second.cleared =
false;
1159 string& inner_comment = sit->second.in_section_comment;
1160 string& outer_comment = sit->second.comment;
1162 if(comment.empty() &&
entries.empty() && inner_comment.empty()
1171 if(comment.empty() &&
entries.empty() && outer_comment.empty()
1193 const string& name)
1208 "CCompoundRegistry::Add: name "+ name
1209+
" already in use", 0);
1211preg.
Reset(&nc_reg);
1221 if(it->second == ®) {
1227 if(it->second == ®) {
1237 "CCompoundRegistry::Remove:" 1238 " reg is not a (direct) subregistry of this.", 0);
1251 const string& entry,
1257 if(it->second->HasEntry(section, entry, has_entry_flags)) {
1296 for(TPriorityMap::reverse_iterator it =
m_PriorityMap.rbegin();
1307 const string& name,
1332 if(section.empty()) {
1337 returnreg ? reg->GetComment(section, name,
flags& ~
fJustCore)
1354it->second->EnumerateInSectionComments(section, &
tmp,
1372((*it->second).*action)();
1383m_Persistent(
CRegRef(persistent ? persistent
1452 const string& name,
1490list<string> tl, pl;
1500set_union(pl.begin(), pl.end(), tl.begin(), tl.end(),
1512((*m_Transient).*action)();
1513((*m_Persistent).*action)();
1530 const string& comment)
1557 const string& section,
const string& name,
1602 if(xoverride_path && *xoverride_path) {
1616<<
"NCBI_CONFIG_OVERRIDES names nonexistent file " 1625: m_RuntimeOverrideCount(0), m_Flags(
flags)
1632 const string& path)
1633: m_RuntimeOverrideCount(0), m_Flags(
flags)
1658 if(getenv(
"NCBI_DONT_USE_NCBIRC")) {
1663 if(
HasEntry(
"NCBI",
"DONT_USE_NCBIRC")) {
1681 "Syntax error in system-wide configuration file: " 1702 const string& path)
1716crwreg->Read(is,
flags);
1723list<string> sections;
1725 ITERATE(list<string>, sit, sections) {
1736nc_main_reg.
Set(*sit, *eit, crwreg->Get(*sit, *eit),
flags);
1753 const string& name,
1756 if(section.empty()) {
1802 const string& name)
1804 if(name.size() > 1 && name[0] ==
'.') {
1806 "The sub-registry name "+ name +
" is reserved.", 0);
1810<<
"Reserved priority value automatically downgraded.");
1817 x_Add(reg, prio, name);
1825 "The primary portion of the registry may not be removed.",
1840 const string& entry,
1848 const string& path)
1854list<string>
names;
1861s += it->second->Get(
"NCBI",
".Inherits");
1866 _TRACE(
"LoadBaseRegistries("<<
this 1867<<
"): trying file registry");
1870->Get(
"NCBI",
".Inherits");
1877 if(
names.empty())
return false;
1878 _TRACE(
"LoadBaseRegistries("<<
this<<
"): using "<< s);
1881 typedefpair<string, CRef<IRWRegistry> > TNewBase;
1882 typedefvector<TNewBase> TNewBases;
1900metareg_flags,
flags,
1905metareg_flags,
flags,
1910bases.push_back(TNewBase(*it, entry2.
registry));
1913<<
" absent or unreadable");
1918 x_Add(*bases[
i].second,
1923 return!bases.empty();
1951 const string& name,
1957 flags&= ~it->second;
1975 flags&= ~it->second;
1985 const string& name,
1989 if(section.empty() || name.empty()) {
1994 result= &(reg->GetComment(section, name,
flags));
2018it->second->EnumerateInSectionComments(section, &
tmp,
2035 ITERATE(SetNoCase, it, accum) {
2043((*m_AllRegistries).*action)();
2060 const string& comment)
2064 _TRACE(
'['<< section <<
']'<< name <<
" = "<<
value);
2068 if(
value.empty()) {
2069 boolwas_empty =
Get(section, name,
flags).empty();
2077 if((it->second &= ~flags2) == 0) {
2100 const string& section,
2108 const string& path)
2123 const string& name)
2136 case eSection:
return "eSection";
2137 case eEntry:
return "eEntry";
2138 case eValue:
return "eValue";
2141 case eErr:
return "eErr";
CEnvironmentRegistry â.
static CNcbiApplication * Instance(void)
Singleton method.
static bool IsEncrypted(const string &data)
Check if the string contains valid encrypted data.
static string Decrypt(const string &encrypted_string)
Decrypt a string using the matching key found in the NCBI keys files.
CRegistry{Read,Write}Guard â.
container_type::const_iterator const_iterator
container_type::iterator iterator
const_iterator end() const
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
iterator insert(const value_type &val)
container_type::value_type value_type
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
Classes to support using environment variables as a backend for the registry framework.
static const struct name_t names[]
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static const char * str(char *buf, int n)
CNcbiEnvironment & SetEnvironment(void)
Get a non-const copy of the application's cached environment.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define REVERSE_ITERATE(Type, Var, Cont)
ITERATE macro to reverse sequence through container elements.
@ eNoOwnership
No ownership is assumed.
TValue Add(int delta) THROWS_NONE
Atomically add value (=delta), and return new counter value.
TValue Get(void) const THROWS_NONE
Get atomic counter value.
#define ERR_POST_ONCE(message)
Error posting only once during program execution.
#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.
void Critical(CExceptionArgs_Base &args)
#define NCBI_RETHROW_SAME(prev_exception, message)
Generic macro to re-throw the same exception.
void Warning(CExceptionArgs_Base &args)
#define NCBI_THROW2(exception_class, err_code, message, extra)
Throw exception with extra parameter.
#define NCBI_RETHROW2(prev_exception, exception_class, err_code, message, extra)
Re-throw exception with extra parameter.
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
bool Empty(void) const THROWS_NONE
Check if CConstRef is empty â not pointing to any object which means having a null value.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
void Remove(const IRegistry ®)
Remove sub-registry "reg".
int TFlags
Binary OR of "EFlags".
CConstRef< IRegistry > FindByName(const string &name) const
Return a pointer to the sub-registry with the given name, or NULL if not found.
const string & x_Get(const string §ion, const string &name, TFlags flags) const
void x_Enumerate(const string §ion, list< string > &entries, TFlags flags) const
virtual void x_ChildLockAction(FLockAction)
int TPriority
Not restricted to ePriority_*.
CConstRef< IRegistry > FindByName(const string &name) const
Return a pointer to the sub-registry with the given name, or NULL if not found.
static const char * sm_InSectionCommentName
Entry name for an in-section comment.
bool x_HasEntry(const string §ion, const string &name, TFlags flags) const
virtual bool GetBool(const string §ion, const string &name, bool default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get boolean value of specified parameter name.
const string & x_GetComment(const string §ion, const string &name, TFlags flags) const
set< string > m_BaseRegNames
TNCBIAtomicValue x_GetWriteLockCount(void) const
static void x_CheckFlags(const string &func, TFlags &flags, TFlags allowed)
static const char * sm_SysRegName
CRef< CTwoLayerRegistry > m_MainRegistry
virtual bool x_Set(const string §ion, const string &name, const string &value, TFlags flags, const string &comment)=0
bool x_HasEntry(const string §ion, const string &name, TFlags flags) const
const string & x_GetComment(const string §ion, const string &name, TFlags flags) const
virtual void x_Enumerate(const string §ion, list< string > &entries, TFlags flags) const =0
virtual const string & x_Get(const string §ion, const string &name, TFlags flags) const =0
bool x_Set(const string §ion, const string &name, const string &value, TFlags flags, const string &comment)
void x_Clear(TFlags flags)
Called locked, like the virtual methods inherited from IRegistry.
bool x_HasEntry(const string §ion, const string &name, TFlags flags) const
bool x_Unset(const string §ion, const string &name, TFlags flags)
static bool MaybeSet(string &target, const string &value, TFlags flags)
void x_ChildLockAction(FLockAction action)
bool x_Set(const string §ion, const string &name, const string &value, TFlags flags, const string &comment)
TClearedEntries m_ClearedEntries
virtual void x_SetModifiedFlag(bool, TFlags)
virtual bool x_SetComment(const string &comment, const string §ion, const string &name, TFlags flags)=0
virtual void EnumerateSections(list< string > *sections, TFlags flags=fAllLayers) const
Enumerate section names.
virtual void x_Clear(TFlags flags)=0
Called locked, like the virtual methods inherited from IRegistry.
void ReadLock(void)
Support for locking.
IRWRegistry * x_Read(CNcbiIstream &is, TFlags flags, const string &path)
Most implementations should not override this, but CNcbiRegistry must, to handle some special cases p...
bool x_SetComment(const string &comment, const string §ion, const string &name, TFlags flags)
void x_SetModifiedFlag(bool modified, TFlags flags)
virtual bool x_Empty(TFlags flags) const =0
Implementations of the fundamental operations above, to be run with the lock already acquired and som...
CConstRef< IRegistry > FindByContents(const string §ion, const string &entry=kEmptyStr, TFlags flags=0) const
Return a pointer to the highest-priority sub-registry with a section named SECTION containing (if ENT...
virtual const string & Get(const string §ion, const string &name, TFlags flags=0) const
Get the parameter value.
TNameMap m_NameMap
excludes anonymous sub-registries
void x_Clear(TFlags flags)
Called locked, like the virtual methods inherited from IRegistry.
void x_Enumerate(const string §ion, list< string > &entries, TFlags flags) const
void x_Enumerate(const string §ion, list< string > &entries, TFlags flags) const
CCompoundRWRegistry(TFlags m_Flags=0)
Constructor.
bool x_Empty(TFlags flags) const
Implementations of the fundamental operations above, to be run with the lock already acquired and som...
const string & x_Get(const string §ion, const string &name, TFlags flags) const
CRef< IRWRegistry > m_OverrideRegistry
virtual int GetInt(const string §ion, const string &name, int default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get integer value of specified parameter name.
CTwoLayerRegistry(IRWRegistry *persistent=0, TFlags flags=0)
Constructor.
virtual bool x_Modified(TFlags) const
bool x_HasEntry(const string §ion, const string &name, TFlags flags) const
static const char * sm_MainRegName
Predefined subregistry's name.
virtual IRWRegistry * x_Read(CNcbiIstream &is, TFlags flags, const string &path)
Most implementations should not override this, but CNcbiRegistry must, to handle some special cases p...
bool x_Empty(TFlags flags) const
Implementations of the fundamental operations above, to be run with the lock already acquired and som...
virtual const string & x_GetComment(const string §ion, const string &name, TFlags flags) const =0
virtual bool x_HasEntry(const string §ion, const string &name, TFlags flags) const =0
bool SetComment(const string &comment, const string §ion=kEmptyStr, const string &name=kEmptyStr, TFlags flags=0)
Set comment "comment" for the registry entry "section:name".
virtual double GetDouble(const string §ion, const string &name, double default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get double value of specified parameter name.
bool x_Modified(TFlags flags) const
static TFlags AssessImpact(TFlags flags, EOperation op)
Indicate which portions of the registry the given operation would affect.
TPriority GetCoreCutoff(void) const
Subregistries whose priority is less than the core cutoff (ePriority_Default by default) will be igno...
const string & x_GetComment(const string §ion, const string &name, TFlags flags) const
const string & x_GetComment(const string §ion, const string &name, TFlags flags) const
void x_Clear(TFlags flags)
Called locked, like the virtual methods inherited from IRegistry.
EErrAction
What to do if parameter value is present but cannot be converted into the requested type.
CRef< CTwoLayerRegistry > m_FileRegistry
virtual void EnumerateInSectionComments(const string §ion, list< string > *comments, TFlags flags=fAllLayers) const
Enumerate in-section comments.
virtual bool HasEntry(const string §ion, const string &name=kEmptyStr, TFlags flags=0) const
bool Empty(TFlags flags=fAllLayers) const
Verify if Registry is empty.
static const char * sm_EnvRegName
Predefined subregistries' names.
bool x_Unset(const string §ion, const string &name, TFlags flags)
bool IncludeNcbircIfAllowed(TFlags flags=fWithNcbirc)
Attempt to load a systemwide configuration file (.ncbirc on Unix, ncbi.ini on Windows) as a low-prior...
virtual void EnumerateEntries(const string §ion, list< string > *entries, TFlags flags=fAllLayers) const
Enumerate parameter names for a specified section.
CRef< CEnvironmentRegistry > m_EnvRegistry
bool Modified(TFlags flags=fPersistent) const
Verify if persistent values have been modified.
void x_ChildLockAction(FLockAction action)
void x_ChildLockAction(FLockAction action)
void x_Clear(TFlags flags)
Called locked, like the virtual methods inherited from IRegistry.
static const char * sm_FileRegName
bool x_SetComment(const string &comment, const string §ion, const string &name, TFlags flags)
IRWRegistry * Read(CNcbiIstream &is, TFlags flags=0, const string &path=kEmptyStr)
Read and parse the stream "is", and merge its content with current Registry entries.
void x_Enumerate(const string §ion, list< string > &entries, TFlags flags) const
void x_SetModifiedFlag(bool modified, TFlags flags)
static bool IsNameEntry(const string &str, TFlags flags)
void Add(const IRegistry ®, TPriority prio=ePriority_Default, const string &name=kEmptyStr)
Non-empty names must be unique within each compound registry, but there is no limit to the number of ...
bool x_Empty(TFlags flags) const
Implementations of the fundamental operations above, to be run with the lock already acquired and som...
virtual const string & GetComment(const string §ion=kEmptyStr, const string &name=kEmptyStr, TFlags flags=0) const
Get comment of the registry entry "section:name".
virtual bool x_Unset(const string §ion, const string &name, TFlags flags)=0
void Add(const IRegistry ®, TPriority prio=ePriority_Default, const string &name=kEmptyStr)
Non-empty names must be unique within each compound registry, but there is no limit to the number of ...
bool x_Set(const string §ion, const string &name, const string &value, TFlags flags, const string &comment)
static bool IsNameSection(const string &str, TFlags flags)
Check if "str" consists of alphanumeric and '_' only Treat the case of set fSectionlessEntries separa...
CConstRef< IRegistry > FindByContents(const string §ion, const string &entry=kEmptyStr, TFlags flags=0) const
Return a pointer to the highest-priority sub-registry with a section named SECTION containing (if ENT...
string GetEncryptedString(const string §ion, const string &name, TFlags flags=0, const string &password=kEmptyStr) const
Get a value that was (potentially) stored encrypted.
unsigned int m_RuntimeOverrideCount
void SetCoreCutoff(TPriority prio)
virtual const char * GetErrCodeString(void) const override
Translate from the error code value to its string representation.
CRef< IRWRegistry > m_SysRegistry
virtual string GetString(const string §ion, const string &name, const string &default_value, TFlags flags=0) const
Get the parameter string value.
bool x_Unset(const string §ion, const string &name, TFlags flags)
const string & x_Get(const string §ion, const string &name, TFlags flags) const
bool x_Modified(TFlags flags) const
True iff any sub-registry is modified.
static const char * sm_OverrideRegName
bool LoadBaseRegistries(TFlags flags=0, int metareg_flags=0, const string &path=kEmptyStr)
Load any base registries listed in [NCBI].Inherits; returns true if able to load at least one,...
int TPriority
Not restricted to ePriority_*.
bool x_SetComment(const string &comment, const string §ion, const string &name, TFlags flags)
~CCompoundRWRegistry()
Destructor.
CRef< CCompoundRegistry > m_AllRegistries
void x_SetModifiedFlag(bool modified, TFlags flags)
bool Write(CNcbiOstream &os, TFlags flags=0) const
Write the registry content to output stream.
void Remove(const IRegistry ®)
Remove sub-registry "reg".
bool x_Empty(TFlags flags) const
True iff all sub-registries are empty.
CNcbiRegistry(TFlags flags=0)
Constructor.
TPriority GetCoreCutoff(void) const
Subregistries whose priority is less than the core cutoff (ePriority_Reserved by default) will be ign...
TPriorityMap m_PriorityMap
const string & x_Get(const string §ion, const string &name, TFlags flags) const
bool Unset(const string §ion, const string &name, TFlags flags=0)
Fully unset the configuration parameter value, so that HasEntry returns false.
IRWRegistry * x_Read(CNcbiIstream &is, TFlags flags, const string &path)
Most implementations should not override this, but CNcbiRegistry must, to handle some special cases p...
const string & x_GetComment(const string §ion, const string &name, TFlags flags) const
void x_Add(const IRegistry ®, TPriority prio=ePriority_Default, const string &name=kEmptyStr)
Add an internal high-priority subregistry.
void SetCoreCutoff(TPriority prio)
CAtomicCounter_WithAutoInit m_WriteLockCount
EOperation
Categories of modifying operations.
static const char * sm_BaseRegNamePrefix
Prefix for any base registries' names.
void Clear(TFlags flags=fAllLayers)
Reset the registry content.
bool Set(const string §ion, const string &name, const string &value, TFlags flags=0, const string &comment=kEmptyStr)
Set the configuration parameter value.
void SetModifiedFlag(bool modified, TFlags flags=fPersistent)
Indicate whether any relevant values are out of sync with some external resource (typically a configu...
bool x_Modified(TFlags flags) const
@ fOverride
Existing value can be overriden.
@ fInternalCheckedAndLocked
@ fCountCleared
Let explicitly cleared entries stand.
@ fTruncate
Leading, trailing blanks can be truncated.
@ fPersistent
Persistent â saved when file is written.
@ fSectionlessEntries
Allow empty section names (for test_res framework)
@ fIgnoreErrors
Continue Read()ing after parse errors.
@ fWithNcbirc
Include .ncbirc (used only by CNcbiReg.)
@ fInternalSpaces
Allow internal whitespace in names.
@ fSections
Indicates that we want sections from x_Enumerate.
@ fNoOverride
Cannot change existing value.
@ fJustCore
Ignore auxiliary subregistries.
@ fTransient
Transient â not saved by default.
@ fInSectionComments
Indicates that we want in-section comments from x_Enumerate.
@ fNotJustCore
Include auxiliary subregistries.
@ eReturn
Return default value.
@ eThrow
Throw an exception if an error occurs.
@ eErrPost
Log the error message and return default value.
@ ePriority_RuntimeOverrides
@ eValue
General value format error.
@ eUnencrypted
Value should have been encrypted, but wasn't.
@ eSection
Section name format error.
@ eDecryptionFailed
Value looked encrypted, but decryption failed.
@ eEntry
Entry name format error.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
CNcbiIstream & NcbiGetlineEOL(CNcbiIstream &is, string &str, string::size_type *count=NULL)
Read from "is" to "str" the next line (taking into account platform specifics of End-of-Line)
EEncodingForm
Helper functions to read plain-text data streams.
string Printable(char c)
Convert one single character to a "printable" form.
EEncodingForm GetTextEncodingForm(CNcbiIstream &input, EBOMDiscard discard_bom)
Detect if the stream has BOM.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
const char * Endl(void)
Platform-specific EndOfLine.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
EEncodingForm ReadIntoUtf8(CNcbiIstream &input, CStringUTF8 *result, EEncodingForm encoding_form=eEncodingForm_Unknown, EReadUnknownNoBOM what_if_no_bom=eNoBOM_GuessEncoding)
Read all input data from stream and try convert it into UTF8 string.
@ eEncodingForm_Utf16Foreign
Stream has UTF16 BOM. Byte order is nonnative for this OS.
@ eEncodingForm_Utf16Native
Stream has UTF16 BOM. Byte order is native for this OS.
@ eBOM_Discard
Discard the read BOM bytes.
static bool StringToBool(const CTempString str)
Convert string to bool.
NCBI_NS_STD::string::size_type SIZE_TYPE
static string PrintableString(const CTempString str, TPrintableMode mode=fNewLine_Quote|fNonAscii_Passthru)
Get a printable version of the specified 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 EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
PNocase_Generic< string > PNocase
static string ParseEscapes(const CTempString str, EEscSeqRange mode=eEscSeqRange_Standard, char user_char='?')
Parse C-style escape sequences in the specified string.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
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.
TErrCode GetErrCode(void) const
Get error code.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
@ fDecimalPosixOrLocal
StringToDouble*(): For decimal point, try both C and current locale.
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
@ fSplit_CanSingleQuote
Allow '...' quoting.
void ReadLock(void)
Read lock.
void WriteLock(void)
Write lock.
size_t TNCBIAtomicValue
Define platform specific atomic-operations macros/values.
void Unlock(void)
Release the RW-lock.
Definition of all error codes used in corelib (xncbi.lib).
static void hex(unsigned char c)
const GenericPointer< typename T::ValueType > T2 value
int strcmp(const char *str1, const char *str2)
Multi-threading â mutexes; rw-locks; semaphore.
string s_FlatKey(const string §ion, const string &name)
static bool s_WriteComment(CNcbiOstream &os, const string &comment)
CRegistryReadGuard TReadGuard
static const string s_ConvertComment(const string &comment, bool is_file_comment=false)
CRegistryWriteGuard TWriteGuard
bool s_Backslashed(const string &s, SIZE_TYPE pos)
bool s_IsNameSectionSymbol(char ch, IRegistry::TFlags flags)
Process information in the NCBI Registry, including working with configuration files.
std::istream & in(std::istream &in_, double &x_)
Defines NCBI C++ secure resources API.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
CRef< IRWRegistry > registry
string actual_name
Either an absolute path or empty.
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