4#include "KVClassFactory.h"
5#include "KVNameValueList.h"
20 : fList(), fIgnoreBool(kFALSE)
101 if (&o !=
this) o.
Copy(*
this);
156 if (!list.
Contains(
"="))
return false;
160 while (!list.
End()) {
209 for (
auto& par : *
this) {
210 if (list.
Length()) list +=
",";
211 list +=
Form(
"%s=", par.GetName());
213 list += par.GetString();
214 else if (par.IsDouble())
215 list +=
Form(
"%g", par.GetDouble());
216 else if (par.IsInt())
217 list +=
Form(
"%d", par.GetInt());
282 for (
Int_t ii = 0; ii < np1; ii += 1) {
287 TIter next(&toBeRemoved);
310 cout <<
"KVNameValueList::" <<
GetName() <<
" : " <<
GetTitle() <<
" (" <<
this <<
")" << endl;
325 else cout <<
"KVNameValueList";
327 for (
int i = 0; i <
GetNpar(); ++i) {
343 if (i <
GetNpar() - 1) cout <<
",";
389 for (
Int_t ii = 0; ii < np1; ii += 1) {
390 for (
Int_t jj = 0; jj < np2; jj += 1) {
564 while ((par = next())) {
568 Error(
"GetNameIndex",
"Parameter \"%s\" not found, -1 returned",
name);
588 Error(
"GetNameAt",
"index has to be less than %d, empty string is returned",
GetNpar());
609 Error(
"GetStringValue(const Char_t*)",
"\"%s\" does not correspond to an existing parameter, default value \"-1\" is returned",
name);
640 Error(
"GetStringValue(Int_t)",
"index has to be less than %d, \"-1\" is returned\n",
GetNpar());
687 Error(
"ReadEnvFile",
"The file %s does not exist",
filename);
691 TIter next_nv(name_value_list);
693 while ((nv_pair = (
TEnvRec*)next_nv())) {
705 if (!
fIgnoreBool && (PARVAL ==
"TRUE" || PARVAL ==
"FALSE" || PARVAL ==
"ON" || PARVAL ==
"OFF"
706 || PARVAL ==
"YES" || PARVAL ==
"NO" || PARVAL ==
"OK" || PARVAL ==
"NOT"))
822 for (
int i = 0; i < other.
GetNpar(); ++i) {
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
char * Form(const char *fmt,...)
Factory class for generating skeleton files for new classes.
void GenerateCode()
Generate header and implementation file for currently-defined class.
void AddGetSetMethods(const KVNameValueList &)
For each named parameter in the list, we add protected member variables with the name and type of the...
Extension of TEnv to allow the writing of comments in the file.
Extended version of ROOT THashList.
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
virtual void Print(Option_t *opt="") const
KVNamedParameter * GetParameter(Int_t idx) const
return the parameter object with index idx
virtual void ls(Option_t *opt="") const
Int_t GetIntValue(const Char_t *name) const
Bool_t HasValue64bit(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
virtual ~KVNameValueList()
Destructor.
Bool_t fIgnoreBool
do not convert "yes", "false", "on", etc. in TEnv file to boolean
void RemoveParameter(const Char_t *name)
Int_t Compare(const TObject *nvl) const
void SetValue64bit(const Char_t *name, ULong64_t)
void SetFromEnv(TEnv *tenv, const TString &prefix="")
virtual void Clear(Option_t *opt="")
const Char_t * GetNameAt(Int_t idx) const
Int_t GetNpar() const
return the number of stored parameters
virtual void ReadEnvFile(const Char_t *filename)
virtual void WriteEnvFile(const Char_t *filename)
Write all name-value pairs in this list as a TEnv format file.
Int_t GetNameIndex(const Char_t *name) const
void Merge(const KVNameValueList &)
KVNameValueList()
Default constructor.
KVNamedParameter * FindParameter(const Char_t *name) const
return the parameter object with the asking name
KVNameValueList operator+=(const KVNameValueList &nvl)
KVNameValueList & operator=(const KVNameValueList &)
KVHashList fList
list of KVNamedParameter objects
Bool_t HasIntParameter(const Char_t *name) const
void SetOwner(Bool_t enable=kTRUE)
virtual KVEnv * ProduceEnvFile()
void WriteClass(const Char_t *classname, const Char_t *classdesc, const Char_t *base_class="")
ULong64_t GetValue64bit(const Char_t *name) const
bool Set(const KVString &)
Bool_t HasParameter(const Char_t *name) const
void AddValue(const KVNamedParameter &p)
KVHashList * GetList() const
TString GetTStringValue(const Char_t *name) const
void Copy(TObject &nvl) const
virtual void ClearSelection(TRegexp &)
void WriteToEnv(TEnv *tenv, const TString &prefix="")
A generic named parameter storing values of different types.
const Char_t * GetString() const
void Set(const char *, const char *)
void Add(const KVNamedParameter &p)
Double_t GetDouble() const
virtual void ls(Option_t *opt="") const
void WriteToEnv(TEnv *, const TString &p="")
Write parameter in TEnv, using optional prefix p as "p.[name]".
TString GetTString() const
virtual TObject * FindObject(const char *name) const
virtual void Copy(TObject &obj) const
virtual void SetOwner(Bool_t enable=kTRUE)
virtual void Clear(Option_t *option="")
virtual TObject * At(Int_t idx) const
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from list.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
virtual Int_t GetEntries() const
const char * GetValue() const
const char * GetName() const override
THashList * GetTable() const
virtual const char * GetValue(const char *name, const char *dflt) const
virtual void SetRcName(const char *name)
virtual Int_t ReadFile(const char *fname, EEnvLevel level)
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
void Add(TObject *obj) override
void Delete(Option_t *option="") override
void Copy(TObject &named) const override
virtual void SetTitle(const char *title="")
const char * GetName() const override
const char * GetTitle() const override
virtual void SetName(const char *name)
virtual const char * GetName() const
virtual void Error(const char *method, const char *msgfmt,...) const
static Int_t IncreaseDirLevel()
static void IndentLevel()
static Int_t DecreaseDirLevel()
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
unsigned long long ULong64_t
Type GetType(const std::string &Name)