IRWRegistry Class Reference
[Application Registry]

Search Toolkit Book for IRWRegistry

#include <ncbireg.hpp>

Inheritance diagram for IRWRegistry:

Inheritance graph
[legend]
Collaboration diagram for IRWRegistry:

Collaboration graph
[legend]
List of all members.

Detailed Description

IRWRegistry --.

Abstract subclass for modifiable registries.

To avoid confusion, all registry classes that support modification should inherit from this class.

Definition at line 315 of file ncbireg.hpp.

Public Types

enum  EOperation { eClear, eRead, eSet }
 Categories of modifying operations. More...

Public Member Functions

void Clear (TFlags flags=fAllLayers)
 Reset the registry content.
IRWRegistryRead (CNcbiIstream &is, TFlags flags=0)
 Read and parse the stream "is", and merge its content with current Registry entries.
bool Set (const string &section, const string &name, const string &value, TFlags flags=0, const string &comment=kEmptyStr)
 Set the configuration parameter value.
bool SetComment (const string &comment, const string &section=kEmptyStr, const string &name=kEmptyStr, TFlags flags=0)
 Set comment "comment" for the registry entry "section:name".

Static Public Member Functions

static TFlags AssessImpact (TFlags flags, EOperation op)
 Indicate which portions of the registry the given operation would affect.

Protected Member Functions

virtual void x_Clear (TFlags flags)=0
 Called locked, like the virtual methods inherited from IRegistry.
virtual bool x_Set (const string &section, const string &name, const string &value, TFlags flags, const string &comment)=0
virtual bool x_SetComment (const string &comment, const string &section, const string &name, TFlags flags)=0
virtual IRWRegistryx_Read (CNcbiIstream &is, TFlags flags)
 Most implementations should not override this, but CNcbiRegistry must, to handle some special cases properly.

Static Protected Member Functions

static bool MaybeSet (string &target, const string &value, TFlags flags)


Member Enumeration Documentation

enum IRWRegistry::EOperation
 

Categories of modifying operations.

Enumerator:
eClear 
eRead 
eSet 

Definition at line 319 of file ncbireg.hpp.


Member Function Documentation

IRegistry::TFlags IRWRegistry::AssessImpact TFlags  flags,
EOperation  op
[static]
 

Indicate which portions of the registry the given operation would affect.

Definition at line 480 of file ncbireg.cpp.

References _TROUBLE, eClear, eRead, eSet, IRegistry::fJustCore, IRegistry::fLayerFlags, IRegistry::fPersistent, IRegistry::fTPFlags, and IRegistry::fTransient.

void IRWRegistry::Clear TFlags  flags = fAllLayers  ) 
 

Reset the registry content.

Definition at line 496 of file ncbireg.cpp.

References IRegistry::fInternalSpaces, IRegistry::fLayerFlags, IRegistry::fPersistent, IRegistry::fTransient, IRegistry::x_CheckFlags(), x_Clear(), IRegistry::x_Empty(), and IRegistry::x_SetModifiedFlag().

bool IRWRegistry::MaybeSet string &  target,
const string &  value,
TFlags  flags
[static, protected]
 

Definition at line 760 of file ncbireg.cpp.

Referenced by CEnvironmentRegistry::x_Set(), and CMemoryRegistry::x_SetComment().

IRWRegistry * IRWRegistry::Read CNcbiIstream is,
TFlags  flags = 0
 

Read and parse the stream "is", and merge its content with current Registry entries.

Once the Registry has been initialized by the constructor, it is possible to load other parameters from other files using this method.

Parameters:
is Input stream to read and parse. NOTE: if the stream is a file, it must be opened in binary mode!
flags How parameters are stored. The default is for all values to be read as persistent with the capability of overriding any previously loaded value associated with the same name. The default can be modified by specifying "fTransient", "fNoOverride" or "fTransient | fNoOverride". If there is a conflict between the old and the new (loaded) entry value and if "fNoOverride" flag is set, then just ignore the new value; otherwise, replace the old value by the new one. If "fTransient" flag is set, then store the newly retrieved parameters as transient; otherwise, store them as persistent.
Returns:
A pointer to a newly created subregistry, if any, directly containing the entries loaded from is.
See also:
Write()

Definition at line 511 of file ncbireg.cpp.

References IRegistry::fCountCleared, IRegistry::fIgnoreErrors, IRegistry::fInternalSpaces, IRegistry::fJustCore, IRegistry::fNoOverride, IRegistry::fTransient, IRegistry::fWithNcbirc, IRegistry::x_CheckFlags(), and x_Read().

Referenced by CIdMapperConfig::DescribeContexts(), CIdMapperConfig::Initialize(), CCodeGenerator::LoadConfig(), LoadRegistry(), CGBenchIndexCgi::ProcessRequest(), and CWindowMaskerPanel::TransferDataToWindow().

bool IRWRegistry::Set const string &  section,
const string &  name,
const string &  value,
TFlags  flags = 0,
const string &  comment = kEmptyStr
 

Set the configuration parameter value.

