Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
pangea_survey::IniFile Class Reference

Read scalar values from a bounded, section-based INI file. More...

#include <ini_file.h>

Public Member Functions

 IniFile (const std::filesystem::path &path)
 Parse an INI file into unique section-qualified keys.
void validate (std::initializer_list< const char * > allowed) const
 Reject keys not owned by the caller's configuration schema.
bool has (const std::string &key) const
 Test whether a section-qualified key was present in the file.
std::string text (const std::string &key, const std::string &fallback={}) const
 Read text or return a fallback when the key is absent.
double numeric (const std::string &key, double fallback) const
 Read a finite numeric value, using fallback only when absent.
double required (const std::string &key) const
 Read a required finite numeric value.
bool boolean (const std::string &key, bool fallback=false) const
 Read a strict numeric boolean whose only accepted values are 0 and 1.

Private Attributes

std::map< std::string, std::string > values_

Detailed Description

Read scalar values from a bounded, section-based INI file.

Keys are stored as section.name; duplicate and empty settings are rejected during construction. Call validate with the owning schema's allow-list before consuming values.

Definition at line 38 of file ini_file.h.

Constructor & Destructor Documentation

◆ IniFile()

pangea_survey::IniFile::IniFile ( const std::filesystem::path & path)
inlineexplicit

Parse an INI file into unique section-qualified keys.

Parameters
[in]pathInput file path.
Exceptions
std::runtime_errorIf the file is unreadable or malformed.

Definition at line 46 of file ini_file.h.

Member Function Documentation

◆ boolean()

bool pangea_survey::IniFile::boolean ( const std::string & key,
bool fallback = false ) const
inline

Read a strict numeric boolean whose only accepted values are 0 and 1.

Definition at line 98 of file ini_file.h.

◆ has()

bool pangea_survey::IniFile::has ( const std::string & key) const
inline

Test whether a section-qualified key was present in the file.

Definition at line 82 of file ini_file.h.

◆ numeric()

double pangea_survey::IniFile::numeric ( const std::string & key,
double fallback ) const
inline

Read a finite numeric value, using fallback only when absent.

Definition at line 89 of file ini_file.h.

◆ required()

double pangea_survey::IniFile::required ( const std::string & key) const
inline

Read a required finite numeric value.

Definition at line 93 of file ini_file.h.

◆ text()

std::string pangea_survey::IniFile::text ( const std::string & key,
const std::string & fallback = {} ) const
inline

Read text or return a fallback when the key is absent.

Definition at line 84 of file ini_file.h.

◆ validate()

void pangea_survey::IniFile::validate ( std::initializer_list< const char * > allowed) const
inline

Reject keys not owned by the caller's configuration schema.

Parameters
[in]allowedExact section.name keys accepted by the schema.
Exceptions
std::runtime_errorOn the first unknown key.

Definition at line 75 of file ini_file.h.

Field Documentation

◆ values_

std::map<std::string, std::string> pangea_survey::IniFile::values_
private

Definition at line 39 of file ini_file.h.


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