ModulesConf Class Reference

The modules.conf file. More...

#include <ModulesConf.h>

List of all members.

Public Types

typedef list< string > ModulesConfIndex
typedef map< const string,
ModuleEntry
ModuleEntryMap
typedef map< const string,
ModuleEntryMap
ModulesConfMap

Public Member Functions

 ModulesConf (const string &fname)
 ~ModulesConf ()
ModulesConfMap getDirectives ()
ModuleEntryMap getModules (const string directive)
ModuleEntry::EntryArg getOptions (const string module)
string getOptionsAsString (const string module)
string getOption (const string module, const string option)
string getArgument (const string directive, const string module)
string getComment (const string directive, const string module)
bool setOption (const string module, const string option, const string value, ModuleEntry::Mode m)
bool setOptions (const string module, const ModuleEntry::EntryArg arg, ModuleEntry::Mode m)
bool setArgument (const string directive, const string module, const string arg, ModuleEntry::Mode m)
bool setComment (const string directive, const string module, const string arg, ModuleEntry::Mode m)
bool removeEntry (const string directive, const string module)
bool writeFile (const string fname="")

Private Types

typedef time_t TimeStamp

Private Member Functions

TimeStamp getTimeStamp (const string &fname)
bool isDirective (const string directive) const
bool isModule (const string directive, const string module)
bool isOption (const string module, const string option)
bool updateIfModified ()
bool updateTimeStamp ()
bool updateIndex (const string directive, const string module)
bool parseLine (const string &line, ModuleLine &l) const
bool parseFile (const string &file_name, ModuleEntry::Mode m, const bool with_comment=true)

Private Attributes

string file_name
ModulesConfMap modules_conf_map
ModulesConfIndex modules_conf_index
bool modified
TimeStamp time_stamp

Classes

struct  ModuleLine


Detailed Description

The modules.conf file.

This class contains the modules.conf file.

Author:
Michal Svec <msvec@suse.cz>

Dan Vesely <dan@suse.cz>

See also:
ModuleEntry


Member Typedef Documentation

typedef map<const string, ModuleEntry> ModulesConf::ModuleEntryMap
 

typedef list<string> ModulesConf::ModulesConfIndex
 

typedef map<const string, ModuleEntryMap> ModulesConf::ModulesConfMap
 

typedef time_t ModulesConf::TimeStamp [private]
 

The return type of getTimeStamp()


Constructor & Destructor Documentation

ModulesConf::ModulesConf const string &  fname  ) 
 

Default constructor.

Parameters:
fname A path to the modules.conf file (usually /etc/modules.conf)

ModulesConf::~ModulesConf  ) 
 

Destructor


Member Function Documentation

string ModulesConf::getArgument const string  directive,
const string  module
 

For the given directive and module returns the entry argument.

Parameters:
directive A directive for which the argument is returned.
module A module for which the argument is returned.
Returns:
an entry argument

string ModulesConf::getComment const string  directive,
const string  module
 

For the given directive and module returns the entry comment.

Parameters:
directive A directive for which the comment is returned.
module A module for which the comment is returned.
Returns:
an entry comment

ModulesConf::ModulesConfMap ModulesConf::getDirectives  ) 
 

Returns map of all directives present in the current modules.conf.

Returns:
a map of all directives

ModulesConf::ModuleEntryMap ModulesConf::getModules const string  directive  ) 
 

For the given directive returns all modules in a map.

Parameters:
directive A directive for which the modules are returned.
Returns:
a map of all modules for the given directive

string ModulesConf::getOption const string  module,
const string  option
 

For the given module and option returns the option parameter.

Parameters:
module A module for which the parameter is returned.
option An option for which the parameter is returned.
Returns:
an option parameter

ModuleEntry::EntryArg ModulesConf::getOptions const string  module  ) 
 

For the given module returns all options in a map.

Parameters:
module A module for which the options are returned.
Returns:
a map of all options for the given module

string ModulesConf::getOptionsAsString const string  module  ) 
 

For the given module returns all options as one string.