Unset the parameter if specified "value" is empty.

Parameters:
value Value that the parameter is set to.
flags To control search. Valid flags := { fPersistent, fNoOverride, fTruncate } If there was already an entry with the same <section,name> key: if "fNoOverride" flag is set then do not override old value and return FALSE; else override the old value and return TRUE. If "fPersistent" flag is set then store the entry as persistent; else store it as transient. If "fTruncate" flag is set then truncate the leading and trailing spaces -- " \r\t\v" (NOTE: '
' is not considered a space!).
comment Optional comment string describing parameter.
Returns:
TRUE if successful (including replacing a value with itself)

Definition at line 691 of file ncbireg.cpp.

References _ASSERT, _TRACE, IRegistry::fCountCleared, IRegistry::fInternalSpaces, IRegistry::fPersistent, IRegistry::fTruncate, NPOS, NStr::PrintableString(), s_ConvertComment(), s_IsNameSection(), NStr::TruncateSpaces(), IRegistry::x_CheckFlags(), x_Set(), and IRegistry::x_SetModifiedFlag().

Referenced by CCodeGenerator::AddConfigLine(), SBDB_CacheUnitStatistics::ConvertToRegistry(), CCodeGenerator::ExcludeTypes(), CDebugArgs::ExtractAlgorithmOptions(), GetAsnDataViaHTTP(), MakePluginManagerParamTree(), NCBITEST_AUTO_INIT(), RegistrySetBoolean(), RegistrySetDouble(), RegistrySetInteger(), RegistrySetString(), CNSSubmitRemoteJobApp::Run(), CNSRemoveJobControlApp::Run(), CColorTableMethod::Save(), CTemplateScoringMethod::SaveInfo(), CNetworkOptionsPage::TransferDataFromWindow(), CSequenceSearchForm::x_UpdateFileList(), and COrfSearchForm::x_UpdateKozak().

bool IRWRegistry::SetComment const string &  comment,
const string &  section = kEmptyStr,
const string &  name = kEmptyStr,
TFlags  flags = 0
 

Set comment "comment" for the registry entry "section:name".

Parameters:
comment Comment string value. Set to kEmptyStr to delete the comment.
section Section name. If "section" is empty string, then set as the registry comment.
name Parameter name. If "name" is empty string, then set as the "section" comment.
flags How the comment is stored. The default is for comments to be stored as persistent with the capability of overriding any previously loaded value associated with the same name. The default can be modified by specifying "fTransient", "fNoOverride" or "fTransient | fNoOverride". If there is a conflict between the old and the new comment and if "fNoOverride" flag is set, then just ignore the new comment; otherwise, replace the old comment by the new one. If "fTransient" flag is set, then store the new comment as transient (generally not desired); otherwise, store it as persistent.
Returns:
FALSE if "section" and/or "name" do not exist in registry.

Definition at line 732 of file ncbireg.cpp.

References _TRACE, IRegistry::fInternalSpaces, IRegistry::fTransient, NStr::PrintableString(), s_IsNameSection(), NStr::TruncateSpaces(), and IRegistry::x_CheckFlags().

Referenced by x_Read().

virtual void IRWRegistry::x_Clear TFlags  flags  )  [protected, pure virtual]
 

Called locked, like the virtual methods inherited from IRegistry.

Implemented in CEnvironmentRegistry, CMemoryRegistry, CTwoLayerRegistry, CCompoundRWRegistry, and CNcbiRegistry.

Referenced by Clear().

IRWRegistry * IRWRegistry::x_Read CNcbiIstream is,
TFlags  flags
[protected, virtual]
 

Most implementations should not override this, but CNcbiRegistry must, to handle some special cases properly.

Reimplemented in CCompoundRWRegistry, and CNcbiRegistry.

Definition at line 520 of file ncbireg.cpp.

References IRegistry::Empty(), IRegistry::fIgnoreErrors, IRegistry::fJustCore, IRegistry::fPersistent, IRegistry::fTPFlags, IRegistry::fTransient, IRegistry::GetComment(), len, IRegistry::Modified(), NCBI_THROW2, NcbiGetlineEOL(), NPOS, s_IsNameSection(), SetComment(), and NStr::TruncateSpaces().

Referenced by Read(), and CCompoundRWRegistry::x_Read().

virtual bool IRWRegistry::x_Set const string &  section,
const string &  name,
const string &  value,
TFlags  flags,
const string &  comment
[protected, pure virtual]
 

Implemented in CEnvironmentRegistry, CMemoryRegistry, CTwoLayerRegistry, and CCompoundRWRegistry.

Referenced by Set().

virtual bool IRWRegistry::x_SetComment const string &  comment,
const string &  section,
const string &  name,
TFlags  flags
[protected, pure virtual]
 

Implemented in CEnvironmentRegistry, CMemoryRegistry, CTwoLayerRegistry, and CCompoundRWRegistry.


The documentation for this class was generated from the following files:
Generated on Mon Dec 7 15:39:14 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:24:27 2009 by modify_doxy.py rev. 173732