Core Library  1.7.0.0
Library containing core utilities and tools for threading, networking, logging, INI and CSV file management etc.
core_lib::ini_file::if_private::SectionDetails Class Referencefinal

Class to represent an INI file's section details. More...

#include <IniFileSectionDetails.h>

Public Member Functions

 SectionDetails ()=default
 Default constructor.
 
 SectionDetails (const SectionDetails &)=default
 Copy constructor.
 
 SectionDetails (const line_iter &sectIter)
 Initialising constructor.
 
 ~SectionDetails ()=default
 Destructor.
 
SectionDetailsoperator= (const SectionDetails &)=default
 Copy assignment operator.
 
 SectionDetails (SectionDetails &&)=default
 Move constructor.
 
SectionDetailsoperator= (SectionDetails &&)=default
 Move assignment operator.
 
const std::string & Section () const
 Get the section. More...
 
bool KeyExists (const std::string &key) const
 Does a key exist. More...
 
void AddKey (const line_iter &keyIter)
 Add a key to the section. More...
 
void UpdateKey (const std::string &key, const std::string &value)
 Update a key's value in the section. More...
 
bool EraseKey (const std::string &key, line_iter &lineIter)
 Erase a key value from the section. More...
 
std::string GetValue (const std::string &key, const std::string &defaultValue="") const
 Get a key's value from the section. More...
 
void GetKeys (keys_list &keys) const
 Get a list of keys in the section. More...
 
line_iter LineIterator () const
 Get the line iterator. More...
 
size_t NumKeys () const
 Get the number of keys in the section. More...
 

Private Types

using line_iter_list = std::list< line_iter >
 Line iterator lists typedef.
 
using keys_iter = line_iter_list::iterator
 Line iterator list iterator.
 

Private Attributes

line_iter m_sectIter {}
 Line iterator.
 
line_iter_list m_keyIters {}
 Line iterator list.
 

Detailed Description

Class to represent an INI file's section details.

Member Function Documentation

◆ AddKey()

void core_lib::ini_file::if_private::SectionDetails::AddKey ( const line_iter keyIter)

Add a key to the section.

Parameters
[in]keyIter- The key iterator.

◆ EraseKey()

bool core_lib::ini_file::if_private::SectionDetails::EraseKey ( const std::string &  key,
line_iter lineIter 
)

Erase a key value from the section.

Parameters
[in]key- The key.
[out]lineIter- Line iterator to the erased key.
Returns
True if erased, false otherwise.

◆ GetKeys()

void core_lib::ini_file::if_private::SectionDetails::GetKeys ( keys_list keys) const

Get a list of keys in the section.

Parameters
[out]keys- The list of keys.

◆ GetValue()

std::string core_lib::ini_file::if_private::SectionDetails::GetValue ( const std::string &  key,
const std::string &  defaultValue = "" 
) const

Get a key's value from the section.

Parameters
[in]key- The key.
[in]defaultValue- The default value to use if key not found.
Returns
The value for the key.

◆ KeyExists()

bool core_lib::ini_file::if_private::SectionDetails::KeyExists ( const std::string &  key) const

Does a key exist.

Parameters
[in]key- The key.
Returns
True if exists, false otherwise.

◆ LineIterator()

line_iter core_lib::ini_file::if_private::SectionDetails::LineIterator ( ) const

Get the line iterator.

Returns
Line iterator.

◆ NumKeys()

size_t core_lib::ini_file::if_private::SectionDetails::NumKeys ( ) const

Get the number of keys in the section.

Returns
Number of keys.

◆ Section()

const std::string & core_lib::ini_file::if_private::SectionDetails::Section ( ) const

Get the section.

Returns
The section.

◆ UpdateKey()

void core_lib::ini_file::if_private::SectionDetails::UpdateKey ( const std::string &  key,
const std::string &  value 
)

Update a key's value in the section.

Parameters
[in]key- The key.
[in]value- The value.

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