view.
m_Fields.push_back(section_obj);
83 constvector<string>& subsections)
const 91vector<string>::const_reverse_iterator riter(subsections.end());
92vector<string>::const_reverse_iterator rend(subsections.begin());
93 for(; riter != rend; ++riter) {
106list< CConstRef<CUser_field> > fields;
113fields.push_back(field);
126 return(field && field->GetData().IsInt()) ?
127field->GetData().GetInt() : default_val;
132 return(field && field->GetData().IsReal()) ?
133field->GetData().GetReal() : default_val;
138 return(field && field->GetData().IsBool()) ?
139field->GetData().GetBool() : default_val;
144 return(field && field->GetData().IsStr()) ?
145field->GetData().GetStr() : default_val;
153 if(field->GetData().IsInt()) {
154 val.push_back(field->GetData().GetInt());
156 else if(field->GetData().IsInts()) {
157 val= field->GetData().GetInts();
159 else if(field->GetData().IsFields()) {
162 if(
f.GetData().IsInt()) {
163 val.push_back(
f.GetData().GetInt());
165 else if(
f.GetData().IsInts()) {
167 f.GetData().GetInts().begin(),
168 f.GetData().GetInts().end());
179 if(field->GetData().IsReal()) {
180 val.push_back(field->GetData().GetReal());
182 else if(field->GetData().IsReals()) {
183 val= field->GetData().GetReals();
185 else if(field->GetData().IsFields()) {
188 if(
f.GetData().IsReal()) {
189 val.push_back(
f.GetData().GetReal());
191 else if(
f.GetData().IsReals()) {
193 f.GetData().GetReals().begin(),
194 f.GetData().GetReals().end());
205 if(field->GetData().IsStr()) {
206 val.push_back(field->GetData().GetStr());
208 else if(field->GetData().IsStrs()) {
210field->GetData().GetStrs().begin(),
211field->GetData().GetStrs().end());
213 else if(field->GetData().IsFields()) {
216 if(
f.GetData().IsStr()) {
217 val.push_back(
f.GetData().GetStr());
219 else if(
f.GetData().IsStrs()) {
221 f.GetData().GetStrs().begin(),
222 f.GetData().GetStrs().end());
274 std::copy(v.begin(), v.end(), std::back_inserter(
val));
296 if(!
info.key.empty()) {
301key_info.push_back(
info);
330TFields::const_reverse_iterator riter(
m_Fields.rbegin());
331TFields::const_reverse_iterator rend(
m_Fields.rend());
333 for(; riter != rend; ++riter) {
342key_map[key_it->key] = *key_it;
349keys.push_back(iter->second);
374 if(fields.size() == 1)
375 returnfields.front();
377 intmerge_policy = 0;
380 if(merge_field && merge_field->
GetData().
IsStr()) {
383 if(
str==
"append") {
386 else if(
str==
"prepend") {
396 switch(merge_policy) {
403(
const_cast<CUser_field*
>(iter->GetPointer()));
404field->
SetData().SetFields().push_back(
f);
412std::reverse(fields.begin(), fields.end());
416(
const_cast<CUser_field*
>(iter->GetPointer()));
417field->
SetData().SetFields().push_back(
f);
422 returnfields.front();
431ostr << keys.size() <<
" keys:"<< endl;
435ostr <<
key.key <<
"|";
439vector<double> reals;
440 switch(
key.type) {
450 copy(ints.begin(), ints.end(), ostream_iterator<int>(ostr,
";"));
458 copy(reals.begin(), reals.end(), ostream_iterator<double>(ostr,
";"));
466 copy(strs.begin(), strs.end(), ostream_iterator<string>(ostr,
";"));
485: m_Section(section), m_RegistryFile(®File)
518 "Too few components in key \""+
key+
"\"");
587v.reserve(
val.size());
CRef< objects::CUser_field > SetField(const string &key)
bool DeleteField(const string &key)
class CRegistryReadView provides a nested hierarchical view at a particular key.
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
double GetReal(const string &key, double default_val=0) const
bool GetBool(const string &key, bool default_val=false) const
void DumpAll(CNcbiOstream &ostr) const
Dump onto the stream all the keys in this view along with their types and data values.
void GetIntVec(const string &key, vector< int > &val) const
void x_GetKeys(TKeys &keys, bool recurse) const
implementing GetTopKeys and GetKeys.
list< SKeyInfo > TKeys
retrieve information about all keys in the registry
void GetTopKeys(TKeys &keys) const
Retrieve information about the top level keys in this view.
void GetRealVec(const string &key, vector< double > &val) const
bool HasField(const string &key) const
Does a field with this section and key exist in this view?
string GetString(const string &key, const string &default_val=kEmptyStr) const
void GetStringList(const string &key, list< string > &val) const
void GetStringVec(const string &key, vector< string > &val) const
CRegistryReadView GetReadView(const string §ion) const
list< CConstRef< objects::CUser_field > > TFields
ordered list of subfields to scan
void x_AppendToReadView(CRegistryReadView &view, const string §ion) const
CConstRef< objects::CUser_field > GetField(const string &key) const
provide raw field access
bool IsEmpty()
There is nothing in this view.
static CConstRef< objects::CUser_field > ResolveField(list< CConstRef< objects::CUser_field > > &fields, const objects::CUser_field *meta)
CRegistryReadView & operator+=(const CRegistryReadView &rhs)
void GetKeys(TKeys &keys) const
Retrieve information about all keys in this view.
CRegistryWriteView GetWriteView(const string §ion)
CRegistryFile * m_RegistryFile
CRef< objects::CUser_field > SetFieldToValue(const string &key)
same as SetField, but complain loudly if the field has subfields in it already.
CRef< objects::CUser_field > SetField(const string &key)
provide raw field access
void Set(const string &key, int val)
access a named key at this level, with no recursion
bool DeleteField(const string &key)
delete the specified field (and any of its subfields) from this view and from its registry.
CConstRef< CUser_field > GetFieldRef(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Return a field reference representing the tokenized key, or a NULL reference if the key doesn't exist...
bool HasField(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Verify that a named field exists.
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
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.
void Reset(void)
Reset reference object.
TObjectType * Release(void)
Release a reference to the object and return a pointer to the object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static const string BoolToString(bool value)
Convert bool to string.
static string & ToLower(string &str)
Convert string to lower case â string& version.
const TStr & GetStr(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
const TFields & GetFields(void) const
Get the variant data.
vector< CRef< CUser_field > > TFields
bool IsFields(void) const
Check if variant Fields is selected.
bool IsStr(void) const
Check if variant Str is selected.
const TStr & GetStr(void) const
Get the variant data.
void SetData(TData &value)
Assign a value to Data data member.
const TLabel & GetLabel(void) const
Get the Label member data.
vector< CStringUTF8 > TStrs
E_Choice Which(void) const
Which variant is currently selected.
const struct ncbi::grid::netcache::search::fields::KEY key
const struct ncbi::grid::netcache::search::fields::SUBKEY subkey
intr::rbtree< SNCCacheData, intr::base_hook< TKeyMapHook >, intr::constant_time_size< true >, intr::compare< SCacheKeyCompare > > TKeyMap
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static const char * kEmptyViewError
static const string kDecimalDot
static void s_ExtractKeys(const CUser_field &field, const string &root, CRegistryReadView::TKeys &key_info, bool recurse)
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