The parameter manager class This class manages a parameter XML document. More...
#include <Parameter.h>
Public Member Functions | |
void | CheckDocument () const |
void | CreateDocument () |
int | LoadDocument (const char *sFileName) |
int | LoadDocument (const XERCES_CPP_NAMESPACE_QUALIFIER InputSource &) |
bool | LoadOrCreateDocument (const char *sFileName) |
ParameterManager () | |
Default construction. More... | |
void | SaveDocument (const char *sFileName) const |
void | SaveDocument (XERCES_CPP_NAMESPACE_QUALIFIER XMLFormatTarget *pFormatTarget) const |
~ParameterManager () | |
Destruction complete destruction of the object. More... | |
Public Member Functions inherited from ParameterGrp | |
void | copyTo (Base::Reference< ParameterGrp >) |
make a deep copy to the other group More... | |
void | insertTo (Base::Reference< ParameterGrp >) |
overwrite everything similar, leave the others alone More... | |
void | exportTo (const char *FileName) |
export this group to a file More... | |
void | importFrom (const char *FileName) |
import from a file to this group More... | |
void | insert (const char *FileName) |
insert from a file to this group, overwrite only the similar More... | |
bool | GetBool (const char *Name, bool bPreset=false) const |
read bool values or give default More... | |
void | SetBool (const char *Name, bool bValue) |
set a bool value More... | |
std::vector< bool > | GetBools (const char *sFilter=nullptr) const |
get a vector of all bool values in this group More... | |
std::vector< std::pair< std::string, bool > > | GetBoolMap (const char *sFilter=nullptr) const |
get a map with all bool values and the keys of this group More... | |
void | RemoveBool (const char *Name) |
remove a bool value from this group More... | |
long | GetInt (const char *Name, long lPreset=0) const |
read bool values or give default More... | |
void | SetInt (const char *Name, long lValue) |
set a int value More... | |
std::vector< long > | GetInts (const char *sFilter=nullptr) const |
get a vector of all int values in this group More... | |
std::vector< std::pair< std::string, long > > | GetIntMap (const char *sFilter=nullptr) const |
get a map with all int values and the keys of this group More... | |
void | RemoveInt (const char *Name) |
remove a int value from this group More... | |
unsigned long | GetUnsigned (const char *Name, unsigned long lPreset=0) const |
read uint values or give default More... | |
void | SetUnsigned (const char *Name, unsigned long lValue) |
set a uint value More... | |
std::vector< unsigned long > | GetUnsigneds (const char *sFilter=nullptr) const |
get a vector of all uint values in this group More... | |
std::vector< std::pair< std::string, unsigned long > > | GetUnsignedMap (const char *sFilter=nullptr) const |
get a map with all uint values and the keys of this group More... | |
void | RemoveUnsigned (const char *Name) |
remove a uint value from this group More... | |
double | GetFloat (const char *Name, double dPreset=0.0) const |
set a float value More... | |
void | SetFloat (const char *Name, double dValue) |
read float values or give default More... | |
std::vector< double > | GetFloats (const char *sFilter=nullptr) const |
get a vector of all float values in this group More... | |
std::vector< std::pair< std::string, double > > | GetFloatMap (const char *sFilter=nullptr) const |
get a map with all float values and the keys of this group More... | |
void | RemoveFloat (const char *Name) |
remove a float value from this group More... | |
void | SetBlob (const char *Name, void *pValue, long lLength) |
set a blob value More... | |
void | GetBlob (const char *Name, void *pBuf, long lMaxLength, void *pPreset=nullptr) const |
read blob values or give default More... | |
void | RemoveBlob (const char *Name) |
remove a blob value from this group More... | |
Base::Reference< ParameterGrp > | GetGroup (const char *Name) |
get a handle to a sub group or create one More... | |
std::vector< Base::Reference< ParameterGrp > > | GetGroups () |
get a vector of all sub groups in this group More... | |
bool | IsEmpty () const |
test if this group is empty More... | |
bool | HasGroup (const char *Name) const |
test if a special sub group is in this group More... | |
void | RemoveGrp (const char *Name) |
remove a sub group from this group More... | |
bool | RenameGrp (const char *OldName, const char *NewName) |
rename a sub group from this group More... | |
void | Clear () |
clears everything in this group (all types) More... | |
void | SetASCII (const char *Name, const char *sValue) |
set a string value More... | |
std::string | GetASCII (const char *Name, const char *pPreset=nullptr) const |
read a string values More... | |
void | RemoveASCII (const char *Name) |
remove a string value from this group More... | |
std::vector< std::string > | GetASCIIs (const char *sFilter=nullptr) const |
Return all string elements in this group as a vector of strings Its also possible to set a filter criteria. More... | |
std::vector< std::pair< std::string, std::string > > | GetASCIIMap (const char *sFilter=nullptr) const |
Same as GetASCIIs() but with key,value map. More... | |
const char * | GetGroupName () const |
returns the name More... | |
void | NotifyAll () |
Notifies all observers for all entries except of sub-groups. More... | |
Public Member Functions inherited from Base::Handled | |
int | getRefCount () const |
Handled () | |
const Handled & | operator= (const Handled &) |
void | ref () const |
void | unref () const |
virtual | ~Handled () |
Public Member Functions inherited from Base::Subject< const char * > | |
void | Attach (Observer< const char * > *ToObserv) |
Attach an Observer Attach an Observer to the list of Observers which get called when Notify is called. More... | |
void | ClearObserver () |
Clears the list of all registered observers. More... | |
void | Detach (Observer< const char * > *ToObserv) |
Detach an Observer Detach an Observer from the list of Observers which get called when Notify is called. More... | |
Observer< const char * > * | Get (const char *Name) |
Get an Observer by name Get a observer by name if the observer reimplements the Name() mthode. More... | |
void | Notify (const char * rcReason) |
Notify all Observers Send a message to all Observers attached to this subject. More... | |
Subject () | |
A constructor. More... | |
virtual | ~Subject () |
A destructor. More... | |
Static Public Member Functions | |
static void | Init () |
static void | Terminate () |
Parameter serialization | |
void | SetSerializer (ParameterSerializer *) |
Sets a serializer. The ParameterManager takes ownership of the serializer. More... | |
bool | HasSerializer () const |
Returns true if a serializer is set, otherwise false is returned. More... | |
int | LoadDocument () |
Loads an XML document by calling the serializer's load method. More... | |
bool | LoadOrCreateDocument () |
Loads or creates an XML document by calling the serializer's load method. More... | |
void | SaveDocument () const |
Saves an XML document by calling the serializer's save method. More... | |
Additional Inherited Members | |
Public Types inherited from ParameterGrp | |
typedef Base::Reference< ParameterGrp > | handle |
type of the handle More... | |
Public Types inherited from Base::Subject< const char * > | |
typedef const char * | MessageType |
typedef Observer< const char * > | ObserverType |
typedef Subject< const char * > | SubjectType |
Protected Member Functions inherited from ParameterGrp | |
ParameterGrp (XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *GroupNode=nullptr, const char *sName=nullptr) | |
constructor is protected (handle concept) More... | |
~ParameterGrp () | |
destructor is protected (handle concept) More... | |
bool | ShouldRemove () const |
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | FindNextElement (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *Prev, const char *Type) const |
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | FindElement (XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *Start, const char *Type, const char *Name=nullptr) const |
Find an element specified by Type and Name Search in the parent element Start for the first occurrence of an element of Type and with the attribute Name=Name. More... | |
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * | FindOrCreateElement (XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *Start, const char *Type, const char *Name) const |
Find an element specified by Type and Name or create it if not found Search in the parent element Start for the first occurrence of an element of Type and with the attribute Name=Name. More... | |
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * | FindAttribute (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *Node, const char *Name) const |
Find an attribute specified by Name. More... | |
The parameter manager class This class manages a parameter XML document.
Does loading, saving and handling the DOM document.
ParameterManager::ParameterManager | ( | ) |
Default construction.
References Init().
ParameterManager::~ParameterManager | ( | ) |
Destruction complete destruction of the object.
void ParameterManager::CheckDocument | ( | ) | const |
References Base::Console(), Base::ConsoleSingleton::Error(), and SaveDocument().
Referenced by Gui::Dialog::DlgParameterImp::onChangeParameterSet().
void ParameterManager::CreateDocument | ( | ) |
Referenced by ParameterGrp::exportTo(), LoadOrCreateDocument(), and Gui::PreferencePackManager::save().
bool ParameterManager::HasSerializer | ( | ) | const |
Returns true if a serializer is set, otherwise false is returned.
Referenced by Gui::Dialog::DlgParameterImp::onChangeParameterSet().
|
static |
Referenced by ParameterManager().
int ParameterManager::LoadDocument | ( | ) |
Loads an XML document by calling the serializer's load method.
References ParameterSerializer::LoadDocument().
Referenced by LoadDocument(), and LoadOrCreateDocument().
int ParameterManager::LoadDocument | ( | const char * | sFileName | ) |
int ParameterManager::LoadDocument | ( | const XERCES_CPP_NAMESPACE_QUALIFIER InputSource & | inputSource | ) |
References ParameterGrp::FindElement().
bool ParameterManager::LoadOrCreateDocument | ( | ) |
Loads or creates an XML document by calling the serializer's load method.
References ParameterSerializer::LoadOrCreateDocument().
bool ParameterManager::LoadOrCreateDocument | ( | const char * | sFileName | ) |
References CreateDocument(), and LoadDocument().
Referenced by ParameterSerializer::LoadOrCreateDocument().
void ParameterManager::SaveDocument | ( | ) | const |
Saves an XML document by calling the serializer's save method.
References ParameterSerializer::SaveDocument().
Referenced by CheckDocument(), and SaveDocument().
void ParameterManager::SaveDocument | ( | const char * | sFileName | ) | const |
References SaveDocument().
Referenced by Gui::RecentFilesAction::appendFile(), Gui::RecentMacrosAction::appendFile(), Gui::PreferencePack::apply(), ParameterGrp::exportTo(), Gui::Dialog::DlgParameterImp::on_buttonSaveToDisk_clicked(), Gui::PreferencePackManager::save(), and ParameterSerializer::SaveDocument().
void ParameterManager::SaveDocument | ( | XERCES_CPP_NAMESPACE_QUALIFIER XMLFormatTarget * | pFormatTarget | ) | const |
void ParameterManager::SetSerializer | ( | ParameterSerializer * | ps | ) |
Sets a serializer. The ParameterManager takes ownership of the serializer.
|
static |
References XMLTools::terminate().
Referenced by App::Application::destruct().