Files
bx/include/bx/settings.h
Бранимир Караџић c969169fc1 Happy New Year!
2022-01-15 11:58:42 -08:00

62 lines
1.1 KiB
C++

/*
* Copyright 2011-2022 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx/blob/master/LICENSE
*/
#ifndef BX_SETTINGS_H_HEADER_GUARD
#define BX_SETTINGS_H_HEADER_GUARD
#include "allocator.h"
#include "readerwriter.h"
#include "string.h"
namespace bx
{
///
class Settings
{
public:
///
Settings(AllocatorI* _allocator, const void* _data = NULL, uint32_t _len = 0);
///
~Settings();
///
void clear();
///
void load(const void* _data, uint32_t _len);
///
StringView get(const StringView& _name) const;
///
void set(const StringView& _name, const StringView& _value = "");
///
void remove(const StringView& _name) const;
///
int32_t read(ReaderSeekerI* _reader, Error* _err);
///
int32_t write(WriterI* _writer, Error* _err) const;
private:
Settings();
AllocatorI* m_allocator;
void* m_ini;
};
///
int32_t read(ReaderSeekerI* _reader, Settings& _settings, Error* _err);
///
int32_t write(WriterI* _writer, const Settings& _settings, Error* _err);
} // namespace bx
#endif // BX_SETTINGS_H_HEADER_GUARD