---
title: llarp::ConfigParser

---

# llarp::ConfigParser





## Public Types

|                | Name           |
| -------------- | -------------- |
| using std::unordered_multimap< std::string, std::string > | **[SectionValues_t](Classes/structllarp_1_1ConfigParser.md#using-sectionvalues-t)**  |
| using std::unordered_map< std::string, SectionValues_t > | **[Config_impl_t](Classes/structllarp_1_1ConfigParser.md#using-config-impl-t)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| void | **[Clear](Classes/structllarp_1_1ConfigParser.md#function-clear)**()<br>clear parser  |
| bool | **[LoadFile](Classes/structllarp_1_1ConfigParser.md#function-loadfile)**(const fs::path & fname)<br>load config file for bootserv return true on success return false on error  |
| bool | **[LoadNewFromStr](Classes/structllarp_1_1ConfigParser.md#function-loadnewfromstr)**(std::string_view str)<br>load new .ini file from string (calls ParseAll() rather than Parse()) return true on success return false on error  |
| bool | **[LoadFromStr](Classes/structllarp_1_1ConfigParser.md#function-loadfromstr)**(std::string_view str)<br>load from string return true on success return false on error  |
| void | **[IterAll](Classes/structllarp_1_1ConfigParser.md#function-iterall)**(std::function< void(std::string_view, const SectionValues_t &)> visit)<br>iterate all sections and thier values  |
| bool | **[VisitSection](Classes/structllarp_1_1ConfigParser.md#function-visitsection)**(const char * name, std::function< bool(const SectionValues_t &)> visit) const<br>visit a section in config read only by name return false if no section or value propagated from visitor  |
| void | **[AddOverride](Classes/structllarp_1_1ConfigParser.md#function-addoverride)**(fs::path file, std::string section, std::string key, std::string value)<br>add a config option that is appended in another file  |
| void | **[Save](Classes/structllarp_1_1ConfigParser.md#function-save)**()<br>save config overrides  |
| void | **[SaveNew](Classes/structllarp_1_1ConfigParser.md#function-savenew)**() const<br>save new .ini config file to path  |
| void | **[Filename](Classes/structllarp_1_1ConfigParser.md#function-filename)**(fs::path f) |

## Public Types Documentation

### using SectionValues_t

```cpp
using llarp::ConfigParser::SectionValues_t =  std::unordered_multimap<std::string, std::string>;
```


### using Config_impl_t

```cpp
using llarp::ConfigParser::Config_impl_t =  std::unordered_map<std::string, SectionValues_t>;
```


## Public Functions Documentation

### function Clear

```cpp
void Clear()
```

clear parser 

### function LoadFile

```cpp
bool LoadFile(
    const fs::path & fname
)
```

load config file for bootserv return true on success return false on error 

### function LoadNewFromStr

```cpp
bool LoadNewFromStr(
    std::string_view str
)
```

load new .ini file from string (calls ParseAll() rather than Parse()) return true on success return false on error 

### function LoadFromStr

```cpp
bool LoadFromStr(
    std::string_view str
)
```

load from string return true on success return false on error 

### function IterAll

```cpp
void IterAll(
    std::function< void(std::string_view, const SectionValues_t &)> visit
)
```

iterate all sections and thier values 

### function VisitSection

```cpp
bool VisitSection(
    const char * name,
    std::function< bool(const SectionValues_t &)> visit
) const
```

visit a section in config read only by name return false if no section or value propagated from visitor 

### function AddOverride

```cpp
void AddOverride(
    fs::path file,
    std::string section,
    std::string key,
    std::string value
)
```

add a config option that is appended in another file 

### function Save

```cpp
void Save()
```

save config overrides 

### function SaveNew

```cpp
void SaveNew() const
```

save new .ini config file to path 

### function Filename

```cpp
inline void Filename(
    fs::path f
)
```


-------------------------------

Updated on 2023-04-27 at 04:17:17 +0000