50 #define NCBI_USE_ERRCODE_X Corelib_Reg
62 return (
isalnum((
unsigned char) ch)
63 || ch ==
'_' || ch ==
'-' || ch ==
'.' || ch ==
'/'
92 bool is_file_comment =
false)
94 if ( !comment.length() )
98 const char c_comment = is_file_comment ?
'#' :
';';
101 for (
SIZE_TYPE beg = 0; beg < comment.length();
102 beg = endl_pos + 1) {
103 SIZE_TYPE pos = comment.find_first_not_of(
" \t", beg);
104 endl_pos = comment.find_first_of(
"\n", beg);
105 if (endl_pos ==
NPOS) {
106 endl_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) ) {
111 x_comment += c_comment;
113 x_comment.append(comment, beg, endl_pos - beg);
123 if (!comment.length())
146 SIZE_TYPE last_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 return section +
'#' + name;
214 list<string> sections;
217 ITERATE (list<string>, section, sections) {
221 if(!(section->empty()))
222 os <<
'[' << *section <<
']' <<
Endl();
233 os << *entry <<
" = \""
244 list<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 bool is_special_name = clean_name.empty() ||
312 _TRACE(
"IRegistry::HasEntry: bad entry name \""
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.",
368 return default_value;
375 return default_value;
378 string msg =
"IRegistry::GetInt(): [" + section +
']' + name;
380 if (err_action ==
eThrow) {
382 }
else if (err_action ==
eErrPost) {
386 return default_value;
397 return default_value;
404 return default_value;
407 string msg =
"IRegistry::GetBool(): [" + section +
']' + name;
409 if (err_action ==
eThrow) {
411 }
else if (err_action ==
eErrPost) {
415 return default_value;
426 return default_value;
433 return default_value;
436 string msg =
"IRegistry::GetDouble()";
437 msg +=
" Reg entry:" + section +
":" + name;
439 if (err_action ==
eThrow) {
441 }
else if (err_action ==
eErrPost) {
445 return default_value;
457 _TRACE(
"IRegistry::GetComment: bad section name \""
462 bool is_special_name = clean_name.empty() ||
465 _TRACE(
"IRegistry::GetComment: bad entry name \""
475 list<string>* comments,
488 _TRACE(
"IRegistry::EnumerateInSectionComments: bad section name \""
528 _TRACE(
"IRegistry::EnumerateEntries: bad section name \""
561 if (
flags & ~allowed)
562 _TRACE(func <<
"(): extra flags passed: "
563 << resetiosflags(IOS_BASE::basefield)
636 bool was_empty =
Empty(impact);
637 bool non_modifying = was_empty && !
Modified(impact);
647 string in_path = path.empty() ?
kEmptyStr : (
" in " + path);
663 if (!comment.empty() && !section.empty()) {
664 in_section_comments[section] += comment +
"\n";
666 in_section_comments[section]), section,
685 if (is.peek() == EOF && !section.empty()) {
699 "Invalid registry section" + in_path
700 +
" (']' is missing): `" +
str +
"'", line);
703 if (section.empty()) {
705 "Unnamed registry section" + in_path +
": `"
709 "Invalid registry section name" + in_path
710 +
": `" +
str +
"'", line);
723 "Invalid registry entry format" + in_path
724 +
": '" +
str +
"'", line);
729 "Invalid registry entry name" + in_path +
": '"
758 pos < end && pos !=
NPOS;
759 pos =
value.find(
'\"', pos + 1)) {
762 }
else if (pos == beg) {
764 }
else if (pos == end - 1) {
768 "Single(unescaped) '\"' in the middle "
769 "of registry value" + in_path +
": '"
778 "Badly placed '\\' in the registry value"
779 + in_path +
": '" +
str +
"'", line);
786 const string& old_value =
Get(section, name,
flags);
796 <<
"Found multiple [" << section <<
"] "
797 << name <<
" settings" << in_path
798 <<
"; using the one from line " << line);
800 Set(section, name,
value, set_flags, comment);
804 }
catch (exception& e) {
814 ERR_POST_X(4,
"Error reading the registry after line " << line
815 << in_path <<
": " <<
str);
818 if ( non_modifying ) {
828 const string& comment)
835 _TRACE(
"IRWRegistry::Set: bad section name \""
841 _TRACE(
"IRWRegistry::Set: bad entry name \""
848 beg =
value.find_first_not_of(
" \r\t\v");
849 end =
value.find_last_not_of (
" \r\t\v");
857 if (
x_Set(clean_section, clean_name,
value.substr(beg, end - beg + 1),
875 _TRACE(
"IRWRegistry::Unset: bad section name \""
881 _TRACE(
"IRWRegistry::Unset: bad entry name \""
902 _TRACE(
"IRWRegistry::SetComment: bad section name \""
907 bool is_special_name = clean_name.empty() ||
910 _TRACE(
"IRWRegistry::SetComment: bad entry name \""
916 clean_section, clean_name,
flags)) {
927 if (target.empty()) {
972 }
else if (name.empty()) {
976 const string& inner_comment = sit->second.in_section_comment;
977 if (!inner_comment.empty()) {
990 return !eit->second.value.empty();
999 if (section.empty()) {
1005 }
else if (name.empty()) {
1006 return sit->second.comment;
1008 return sit->second.in_section_comment;
1019 if (section.empty() &&
1024 _TRACE(
"Deprecated call to x_Enumerate with empty section name, "
1025 " but with no fSections flag set");
1036 if (!comment.empty()) {
1046 || !it->second.value.empty() )) {
1063 const string& comment)
1065 _TRACE(
this <<
": [" << section <<
']' << name <<
" = " <<
value);
1067 if (
value.empty()) {
1076 sit->second.cleared =
false;
1078 SEntry& entry = sit->second.entries[name];
1081 if (entry.
comment != comment) {
1087 if ( !
value.empty() ) {
1088 sit->second.cleared =
false;
1089 }
else if ( !entry.
value.empty() ) {
1090 _ASSERT( !sit->second.cleared );
1091 bool cleared =
true;
1093 if (&eit->second != &entry && !eit->second.
value.empty() ) {
1098 sit->second.cleared = cleared;
1112 _TRACE(
this <<
": [" << section <<
']' << name <<
" to be unset");
1123 if (
entries.empty() && sit->second.comment.empty()
1133 const string& section,
const string& name,
1139 if (section.empty()) {
1149 sit->second.cleared =
false;
1153 string& inner_comment = sit->second.in_section_comment;
1154 string& outer_comment = sit->second.comment;
1156 if (comment.empty() &&
entries.empty() && inner_comment.empty()
1165 if (comment.empty() &&
entries.empty() && outer_comment.empty()
1198 "CCompoundRegistry::Add: name " + name
1199 +
" already in use", 0);
1201 preg.
Reset(&nc_reg);
1210 if (it->second == ®) {
1216 if (it->second == ®) {
1223 "CCompoundRegistry::Remove:"
1224 " reg is not a (direct) subregistry of this.", 0);
1236 const string& entry,
1241 if (it->second->HasEntry(section, entry, has_entry_flags)) {
1280 for (TPriorityMap::reverse_iterator it =
m_PriorityMap.rbegin();
1316 if (section.empty()) {
1338 it->second->EnumerateInSectionComments(section, &
tmp,
1356 ((*it->second).*action)();
1367 m_Persistent(
CRegRef(persistent ? persistent
1474 list<string> tl, pl;
1484 set_union(pl.begin(), pl.end(), tl.begin(), tl.end(),
1496 ((*m_Transient).*action)();
1497 ((*m_Persistent).*action)();
1514 const string& comment)
1541 const string& section,
const string& name,
1586 if (xoverride_path && *xoverride_path) {
1600 <<
"NCBI_CONFIG_OVERRIDES names nonexistent file "
1609 : m_RuntimeOverrideCount(0), m_Flags(
flags)
1617 : m_RuntimeOverrideCount(0), m_Flags(
flags)
1642 if (getenv(
"NCBI_DONT_USE_NCBIRC")) {
1646 if (
HasEntry(
"NCBI",
"DONT_USE_NCBIRC")) {
1661 "Syntax error in system-wide configuration file: "
1696 crwreg->Read(is,
flags);
1703 list<string> sections;
1705 ITERATE (list<string>, sit, sections) {
1716 nc_main_reg.
Set(*sit, *eit, crwreg->Get(*sit, *eit),
flags);
1736 if (section.empty()) {
1782 if (name.size() > 1 && name[0] ==
'.') {
1784 "The sub-registry name " + name +
" is reserved.", 0);
1788 <<
"Reserved priority value automatically downgraded.");
1791 x_Add(reg, prio, name);
1799 "The primary portion of the registry may not be removed.",
1814 const string& entry,
1834 s += it->second->Get(
"NCBI",
".Inherits");
1839 _TRACE(
"LoadBaseRegistries(" <<
this
1840 <<
"): trying file registry");
1843 ->Get(
"NCBI",
".Inherits");
1850 if (
names.empty())
return false;
1851 _TRACE(
"LoadBaseRegistries(" <<
this <<
"): using " << s);
1854 typedef pair<string, CRef<IRWRegistry> > TNewBase;
1855 typedef vector<TNewBase> TNewBases;
1873 metareg_flags,
flags,
1878 metareg_flags,
flags,
1883 bases.push_back(TNewBase(*it, entry2.
registry));
1886 <<
" absent or unreadable");
1896 return !bases.empty();
1930 flags &= ~it->second;
1948 flags &= ~it->second;
1962 if (section.empty() || name.empty()) {
1967 result = &(reg->GetComment(section, name,
flags));
1991 it->second->EnumerateInSectionComments(section, &
tmp,
2008 ITERATE(SetNoCase, it, accum) {
2016 ((*m_AllRegistries).*action)();
2033 const string& comment)
2037 _TRACE(
'[' << section <<
']' << name <<
" = " <<
value);
2041 if (
value.empty()) {
2042 bool was_empty =
Get(section, name,
flags).empty();
2050 if ((it->second &= ~flags2) == 0) {
2073 const string& section,
2110 case eEntry:
return "eEntry";
2111 case eValue:
return "eValue";
2114 case eErr:
return "eErr";
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.
#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
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)
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.
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]