GlobalObjects
Loading...
Searching...
No Matches
ini::Section Class Reference

A section can only appear once in an INI file, is enclosed in square brackets and usually has variables with values. More...

#include <IniSection.h>

Inheritance diagram for ini::Section:

Public Member Functions

 Section (const std::string &sCharLine)
 
virtual ~Section ()
 
int getKeyLine (Line *&prRetVal, const std::string &sValueVariable)
 
int getKeyValue (std::string &rsValue, const std::string sValueVariable)
 
std::string getName () const
 
int getSectionLine (Line *&prRetVal, std::size_t nPosition, ptl::SeekMode eMode)
 
std::size_t getSectionSize ()
 
int insertSectionLine (Line *pIniLine, ptl::InsertPosition eInsertPosition=ptl::InsertCURRENT, ptl::VH eBeforeBehind=ptl::BEHIND)
 
void removeAllSectionLines ()
 
int removeSectionLine (ptl::ElementPosition eFirstLastCurrent=ptl::CURRENT_POS)
 
void setName (const std::string &sName)
 
- Public Member Functions inherited from ini::Line
 Line (const std::string &sCharLine)
 
virtual ~Line ()
 
std::size_t getLineSizeWithEOL () const
 
std::string getText () const
 
LINE_TYPE getType () const
 
void setText (std::string sCharLine)
 

Protected Member Functions

 Section ()
 
 Section (const std::string &sCharLine, LINE_TYPE eLineType)
 
int insertSectionInBlob (eut::Blob &rBlob)
 
- Protected Member Functions inherited from ini::Line
 Line ()
 
 Line (const std::string &sCharLine, LINE_TYPE eLineType)
 
char * getTextWithEOL () const
 

Private Member Functions

 Section (const Section &)
 
Sectionoperator= (const Section &)
 

Private Attributes

ptl::TDVList< Linem_SektionList
 

Friends

class File
 
class LineFactory
 

Additional Inherited Members

- Protected Attributes inherited from ini::Line
LINE_TYPE m_eLineType
 
LineFactory m_LineFactory
 
std::string m_sText
 

Detailed Description

A section can only appear once in an INI file, is enclosed in square brackets and usually has variables with values.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ Section() [1/4]

ini::Section::Section ( const std::string & sCharLine)

Constructor with parameter passing.

Parameters
[in]sCharLineThe text of the entry.

◆ ~Section()

virtual ini::Section::~Section ( )
virtual

Destructor.

◆ Section() [2/4]

ini::Section::Section ( const std::string & sCharLine,
LINE_TYPE eLineType )
protected

This constructor with parameter passing is not publicly available.

Parameters
[in]sCharLineThe text of the entry.
[in]eLineTypeThe type of the entry, the calling instance must have determined the correct type, here IniSECTION.

◆ Section() [3/4]

ini::Section::Section ( )
protected

The standard constructor is not publicly available.

◆ Section() [4/4]

ini::Section::Section ( const Section & )
private

The copy constructor is not available.

Member Function Documentation

◆ getKeyLine()

int ini::Section::getKeyLine ( Line *& prRetVal,
const std::string & sValueVariable )

This method returns a pointer to a Line from this section.

Parameters
[in,out]prRetValThe found Line
[in]sValueVariableThe searched variable or value
[386enh]
woafont=app850.fon <- Variable (woafont) with value
Test123 <- Value
Returns
A return < 0 indicates an error.
Attention
The returned object in prRetVal must not be removed from memory by the calling instance!

◆ getKeyValue()

int ini::Section::getKeyValue ( std::string & rsValue,
const std::string sValueVariable )

This method returns a string corresponding to the value of the variable from the second parameter, from this section.

Parameters
[in,out]rsValueThe found KeyValue as string.
[in]sValueVariableThe searched variable or value
Returns
A return < 0 indicates an error.

◆ getName()

std::string ini::Section::getName ( ) const

Returns the name of the INI section.

Returns
The designation as string without "[" and "]".

◆ getSectionLine()

int ini::Section::getSectionLine ( Line *& prRetVal,
std::size_t nPosition,
ptl::SeekMode eMode )

Returns an Line from the m_SektionList with respect to the pass parameters.

Parameters
[in,out]prRetValpassed reference into which the found object "comes".
[in]nPositionOffset relative to...
[in]eMode...Position

Parameter examples:

  • Delivers first element from list: lPosition = 0; eMode = ptl::START
  • Returns last element from list: lPosition = 0; eMode = ptl::END
  • Returns current element from list: lPosition = 0; eMode = ptl::CURRENT_POS
  • Returns next element from list: lPosition = 1; eMode = ptl::CURRENT_POS
  • Returns previous element from list: lPosition = -1; eMode = ptl::CURRENT_POS
Returns
A return < 0 indicates an error.
Attention
The object returned in prRetVal must not be removed from memory by the calling instance!

◆ getSectionSize()

std::size_t ini::Section::getSectionSize ( )

Returns the section size from the current entries and itself (including the EOLines).

Returns
The length of the section size.

◆ insertSectionInBlob()

int ini::Section::insertSectionInBlob ( eut::Blob & rBlob)
protected

Appends its own section text and its own entries to the blob passed.

Parameters
[in,out]rBlobThis blob is expanded.
Returns
A return value < 0 indicates an error.

◆ insertSectionLine()

int ini::Section::insertSectionLine ( Line * pIniLine,
ptl::InsertPosition eInsertPosition = ptl::InsertCURRENT,
ptl::VH eBeforeBehind = ptl::BEHIND )

Inserts the transferred entry into the m_SektionList.

Parameters
[in]pIniLineThe object of the class Line to be inserted,
[in]eInsertPositionShows where the data object is inserted in the list is to be inserted. Possible parameters are ptl::InsertHEAD (on start), ptl::InsertLAST (at the end) or ptl::InsertCURRENT (at the current element).
[in]eBeforeBehindSpecifies whether the new element is before or after the, element specified in the eInsertPosition parameter. Possible Parameters are ptl::BEHIND and ptl::BEFORE
Returns
A return value < 0 indicates an error.
Attention
The responsibility for the passed Line is taken by the object of this class, the calling instance must not remove the object from the memory.

◆ operator=()

Section & ini::Section::operator= ( const Section & )
private

The assignment operator is not available.

◆ removeAllSectionLines()

void ini::Section::removeAllSectionLines ( )

Removes all entries from the m_SektionList. The destructor is called from each entry.

◆ removeSectionLine()

int ini::Section::removeSectionLine ( ptl::ElementPosition eFirstLastCurrent = ptl::CURRENT_POS)

Removes the entry from the m_SektionList.

If a subsequent element exists, it becomes the current element, otherwise the previous element, if it exists. The destructor is called from the remote entry.

Parameters
[in]eFirstLastCurrentThe following values are possible: ptl::FIRST_POS, ptl::LAST_POS, (default) ptl::CURRENT_POS, ptl::NEXT_POS and ptl::PREVIOUS_POS.
Returns
A return value < 0 indicates an error.

◆ setName()

void ini::Section::setName ( const std::string & sName)

Sets the text of the INI entry.

Parameters
[in]sNameThe name as string without "[" and "]".

Friends And Related Symbol Documentation

◆ File

friend class File
friend

◆ LineFactory

friend class LineFactory
friend

Member Data Documentation

◆ m_SektionList

ptl::TDVList<Line> ini::Section::m_SektionList
private

List of entries in this section.


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