17 #ifndef DOXYGEN_SHOULD_SKIP_THIS
78 virtual
bool save(const
char* path) const noexcept = 0;
84 virtual
void clear() noexcept = 0;
90 virtual
bool isEmpty() const noexcept = 0;
102 struct Int1 {
int m_value; } m_int1;
103 struct Int2 {
int m_value[2]; } m_int2;
104 struct Int3 {
int m_value[3]; } m_int3;
105 struct Int4 {
int m_value[4]; } m_int4;
106 struct Float1 {
float m_value; } m_float1;
107 struct Float2 {
float m_value[2]; } m_float2;
108 struct Float3 {
float m_value[3]; } m_float3;
109 struct Float4 {
float m_value[4]; } m_float4;
110 struct String {
char* m_value; } m_string;
133 Value() noexcept : m_type(Undefined) {}
139 Value(
int x) noexcept { setInt(x); }
146 Value(
int x,
int y) noexcept { setInt(x, y); }
154 Value(
int x,
int y,
int z) noexcept { setInt(x, y, z); }
163 Value(
int x,
int y,
int z,
int w) noexcept { setInt(x, y, z, w); }
169 Value(
float x) noexcept { setFloat(x); }
176 Value(
float x,
float y) noexcept { setFloat(x, y); }
184 Value(
float x,
float y,
float z) noexcept { setFloat(x, y, z); }
193 Value(
float x,
float y,
float z,
float w) noexcept { setFloat(x, y, z, w); }
200 Value(
const char*
string) noexcept { setString(
string); }
224 Value(
bool x) noexcept { setBool(x); }
230 operator bool() const noexcept {
return !is(Undefined); }
237 bool is(
Type type)
const noexcept {
return m_type == type; }
244 inline bool setString(
const char*
string) noexcept;
252 inline bool getString(
char*
string)
const noexcept;
259 inline void setRect(
const Rect& rect) noexcept;
267 inline bool getRect(
Rect* rect)
const noexcept;
274 inline void setSize(
const Size& size) noexcept;
282 inline bool getSize(
Size* size)
const noexcept;
289 inline void setPoint2i(
const Point2i& point) noexcept;
297 inline bool getPoint2i(
Point2i* point)
const noexcept;
304 inline void setPoint2f(
const Point2f& point) noexcept;
312 inline bool getPoint2f(
Point2f* point)
const noexcept;
318 inline void setBool(
bool x) noexcept;
326 inline bool getBool(
bool* x)
const noexcept;
333 inline void setInt(
int x) noexcept;
341 inline bool getInt(
int* x)
const noexcept;
349 inline void setInt(
int x,
int y) noexcept;
358 inline bool getInt(
int* x,
int* y)
const noexcept;
367 inline void setInt(
int x,
int y,
int z) noexcept;
377 inline bool getInt(
int* x,
int* y,
int* z)
const noexcept;
387 inline void setInt(
int x,
int y,
int z,
int w) noexcept;
398 inline bool getInt(
int* x,
int* y,
int* z,
int* w)
const noexcept;
405 inline void setFloat(
float x) noexcept;
413 inline bool getFloat(
float* x)
const noexcept;
421 inline void setFloat(
float x,
float y) noexcept;
430 inline bool getFloat(
float* x,
float* y)
const noexcept;
439 inline void setFloat(
float x,
float y,
float z) noexcept;
449 inline bool getFloat(
float* x,
float* y,
float* z)
const noexcept;
459 inline void setFloat(
float x,
float y,
float z,
float w) noexcept;
470 inline bool getFloat(
float* x,
float* y,
float* z,
float* w)
const noexcept;
479 inline float asFloat(
float defaultValue = 0.f) const noexcept;
497 inline
bool asBool(
bool defaultValue = false) const noexcept;
506 inline
int asInt(
int defaultValue = 0) const noexcept;
515 inline
Size asSize(const
Size& defaultValue =
Size()) const noexcept;
533 inline
Rect asRect(const
Rect& defaultValue =
Rect()) const noexcept;
543 inline const
char* asString(const
char* defaultValue = "") const noexcept;
545 inline Value(const Value& other) = delete;
546 inline Value(Value&& other);
548 inline Value& operator=(const Value& other) = delete;
549 inline Value& operator=(Value&& other);
551 inline
void swap(Value& first, Value& second);
562 inline Key() noexcept;
569 inline Key(
const char* section,
const char* parameter) noexcept;
591 inline void setSection(
const char* section) noexcept;
597 inline void setParameter(
const char* parameter) noexcept;
607 static const unsigned int m_bufferLength = 128;
608 char m_section [m_bufferLength];
609 char m_parameter [m_bufferLength];
617 inline Desc() noexcept;
623 inline Desc(
const char* desc) noexcept;
637 inline void setDesc(
const char* desc) noexcept;
640 static const unsigned int m_bufferLength = 256;
652 Entry() noexcept = default;
655 m_value{std::move(right.m_value)},
660 Entry tmp(std::move(right));
666 std::swap(first.m_desc, second.m_desc);
667 std::swap(first.m_value, second.m_value);
674 inline Entry(
const Desc& desc, Value&& value) noexcept;
680 inline
void setDesc(const Desc& desc) noexcept;
686 inline
void setValue(Value&& value) noexcept;
712 virtual void setDesc(
const Key& key,
const Desc& desc) noexcept = 0;
724 const char* parameter,
725 const Desc& desc) noexcept {
736 virtual void setValue(
const Key& key, Value&& value) noexcept = 0;
748 const
char* parameter,
749 Value&& value) noexcept {
750 setValue(
Key(section, parameter), std::move(value));
760 virtual void setEntry(
const Key& key, Entry&& entry) noexcept = 0;
773 Value&& value) noexcept {
788 const char* parameter,
790 Value&& value) noexcept {
801 virtual const Entry&
getEntry(
const Key& key)
const noexcept = 0;
824 const char* parameter)
const noexcept {
849 const char* parameter)
const noexcept {
875 return "Could not allocate memory";
877 return "Error reading from file";
879 return "Internal error";
881 return "Error during document declaration/processing instruction parsing";
883 return "Parser could not determine tag type";
885 return "Error during CDATA section parsing";
887 return "File was not found";
889 return "Error during PCDATA section parsing";
891 return "Error during comment parsing";
893 return "Error during document type declaration parsing";
895 return "Settings sections is invalid or absent";
897 return "Error during element attribute parsing";
899 return "Error during end element tag parsing";
901 return "Root type is not node_element or node_document";
903 return "Document without element nodes";
905 return "Mismatch of start-end tags";
907 return "Error during start element tag parsing";
908 default:
return "Unknown error";
913 #include "ISettingsProvider.inl"
Could not allocate memory.
virtual void clear() noexcept=0
Clear settings.
2D floating point.
Definition: ISettingsProvider.h:123
floating point.
Definition: ISettingsProvider.h:122
Error
Config parsing error codes.
Definition: ISettingsProvider.h:36
3D floating point.
Definition: ISettingsProvider.h:124
#define FSDK_API
Dummy.
Definition: Def.h:27
#define DECLARE_SMARTPTR(X)
Smart ptr declaration helper macro.
Definition: Def.h:59
Unable to append nodes since root type is not node_element or node_document (exclusive to xml_node::a...
const char * getParameter() const noexcept
Get parameter name.
Definition: ISettingsProvider.h:583
void setValue(Value &&value) noexcept
Set value.
Definition: ISettingsProvider.h:377
A structure that encapsulates an action result enumeration.
Definition: Result.h:29
virtual const Entry & getEntry(const Key &key) const noexcept=0
Find parameter entry.
Common data types and structures.
Value() noexcept
Initialize an empty value.
Definition: ISettingsProvider.h:133
virtual void setDesc(const Key &key, const Desc &desc) noexcept=0
Set parameter description.
Configuration parameter key.
Definition: ISettingsProvider.h:559
Definition: ISettingsProvider.h:103
Object system types and interfaces.
Definition: ISettingsProvider.h:105
virtual bool isEmpty() const noexcept=0
Parser could not determine tag type.
4D floating point.
Definition: ISettingsProvider.h:125
Type
Value type.
Definition: ISettingsProvider.h:116
const Desc & getDesc() const noexcept
Get description.
Definition: ISettingsProvider.h:692
Desc m_desc
Parameter description.
Definition: ISettingsProvider.h:649
Value(const char *string) noexcept
Initialize a string value.
Definition: ISettingsProvider.h:200
Base strong reference counted object interface.
Definition: IRefCounted.h:36
Definition: ISettingsProvider.h:109
Value data.
Definition: ISettingsProvider.h:101
void setDesc(const Desc &desc) noexcept
Set description.
Definition: ISettingsProvider.h:372
Value(float x, float y) noexcept
Initialize a 2d float value.
Definition: ISettingsProvider.h:176
Definition: ISettingsProvider.h:107
Value(const Point2f &point) noexcept
Initialize a point value.
Definition: ISettingsProvider.h:218
There was a mismatch of start-end tags (closing tag had incorrect name, some tag was not closed or th...
const Value & getValue(const Key &key) const noexcept
Get parameter value.
Definition: ISettingsProvider.h:835
Value(bool x) noexcept
Initialize a bool value.
Definition: ISettingsProvider.h:224
Parsing error occurred while parsing document declaration/processing instruction. ...
Parsing error occurred while parsing document type declaration.
Parsing error occurred while parsing comment.
Definition: ISettingsProvider.h:102
Value(int x) noexcept
Initialize an integer value.
Definition: ISettingsProvider.h:139
Configuration parameter description.
Definition: ISettingsProvider.h:614
Definition: ISettingsProvider.h:104
Value(float x) noexcept
Initialize a float value.
Definition: ISettingsProvider.h:169
Entry() noexcept=default
Initialize an empty entry.
bool operator<(Version lhs, Version rhs) noexcept
Check if one version is less than another.
Definition: Version.h:36
const char * getDesc() const noexcept
Get description text.
Definition: ISettingsProvider.h:629
void setDesc(const char *desc) noexcept
Set description text.
Definition: ISettingsProvider.h:360
Integer.
Definition: ISettingsProvider.h:118
Value(const Rect &rect) noexcept
Initialize a rect value.
Definition: ISettingsProvider.h:206
File was not found during load_file()
Desc getDesc(const Key &key) const noexcept
Get parameter description.
Definition: ISettingsProvider.h:810
const Value & getValue() const noexcept
Get value.
Definition: ISettingsProvider.h:700
Definition: ISettingsProvider.h:106
Value(int x, int y, int z, int w) noexcept
Initialize a 4d integer value.
Definition: ISettingsProvider.h:163
4D integer.
Definition: ISettingsProvider.h:121
Value(int x, int y) noexcept
Initialize a 2d integer value.
Definition: ISettingsProvider.h:146
FSDK_API ISettingsProvider * createSettingsProvider(const char *path) noexcept
Create a settings provider.
const char * getSection() const noexcept
Get section name.
Definition: ISettingsProvider.h:575
Value(float x, float y, float z) noexcept
Initialize a 3d float value.
Definition: ISettingsProvider.h:184
Parsing resulted in a document without element nodes.
virtual Result< Error > load(const char *path) noexcept=0
Load settings from given path.
Parsing error occurred while parsing end element tag.
Settings section is invalid or absent.
Desc() noexcept
Initialize an empty description.
Definition: ISettingsProvider.h:352
2D integer.
Definition: ISettingsProvider.h:119
Parsing error occurred while parsing PCDATA section.
Configuration parameter entry.
Definition: ISettingsProvider.h:646
Configuration parameter value.
Definition: ISettingsProvider.h:96
virtual const char * getDefaultPath() const noexcept=0
Get settings path this provider is bound to.
Value(const Size &size) noexcept
Initialize a size value.
Definition: ISettingsProvider.h:212
Parsing error occurred while parsing start element tag.
Value(float x, float y, float z, float w) noexcept
Initialize a 4d float value.
Definition: ISettingsProvider.h:193
Error reading from file/stream.
Value(int x, int y, int z) noexcept
Initialize a 3d integer value.
Definition: ISettingsProvider.h:154
virtual void setEntry(const Key &key, Entry &&entry) noexcept=0
Set parameter.
Desc getDesc(const char *section, const char *parameter) const noexcept
Get parameter description.
Definition: ISettingsProvider.h:822
virtual bool save(const char *path) const noexcept=0
Save settings values using the default path.
bool is(Type type) const noexcept
Check if value type is of concrete type.
Definition: ISettingsProvider.h:237
char m_desc[m_bufferLength]
Parameter description text.
Definition: ISettingsProvider.h:641
memory allocation failed for internal data
void setEntry(const char *section, const char *parameter, const Desc &desc, Value &&value) noexcept
Set parameter.
Definition: ISettingsProvider.h:786
Value m_value
Parameter value.
Definition: ISettingsProvider.h:648
Unkown value type.
Definition: ISettingsProvider.h:117
Definition: ISettingsProvider.h:110
void setDesc(const char *section, const char *parameter, const Desc &desc) noexcept
Set parameter description.
Definition: ISettingsProvider.h:722
Parsing error occurred while parsing element attribute.
Parsing error occurred while parsing CDATA section.
SDK settings provider interface.
Definition: ISettingsProvider.h:31
virtual void setValue(const Key &key, Value &&value) noexcept=0
Set parameter value.
const Value & getValue(const char *section, const char *parameter) const noexcept
Get parameter value.
Definition: ISettingsProvider.h:847