NCBI C++ ToolKit
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
CThemeSet Class Reference

Search Toolkit Book for CThemeSet

styles other types of values. More...

#include <gui/config/theme_set.hpp>

+ Inheritance diagram for CThemeSet:
+ Collaboration diagram for CThemeSet:

Public Member Functions

 CThemeSet (const string &key, CGuiRegistry *config_cache, const string &delim=kDefaultDelim)
 
virtual ~CThemeSet ()
 
void Uncache ()
 uncache any lookup data More...
 
vector< stringGetTypes () const
 Get a list of type keys of the settings this manages. More...
 
vector< stringGetTypeDescriptions () const
 Get a list of the names (user displayable) of the settings this manages. More...
 
list< stringGetSetsStyles (const string &type) const
 for a given managed set, get the names of all its styles. More...
 
string GetSetsCurrentStyleName (const string &type) const
 for a given managed set, get its current style. More...
 
void SetSetsCurrentStyleName (const string &type, const string &new_style)
 for a given managed set, change its current style. More...
 
string GetSetsDescription (const string &type) const
 for a given managed set, get its name. More...
 
void SetMyCurrentStyleName (const string &type)
 In case the 'type' SettingsSet current setting, might have gotten changed outside this theme, sync this theme back to it. More...
 
const CSettingsSetGetSettingsSet (const string &type) const
 interface functions for the member m_Settings. More...
 
CSettingsSetSetSettingsSet (const string &type)
 
void DumpAll (CNcbiOstream &ostr)
 
- Public Member Functions inherited from CSettingsSet
 CSettingsSet (const string &type, CGuiRegistry *registry=0, const string &delim=kDefaultDelim)
 constructor More...
 
virtual ~CSettingsSet ()
 
void Uncache ()
 uncache any cached lookup data More...
 
const stringGetType (void) const
 Return the type passed in the constructor. More...
 
string GetCurrentStyleName (void) const
 
void SetCurrentStyleName (const string &new_style)
 
void SetDefaultCurrentStyle ()
 These are so that you can get data that is all default values. More...
 
void RestoreCurrentStyle ()
 
string GetTypeDescription (void) const
 
void MakeTempData ()
 Have the data prepare itself to be modified. More...
 
void MakeTempData (const objects::CUser_object &uo, bool writable=false)
 Overlay some external config information on the data. More...
 
const objects::CUser_object & GetTempData ()
 Retrieve that external data back again (probably after some modifications, prior to doing CancelTempData). More...
 
void CancelTempData ()
 Throw away any modifications made to the data. More...
 
void MergeTempData ()
 Save modifications to the data. More...
 
list< stringGetStyleNames (void) const
 Methods to edit our list of valid styles. More...
 
string AddStyle (void)
 these all return the name of the style just added. More...
 
string DuplicateStyle (const string &style)
 
string RenameStyle (const string &old_style, const string &new_style)
 
bool CanRenameStyle (const string &style)
 
bool DeleteStyle (const string &style)
 
bool Delete (const string &key, const string &delim=kDefaultDelim)
 Delete a key/value in the current settings. More...
 
string GetFeatReadKey (TFeatSubtype feat_subtype, const string &section, const string &subkey=kEmptyStr, const string &delim=kDefaultDelim) const
 retrieve the key name to read values for a given feature subtype More...
 
void DumpAll (CNcbiOstream &ostr)
 write all keys and values we know about. More...
 
string GetCurrentStyleKey (void) const
 
void SetCurrentStyleKey (const string &new_style_key)
 
string GetString (const string &key, const string &default_val=kEmptyStr, const string &delim=kDefaultDelim) const
 Retrieve a named string value from a section.key. More...
 
int GetInt (const string &key, int default_val=0, const string &delim=kDefaultDelim) const
 Retrieve a named int value from a section.key. More...
 
double GetReal (const string &key, double default_val=0, const string &delim=kDefaultDelim) const
 Retrieve a named double value from a section.key. More...
 
bool GetBool (const string &key, bool default_val=false, const string &delim=kDefaultDelim) const
 Retrieve a named bool value from a section.key. More...
 
