1 /* 2 * Copyright 2011-2019 Branimir Karadzic. All rights reserved. 3 * License: https://github.com/bkaradzic/bx#license-bsd-2-clause 4 */ 5 6 #ifndef BX_SETTINGS_H_HEADER_GUARD 7 #define BX_SETTINGS_H_HEADER_GUARD 8 9 #include "allocator.h" 10 #include "readerwriter.h" 11 #include "string.h" 12 13 namespace bx 14 { 15 /// 16 class Settings 17 { 18 public: 19 /// 20 Settings(AllocatorI* _allocator, const void* _data = NULL, uint32_t _len = 0); 21 22 /// 23 ~Settings(); 24 25 /// 26 void clear(); 27 28 /// 29 void load(const void* _data, uint32_t _len); 30 31 /// 32 StringView get(const StringView& _name) const; 33 34 /// 35 void set(const StringView& _name, const StringView& _value = ""); 36 37 /// 38 void remove(const StringView& _name) const; 39 40 /// 41 int32_t read(ReaderSeekerI* _reader, Error* _err); 42 43 /// 44 int32_t write(WriterI* _writer, Error* _err) const; 45 46 private: 47 Settings(); 48 49 AllocatorI* m_allocator; 50 void* m_ini; 51 }; 52 53 /// 54 int32_t read(ReaderSeekerI* _reader, Settings& _settings, Error* _err = NULL); 55 56 /// 57 int32_t write(WriterI* _writer, const Settings& _settings, Error* _err = NULL); 58 59 } // namespace bx 60 61 #endif // BX_SETTINGS_H_HEADER_GUARD 62