wml::CupsdDirContainer Class Reference

A class to hold sets of cupsd directives. More...

#include <CupsdCtrl.h>

List of all members.

Public Member Functions

Constructor and Destructor


 CupsdDirContainer (void)
 Constructor Create a new CupsdDirContainer object.
 CupsdDirContainer (std::string t, std::string p)
 Constructor Create a new CupsdDirContainer object, with the provided type and parameter (<Type parameter>="">).
 ~CupsdDirContainer (void)
 Destructor Delete this CupsdDirContainer object.
Public Class methods


void setType (std::string t)
 Setter for type Sets the type of the container (<Type parameter>="">).
std::string getType (void)
 Getter for type.
std::string getParameter (void)
 Getter for parameter.
void setParameter (std::string p)
 Setter for parameter Sets the parameter of the container (<Type parameter>="">).
std::string getId (void)
 Getter for complete container ID.
void setDirective (std::string containerId, std::string key, std::string value)
void setDirective (std::string key, std::string value)
void setDirective (std::queue< std::pair< std::string, std::string > > containerId, std::string key, std::string value)
 Set a directive Takes a queue of container ids, consisting of the path to the directive. Recursively pops each container in the path until the bottom container is reached, then adds the directive of "key value" to that container.
void getDirective (std::queue< std::pair< std::string, std::string > > containerId, std::string key, std::string &returnStr, bool valueOnly=false)
 Get a directive Takes a queue of container ids, consisting of the path to the directive. Recursively pops each container in the path until the bottom container is reached, then returns the directive.
void addContainer (wml::CupsdDirContainer cont)
 Add a sub-container to this container Adds a sub-container this containers set of sub-containers.
void read (std::ifstream &f, int &recurslevel)
 Read in the current level of containers and directives Reads in the current level of containers and directives from the cups configuration file specified, and adds them to the appropriate data structure.
void write (std::ofstream &ofs, int &rlev)
 Write the current level of containers and directives Writes the current level of containers and directives to the cups configuration file specified, based on the contents of the directives and directiveContainers structures.
void addDir (std::string key, std::string value)
 Adds a new directive Adds a new directive to this containers directives structure.


Detailed Description

A class to hold sets of cupsd directives.

Definition at line 51 of file CupsdCtrl.h.


Constructor & Destructor Documentation

wml::CupsdDirContainer::CupsdDirContainer ( std::string  t,
std::string  p 
)

Constructor Create a new CupsdDirContainer object, with the provided type and parameter (<Type parameter>="">).

Parameters:
t The type of the new container
p The parameter of the new container


Member Function Documentation

void wml::CupsdDirContainer::addContainer ( wml::CupsdDirContainer  cont  ) 

Add a sub-container to this container Adds a sub-container this containers set of sub-containers.

Parameters:
cont The container to be added as a sub-container

void wml::CupsdDirContainer::addDir ( std::string  key,
std::string  value 
)

Adds a new directive Adds a new directive to this containers directives structure.

Parameters:
key The key of the key/value pair of the directive to be added
value The value of the key/value pair of the directive to be added

void wml::CupsdDirContainer::getDirective ( std::queue< std::pair< std::string, std::string > >  containerId,
std::string  key,
std::string &  returnStr,
bool  valueOnly = false 
)

Get a directive Takes a queue of container ids, consisting of the path to the directive. Recursively pops each container in the path until the bottom container is reached, then returns the directive.

Parameters:
containerId A queue containing each container in the path to the directive. The first of these is always "root", or the call will return "container not found".
key The key of the directive being searched for
returnStr A reference to a string that is used to contain the directive once it has been found, and pass it back out.
valueOnly If this is set to true, the function will return only the value of the directive. If set to false, returns the complete directive. Set to false by default

std::string wml::CupsdDirContainer::getId ( void   ) 

Getter for complete container ID.

Get the unique identifier for the container - this is built from type and parameter: If type is "Limit" and parameter is "/path", then the Id is:

<Limit /path>

which is the start tag of the container as it is to be written out in the cupsd.conf file.

The exception is the Root container, which has the Id "Root" but which has no tags around it in the cupsd.conf file.

Returns:
The ID of the container in a string

std::string wml::CupsdDirContainer::getParameter ( void   ) 

Getter for parameter.

Returns:
The parameter of the container in a string

std::string wml::CupsdDirContainer::getType ( void   ) 

Getter for type.

Returns:
The type of the container in a string

void wml::CupsdDirContainer::read ( std::ifstream &  f,
int &  recurslevel 
)

Read in the current level of containers and directives Reads in the current level of containers and directives from the cups configuration file specified, and adds them to the appropriate data structure.

Parameters:
f The input file stream being read from
recursLevel The current depth of recursion. Only used to determine level of tabbing for output to std out

void wml::CupsdDirContainer::setDirective ( std::queue< std::pair< std::string, std::string > >  containerId,
std::string  key,
std::string  value 
)

Set a directive Takes a queue of container ids, consisting of the path to the directive. Recursively pops each container in the path until the bottom container is reached, then adds the directive of "key value" to that container.

Parameters:
containerId A queue containing each container in the path to the directive. The first of these is always "root", or the call will return "container not found".
key The key of the key/value pair of the directive to be added
value The value of the key/value pair of the directive to be added

void wml::CupsdDirContainer::setDirective ( std::string  key,
std::string  value 
)

Wrapper around setDirective function when containerId is not required

void wml::CupsdDirContainer::setDirective ( std::string  containerId,
std::string  key,
std::string  value 
)

Set a directive in the container specified by containerId. If this->getId() == containerId, then the directive is placed in this->directives.

void wml::CupsdDirContainer::setParameter ( std::string  p  ) 

Setter for parameter Sets the parameter of the container (<Type parameter>="">).

Parameters:
p The new parameter of the container

void wml::CupsdDirContainer::setType ( std::string  t  ) 

Setter for type Sets the type of the container (<Type parameter>="">).

Parameters:
t The new type of the container

void wml::CupsdDirContainer::write ( std::ofstream &  ofs,
int &  rlev 
)

Write the current level of containers and directives Writes the current level of containers and directives to the cups configuration file specified, based on the contents of the directives and directiveContainers structures.

Parameters:
ofs The output file stream object that is used to write to a file
rlev The current depth of recursion. Only used to determine level of tabbing for output to the file


The documentation for this class was generated from the following file:

Generated on Wed Apr 6 11:14:38 2011 for wmlcups by  doxygen 1.5.9