CRgbaColor GetColor (const string &key, const CRgbaColor &default_val=CRgbaColor(), const string &delim=kDefaultDelim) const
 Retrieve a named color value from a section.key. More...
 
void GetIntVec (const string &key, vector< int > &val, const string &delim=kDefaultDelim) const
 Retrieve a named int vector value from a section.key. More...
 
void GetRealVec (const string &key, vector< double > &val, const string &delim=kDefaultDelim) const
 Retrieve a named real vector value from a section.key. More...
 
void GetStringVec (const string &key, vector< string > &val, const string &delim=kDefaultDelim) const
 Retrieve a named string vector value from a section.key. More...
 
void Set (const string &key, int val, const string &delim=kDefaultDelim)
 set a named integer value More...
 
void Set (const string &key, double val, const string &delim=kDefaultDelim)
 set a named real value More...
 
void Set (const string &key, bool val, const string &delim=kDefaultDelim)
 set a named bool value More...
 
void Set (const string &key, const string &val, const string &delim=kDefaultDelim)
 ste a named string value More...
 
void Set (const string &key, const char *val, const string &delim=kDefaultDelim)
 set a named string value as a const char* (avoids implicit conversion to bool) More...
 
void Set (const string &key, const vector< int > &val, const string &delim=kDefaultDelim)
 set a named value as a vector of ints More...
 
void Set (const string &key, const vector< double > &val, const string &delim=kDefaultDelim)
 set a named value as a vector of reals More...
 
void Set (const string &key, const vector< string > &val, const string &delim=kDefaultDelim)
 set a named value as a vector of strings More...
 
void Set (const string &key, const CRgbaColor &val, const string &delim=kDefaultDelim)
 set a named value as a color More...
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 

Private Types

typedef map< string, CSettingsSetTSettingsReg
 

Private Member Functions

string x_GetSetsCurrentStyleKey (const string &type) const
 
void x_SetSetsCurrentStyleKey (const string &type, const string &new_key)
 
void x_AddSettingsSet (const string &type, CSettingsSet &set)
 
 CThemeSet (const CThemeSet &)
 forbidden More...
 
CThemeSetoperator= (const CThemeSet &)
 

Private Attributes

TSettingsReg m_Settings
 

Additional Inherited Members

- Public Types inherited from CSettingsSet
typedef int TFeatSubtype
 we use int instead of CSeqFeatData::ESubtype for two reasons: More...
 
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1, eAllocFillZero, eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef CAtomicCounter TCounter
 Counter type is CAtomiCounter. More...
 
typedef TCounter::TValue TCount
 Alias for value type of counter. More...
 
- Static Public Member Functions inherited from CSettingsSet
static string GetFeatWriteKey (TFeatSubtype feat_subtype, const string &section, const string &delim=kDefaultDelim)
 retrieve the key name to write values for a given feature subtype More...
 
static void ColorToUserField (const CRgbaColor &c, objects::CUser_field &f)
 convert a color into a vector of ints within a user field More...
 
static bool UserFieldToColor (const objects::CUser_field &f, CRgbaColor &c)
 convert a user field into a color. More...
 
- Static Public Member Functions inherited from CObject
static NCBI_NORETURN void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_NORETURN void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 
- Static Public Attributes inherited from CSettingsSet
static const string kDefaultDelim
 must be the same used as a default in CGuiRegistry. More...
 
- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 
- Protected Member Functions inherited from CSettingsSet
string x_GetStyleName (const string &key) const
 every style has a name and a key. More...
 
string x_GetStyleKey (const string &name) const
 
string x_MakeUniqueStyleName (const string &name) const
 make unique names and keys. More...
 
string x_MakeUniqueStyleKey (const string &key) const
 
CGuiRegistry::CReadView x_GetReadView (const string &section, const string &delim=kDefaultDelim) const
 Retrieve a read-only view. More...
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 
- Static Protected Attributes inherited from CSettingsSet
static const string sm_DefaultValuesKey
 the key for the default set of values. More...
 

Detailed Description

styles other types of values.

CThemeSet is an adapter of the CGuiRegistry, layered on top of CSettingsSet. Besides the key hierarchy that CSettingSet expects, a CThemeSet expects a subkey 'sets' followed by keys which are the type keys of the other CSettingsSet's it tracks, whose values are the styles they will have. Example:

