mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Cleanup.
This commit is contained in:
@@ -29,7 +29,7 @@ namespace bx
|
|||||||
void load(const void* _data, uint32_t _len);
|
void load(const void* _data, uint32_t _len);
|
||||||
|
|
||||||
///
|
///
|
||||||
const char* get(const StringView& _name) const;
|
StringView get(const StringView& _name) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
void set(const StringView& _name, const StringView& _value = "");
|
void set(const StringView& _name, const StringView& _value = "");
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ void Settings::load(const void* _data, uint32_t _len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Settings::get(const StringView& _name) const
|
StringView Settings::get(const StringView& _name) const
|
||||||
{
|
{
|
||||||
ini_t* ini = INI_T(m_ini);
|
ini_t* ini = INI_T(m_ini);
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ const char* Settings::get(const StringView& _name) const
|
|||||||
int32_t property = ini_find_property(ini, section, fileName.getPtr(), fileName.getLength() );
|
int32_t property = ini_find_property(ini, section, fileName.getPtr(), fileName.getLength() );
|
||||||
if (INI_NOT_FOUND == property)
|
if (INI_NOT_FOUND == property)
|
||||||
{
|
{
|
||||||
return NULL;
|
return StringView();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ini_property_value(ini, section, property);
|
return ini_property_value(ini, section, property);
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ TEST_CASE("Settings", "")
|
|||||||
bx::close(&writer);
|
bx::close(&writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE(NULL == settings.get("meh") );
|
REQUIRE(settings.get("meh").isEmpty() );
|
||||||
REQUIRE(0 == bx::strCmp(settings.get("meh/podmac"), "true") );
|
REQUIRE(0 == bx::strCmp(settings.get("meh/podmac"), "true") );
|
||||||
REQUIRE(0 == bx::strCmp(settings.get("test/foo/bar/abvgd"), "1389") );
|
REQUIRE(0 == bx::strCmp(settings.get("test/foo/bar/abvgd"), "1389") );
|
||||||
|
|
||||||
settings.remove("meh/podmac");
|
settings.remove("meh/podmac");
|
||||||
REQUIRE(NULL == settings.get("meh/podmac") );
|
REQUIRE(settings.get("meh/podmac").isEmpty() );
|
||||||
|
|
||||||
settings.clear();
|
settings.clear();
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ TEST_CASE("Settings", "")
|
|||||||
bx::close(&reader);
|
bx::close(&reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE(NULL == settings.get("meh") );
|
REQUIRE(settings.get("meh").isEmpty() );
|
||||||
REQUIRE(0 == bx::strCmp(settings.get("meh/podmac"), "true") );
|
REQUIRE(0 == bx::strCmp(settings.get("meh/podmac"), "true") );
|
||||||
REQUIRE(0 == bx::strCmp(settings.get("test/foo/bar/abvgd"), "1389") );
|
REQUIRE(0 == bx::strCmp(settings.get("test/foo/bar/abvgd"), "1389") );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user