Veethree D7 SDK
Loading...
Searching...
No Matches
libuboot_raii.h
2#include "vsdk_config.h"
3
4#include <libuboot.h>
5#include <mutex>
6#include <string>
7#include <unordered_map>
8#include <utils/fmt_wrapper.h>
9
10namespace vsdk::sys {
11
12static constexpr const char *uboot_config = vsdk::config::system::uboot_config_path;
16class libuboot_raii final : public libuboot_raii_interface {
17public:
18 libuboot_raii();
19 ~libuboot_raii() noexcept override;
20
26 void set_value(std::string_view var, std::string_view value) override;
27
33 void get_value(std::string_view var, std::string &value) override;
34
39 libuboot_raii(const libuboot_raii &) = delete;
40 libuboot_raii(libuboot_raii &&) = delete;
41 libuboot_raii &operator=(const libuboot_raii &) = delete;
42 libuboot_raii &operator=(libuboot_raii &&) = delete;
44
49 void get_vars(std::unordered_map<std::string, std::string> &environment) override;
50
51private:
52 uboot_ctx *_ctx{};
53 std::recursive_mutex _access;
54};
55} // namespace vsdk::sys
libuboot_raii & operator=(libuboot_raii &&)=delete
void set_value(std::string_view var, std::string_view value) override
Set a uboot environment variable.
libuboot_raii(libuboot_raii &&)=delete
void get_vars(std::unordered_map< std::string, std::string > &environment) override
Populate a map with the current uboot environment variables.
libuboot_raii(const libuboot_raii &)=delete
void get_value(std::string_view var, std::string &value) override
Get the value of a uboot environment variable.
libuboot_raii & operator=(const libuboot_raii &)=delete
Add include this file to your file so you have access to fmtlib header-only implementation.
libuboot_raii_interface
Any entities that belong to the system library.