Parameters:
module A module for which the options are returned.
Returns:
all options for the given module in one string

ModulesConf::TimeStamp ModulesConf::getTimeStamp const string &  fname  )  [private]
 

Return a time stamp of the file.

Parameters:
fname A file name of the file to be stamped.
Returns:
the file time stamp

bool ModulesConf::isDirective const string  directive  )  const [private]
 

Test the existence of directive.

Parameters:
directive The tested directive.
Returns:
if the directive exists

bool ModulesConf::isModule const string  directive,
const string  module
[private]
 

Test the existence of module.

Parameters:
directive The directive of the tested module.
module The tested module.
Returns:
if the module exists

bool ModulesConf::isOption const string  module,
const string  option
[private]
 

Test the existence of option.

Parameters:
directive The directive of the tested option.
module The module of the tested option.
Returns:
if the option exists

bool ModulesConf::parseFile const string &  file_name,
ModuleEntry::Mode  m,
const bool  with_comment = true
[private]
 

Parse the modules.conf.

Parameters:
file_name The name of the parsed file.
m Indicates if the option is set during (re)initialization or by an agent.
with_comment If the comment should be parsed.
Returns:
if the operation was successful

bool ModulesConf::parseLine const string &  line,
ModuleLine l
const [private]
 

Parse one line of modules.conf.

Parameters:
line The line to be parsed.
l The parsed line.
Returns:
if the operation was successful

bool ModulesConf::removeEntry const string  directive,
const string  module
 

Remove one entry from the modules.conf.

Parameters:
directive A removed entry directive.
module A removed entry module.
m Indicates if the option is set during (re)initialization or by an agent.
Returns:
if the operation was successful

bool ModulesConf::setArgument const string  directive,
const string  module,
const string  arg,
ModuleEntry::Mode  m
 

For the given directive and module set the entry argument.

Parameters:
directive A directive for which the argument is set.
module A module for which the argument is set.
m Indicates if the option is set during (re)initialization or by an agent.
arg An entry argument.
Returns:
if the operation was successful

bool ModulesConf::setComment const string  directive,
const string  module,
const string  arg,
ModuleEntry::Mode  m
 

For the given directive and module set the entry comment.

Parameters:
directive A directive for which the comment is set.
module A module for which the comment is set.
m Indicates if the option is set during (re)initialization or by an agent.
arg An entry comment.
Returns:
if the operation was successful

bool ModulesConf::setOption const string  module,
const string  option,
const string  value,
ModuleEntry::Mode  m
 

For the given module and options set the option parameter.

Parameters:
module A module for which the parameter is set.
option An option for which the parameter is set.
value The option value.
Returns:
if the operation was successful

bool ModulesConf::setOptions const string  module,
const ModuleEntry::EntryArg  arg,
ModuleEntry::Mode  m
 

For the given module set all options as a map.

Parameters:
module A module for which the options are set.
value The options as a map.
m Indicates if the option is set during (re)initialization or by an agent.
Returns:
if the operation was successful

bool ModulesConf::updateIfModified  )  [private]
 

Update internal structures if the file has been modified.

Returns:
if file has been modified

bool ModulesConf::updateIndex const string  directive,
const string  module
[private]
 

Update the file index.

Parameters:
directive A directive for which the index is updated.
module A module for which the index is updated.
Returns:
if the operation was successful

bool ModulesConf::updateTimeStamp  )  [private]
 

Update the file time stamp.

Returns:
if the operation was successful

bool ModulesConf::writeFile const string  fname = ""  ) 
 

Write the modules.conf file to the disk.

Parameters:
fname A file name of the written file.
Returns:
if the operation was successful


Member Data Documentation

string ModulesConf::file_name [private]
 

bool ModulesConf::modified [private]
 

ModulesConfIndex ModulesConf::modules_conf_index [private]
 

ModulesConfMap ModulesConf::modules_conf_map [private]
 

TimeStamp ModulesConf::time_stamp [private]
 


The documentation for this class was generated from the following files:
Generated on Fri Jun 16 18:07:46 2006 for yast2-core by  doxygen 1.4.6