GBPlugins MyTheme name = Prefs for My Plugin current = default_set default_values name = * sets FeatColors = default_set Sizes = default_set ncbitheme name = NCBI Theme sets Sizes = compact ... FeatColors name = Feature Colors ... Sizes name = Element Sizes default_values ... compact ...

Definition at line 80 of file theme_set.hpp.

Member Typedef Documentation

Definition at line 123 of file theme_set.hpp.

Constructor & Destructor Documentation

CThemeSet::CThemeSet ( const string key,
CGuiRegistry config_cache,
const string delim = kDefaultDelim 
)
CThemeSet::~CThemeSet ( )
virtual

Definition at line 64 of file theme_set.cpp.

CThemeSet::CThemeSet ( const CThemeSet )
private

forbidden

Member Function Documentation

void CThemeSet::DumpAll ( CNcbiOstream ostr)
string CThemeSet::GetSetsCurrentStyleName ( const string type) const

for a given managed set, get its current style.

See also
CSettingsSet::GetCurrentStyleName().

Definition at line 111 of file theme_set.cpp.

References GetSettingsSet(), x_GetSetsCurrentStyleKey(), and CSettingsSet::x_GetStyleName().

string CThemeSet::GetSetsDescription ( const string type) const

for a given managed set, get its name.

See also
CSettingsSet::GetTypeDescription

Definition at line 145 of file theme_set.cpp.

References GetSettingsSet(), and CSettingsSet::GetTypeDescription().

list< string > CThemeSet::GetSetsStyles ( const string type) const

for a given managed set, get the names of all its styles.

See also
CSettingsSet::GetStyleNames

Definition at line 104 of file theme_set.cpp.

References GetSettingsSet(), and CSettingsSet::GetStyleNames().

const CSettingsSet & CThemeSet::GetSettingsSet ( const string type) const
vector< string > CThemeSet::GetTypeDescriptions ( ) const

Get a list of the names (user displayable) of the settings this manages.

Definition at line 92 of file theme_set.cpp.

References GetSettingsSet(), CSettingsSet::GetTypeDescription(), GetTypes(), ITERATE, and types.

vector< string > CThemeSet::GetTypes ( ) const

Get a list of type keys of the settings this manages.

Definition at line 77 of file theme_set.cpp.

References CGuiRegistry::CReadView::GetTopKeys(), ITERATE, kSetsKey(), and CSettingsSet::x_GetReadView().

Referenced by CThemeSet(), DumpAll(), and GetTypeDescriptions().

CThemeSet& CThemeSet::operator= ( const CThemeSet )
private
void CThemeSet::SetMyCurrentStyleName ( const string type)

In case the 'type' SettingsSet current setting, might have gotten changed outside this theme, sync this theme back to it.

Definition at line 139 of file theme_set.cpp.

References CSettingsSet::GetCurrentStyleKey(), GetSettingsSet(), and x_SetSetsCurrentStyleKey().

void CThemeSet::SetSetsCurrentStyleName ( const string type,
const string new_style 
)
CSettingsSet & CThemeSet::SetSettingsSet ( const string type)
void CThemeSet::Uncache ( )

uncache any lookup data

Definition at line 69 of file theme_set.cpp.

References m_Settings, and NON_CONST_ITERATE.

void CThemeSet::x_AddSettingsSet ( const string type,
CSettingsSet set 
)
private

Definition at line 170 of file theme_set.cpp.

References map_checker< Container >::insert(), and m_Settings.

Referenced by CThemeSet().

string CThemeSet::x_GetSetsCurrentStyleKey ( const string type) const
private
void CThemeSet::x_SetSetsCurrentStyleKey ( const string type,
const string new_key 
)
private

Member Data Documentation

TSettingsReg CThemeSet::m_Settings
private

Definition at line 124 of file theme_set.hpp.

Referenced by GetSettingsSet(), SetSettingsSet(), Uncache(), and x_AddSettingsSet().


The documentation for this class was generated from the following files:
Modified on Mon Nov 20 15:50:46 2017 by modify_doxy.py rev. 546573