---
title: llarp/config/ini.hpp

---

# llarp/config/ini.hpp



## Namespaces

| Name           |
| -------------- |
| **[llarp](Namespaces/namespacellarp.md)** <br>[crypto.hpp] |

## Classes

|                | Name           |
| -------------- | -------------- |
| struct | **[llarp::ConfigParser](Classes/structllarp_1_1ConfigParser.md)**  |




## Source code

```cpp
#pragma once

#include <string_view>
#include <string>
#include <functional>
#include <memory>
#include <unordered_map>
#include <vector>
#include <llarp/util/fs.hpp>

namespace llarp
{
  struct ConfigParser
  {
    using SectionValues_t = std::unordered_multimap<std::string, std::string>;
    using Config_impl_t = std::unordered_map<std::string, SectionValues_t>;
    void
    Clear();

    bool
    LoadFile(const fs::path fname);

    bool
    LoadFromStr(std::string_view str);

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

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

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

    void
    Save();

    inline void
    Filename(fs::path f)
    {
      m_FileName = f;
    };

   private:
    bool
    Parse();

    std::vector<char> m_Data;
    Config_impl_t m_Config;
    std::unordered_map<fs::path, Config_impl_t, util::FileHash> m_Overrides;
    fs::path m_FileName;
  };

}  // namespace llarp
```


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

Updated on 2022-09-10 at 18:17:15 +0000
