112 #ifdef NCBI_STRICT_GI
147 field->SetLabel().SetStr(
label);
148 field->SetValue(
value);
154 const vector<int>&
value)
165 const vector<double>&
value)
218 "failed to find field named " +
str);
234 if ( !
f->GetData().IsFields() ) {
235 if (toks.size() == 1 &&
236 f->GetLabel().IsStr() &&
237 NStr::Equal(
f->GetLabel().GetStr(), toks.front(), use_case))
246 list<string>::const_iterator
last = toks.end();
249 ITERATE (list<string>, iter, toks) {
282 ostream & out_name_strm,
const string & delim)
const
289 out_name_strm << delim;
291 out_name_strm << *chain_iter;
312 out_mapFieldNameToRef.
insert(
325 (*field_iter)->GetFieldsMap(out_mapFieldNameToRef,
357 list<string>::const_iterator
last = toks.end();
359 ITERATE (list<string>, iter, toks) {
382 f->SetData().SetFields().push_back(new_f);
398 return f.GetPointer() !=
NULL;
412 list<string>::const_iterator
last = toks.end();
415 ITERATE (list<string>, iter, toks) {
417 if ( !
f->GetData().IsFields() ) {
428 }
else if (iter ==
last) {
430 f->SetData().SetFields().erase(field_iter);
496 "array size is too big to fit into User-field.num: " <<
value);
552 if (
data.IsInt() ) {
553 return data.GetInt();
555 if (
data.IsReal() ) {
556 double v =
data.GetReal();
561 return NStr::StringToNumeric<Int8>(
data.GetStr());
static const Int8 kMaxAsReal
Root class for all serialization exceptions.
CRef< CUser_field > SetFieldRef(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase)
Return a field reference representing the tokenized key, or a NULL reference if the key cannot be cre...
@ fFieldMapFlags_ExcludeThis
= 0x1 (excludes this CUser_field's name and mapping to self from results)
bool DeleteField(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase)
Delete the named field.
CUser_field & SetString(const char *value)
const CUser_field & GetField(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Access a named field in this user field.
void SetNumFromSize(size_t value)
Set num field from a container size Check for overflow and throw CSerialException::eOverflow if the s...
@ eParse_Number
Parse a real or integer number, otherwise string.
@ eParse_String
Add string even if all numbers.
CUser_field & SetInt8(Int8 value)
CUser_field & SetValue(int value)
set a data field to a given value Int8 and TGi values can be stored into 'str' field if the value doe...
CUser_field & SetField(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase)
Access a named field in this user field.
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...
void GetFieldsMap(CUser_field::TMapFieldNameToRef &out_mapFieldNameToRef, TFieldMapFlags fFieldMapFlags=0, const SFieldNameChain &parent_name=SFieldNameChain()) const
Recursively get the map of field names like the input for GetFieldRef to the user-field.
int TFieldMapFlags
holds bitwise OR of "EFieldMapFlags"
CUser_field & AddField(const string &label, int value)
add fields to the current user field
CUser_field & SetInt(int value)
set value
bool HasField(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Verify that a named field exists.
iterator_bool insert(const value_type &val)
container_type::value_type value_type
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
static const char * str(char *buf, int n)
#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 NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
CConstRef< C > ConstRef(const C *object)
Template function for conversion of const object pointer to CConstRef.
void Reset(void)
Reset reference object.
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
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.
ECase
Which type of string comparison.
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 bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
static const char label[]
bool IsStr(void) const
Check if variant Str is selected.
TObject & SetObject(void)
Select the variant.
TFields & SetFields(void)
Select the variant.
bool IsId(void) const
Check if variant Id is selected.
const TData & GetData(void) const
Get the Data member data.
vector< CRef< CUser_field > > TFields
bool IsFields(void) const
Check if variant Fields is selected.
TData & SetData(void)
Assign a value to Data data member.
const TStr & GetStr(void) const
Get the variant data.
void SetLabel(TLabel &value)
Assign a value to Label data member.
TObjects & SetObjects(void)
Select the variant.
TReals & SetReals(void)
Select the variant.
TInts & SetInts(void)
Select the variant.
TNum & SetNum(void)
Assign a value to Num data member.
const TLabel & GetLabel(void) const
Get the Label member data.
TStrs & SetStrs(void)
Select the variant.
vector< CStringUTF8 > TStrs
TId GetId(void) const
Get the variant data.
E_Choice Which(void) const
Which variant is currently selected.
@ e_not_set
No variant selected.
const GenericPointer< typename T::ValueType > T2 value
#define NCBI_CONST_INT8(v)
64-bit integers
Generic utility macros and templates for exploring NCBI objects.
#define FIELD_IS_SET_AND_IS(Var, Fld, Chs)
FIELD_IS_SET_AND_IS base macro.
For functions that don't use delims, we instead use a chain of names.
void Join(ostream &out_name_strm, const string &delim=".") const
Convenience func.
TFieldNameChainUnderlying m_FieldNameChain
vector< CTempStringEx > TFieldNameChainUnderlying