![]() |
Kiwano Engine
v1.2.x
|
ini格式文件 更多...
#include <ConfigIni.h>
Public 类型 | |
typedef UnorderedMap< String, String > | ValueMap |
键值字典 | |
typedef UnorderedMap< String, ValueMap > | SectionMap |
Section字典 | |
Public 成员函数 | |
ConfigIni (const String &file_path) | |
加载 ini 文件 更多... | |
bool | Load (const String &file_path) |
加载 ini 文件 更多... | |
bool | Load (std::istream &is) |
加载 ini 文件 更多... | |
bool | LoadFromString (const String &content) |
加载 ini 格式字符串 更多... | |
bool | Save (const String &file_path) |
保存至 ini 文件 更多... | |
bool | Save (std::ostream &os) |
保存至 ini 文件 更多... | |
bool | SaveToString (String &content) |
保存至字符串 更多... | |
bool | HasSection (const String §ion) const |
是否存在section 更多... | |
bool | HasKey (const String §ion, const String &key) const |
是否存在值 更多... | |
SectionMap | GetSectionMap () const |
获取所有section | |
ValueMap | GetSection (const String §ion) const |
获取section 更多... | |
String | GetString (const String §ion, const String &key, const String &default_value=String()) const |
获取值 更多... | |
float | GetFloat (const String §ion, const String &key, float default_value=0.0f) const |
获取值 更多... | |
double | GetDouble (const String §ion, const String &key, double default_value=0.0) const |
获取值 更多... | |
int | GetInt (const String §ion, const String &key, int default_value=0) const |
获取值 更多... | |
bool | GetBool (const String §ion, const String &key, bool default_value=false) const |
获取值 更多... | |
void | SetSectionMap (const SectionMap §ions) |
设置所有section 更多... | |
void | SetSection (const String §ion, const ValueMap &values) |
设置section 更多... | |
void | SetString (const String §ion, const String &key, const String &value) |
设置值 更多... | |
void | SetFloat (const String §ion, const String &key, float value) |
设置值 更多... | |
void | SetDouble (const String §ion, const String &key, double value) |
设置值 更多... | |
void | SetInt (const String §ion, const String &key, int value) |
设置值 更多... | |
void | SetBool (const String §ion, const String &key, bool value) |
设置值 更多... | |
void | DeleteSection (const String §ion) |
删除section 更多... | |
void | DeleteKey (const String §ion, const String &key) |
删除值 更多... | |
ValueMap & | operator[] (const String §ion) |
const ValueMap & | operator[] (const String §ion) const |
![]() | |
ObjectBase () | |
构造基础对象 | |
void | SetName (const String &name) |
设置对象名 | |
String | GetName () const |
获取对象名 | |
bool | IsName (const String &name) const |
判断对象的名称是否相同 更多... | |
void * | GetUserData () const |
获取用户数据 | |
void | SetUserData (void *data) |
设置用户数据 | |
uint64_t | GetObjectID () const |
获取对象ID | |
void | DoSerialize (Serializer *serializer) const override |
序列化 | |
void | DoDeserialize (Deserializer *deserializer) override |
反序列化 | |
virtual bool | IsValid () const |
判断对象是否有效 | |
ObjectStatus * | GetStatus () const |
获取对象状态 | |
void | SetStatus (const ObjectStatus &status) |
设置对象状态 | |
void | Fail (const String &msg, int code=ObjectStatus::fail) |
将对象标记为失败状态 | |
void | ClearStatus () |
清除对象状态 | |
![]() | |
void | Retain () |
增加引用计数 | |
void | Release () |
减少引用计数 | |
uint32_t | GetRefCount () const |
获取引用计数 | |
![]() | |
Vector< uint8_t > | Serialize () const |
序列化为字节串 | |
void | Deserialize (const Vector< uint8_t > &data) |
从字节串反序列化 | |
额外继承的成员函数 | |
![]() | |
static void | SetObjectPolicy (const ObjectPolicyFunc &policy) |
设置对象处理策略 | |
static bool | IsTracingLeaks () |
是否启用了内存泄漏追踪 | |
static void | StartTracingLeaks () |
开始追踪内存泄漏 | |
static void | StopTracingLeaks () |
停止追踪内存泄漏 | |
static void | DumpTracingObjects () |
打印所有追踪中的对象信息 | |
static Vector< ObjectBase * > & | GetTracingObjects () |
获取所有追踪中的对象 | |
![]() | |
static void * | operator new (size_t size) |
static void | operator delete (void *ptr) |
static void * | operator new (size_t size, std::nothrow_t const &) noexcept |
static void | operator delete (void *ptr, std::nothrow_t const &) noexcept |
static void * | operator new (size_t size, void *ptr) noexcept |
static void | operator delete (void *ptr, void *place) noexcept |
ini格式文件
kiwano::ConfigIni::ConfigIni | ( | const String & | file_path | ) |
加载 ini 文件
file_path | 文件路径 |
void kiwano::ConfigIni::DeleteKey | ( | const String & | section, |
const String & | key | ||
) |
删除值
section | section的名称 |
key | key的名称 |
void kiwano::ConfigIni::DeleteSection | ( | const String & | section | ) |
删除section
section | section的名称 |
bool kiwano::ConfigIni::GetBool | ( | const String & | section, |
const String & | key, | ||
bool | default_value = false |
||
) | const |
获取值
section | section的名称 |
key | key的名称 |
default_value | 不存在时的默认值 |
double kiwano::ConfigIni::GetDouble | ( | const String & | section, |
const String & | key, | ||
double | default_value = 0.0 |
||
) | const |
获取值
section | section的名称 |
key | key的名称 |
default_value | 不存在时的默认值 |
float kiwano::ConfigIni::GetFloat | ( | const String & | section, |
const String & | key, | ||
float | default_value = 0.0f |
||
) | const |
获取值
section | section的名称 |
key | key的名称 |
default_value | 不存在时的默认值 |
int kiwano::ConfigIni::GetInt | ( | const String & | section, |
const String & | key, | ||
int | default_value = 0 |
||
) | const |
获取值
section | section的名称 |
key | key的名称 |
default_value | 不存在时的默认值 |
ConfigIni::ValueMap kiwano::ConfigIni::GetSection | ( | const String & | section | ) | const |
获取section
section | section的名称 |
String kiwano::ConfigIni::GetString | ( | const String & | section, |
const String & | key, | ||
const String & | default_value = String() |
||
) | const |
获取值
section | section的名称 |
key | key的名称 |
bool kiwano::ConfigIni::HasKey | ( | const String & | section, |
const String & | key | ||
) | const |
是否存在值
section | section的名称 |
key | key的名称 |
bool kiwano::ConfigIni::HasSection | ( | const String & | section | ) | const |
是否存在section
section | section的名称 |
bool kiwano::ConfigIni::Load | ( | const String & | file_path | ) |
加载 ini 文件
file_path | 文件路径 |
bool kiwano::ConfigIni::Load | ( | std::istream & | is | ) |
加载 ini 文件
is | 输入流 |
bool kiwano::ConfigIni::LoadFromString | ( | const String & | content | ) |
加载 ini 格式字符串
content | 输入内容 |
bool kiwano::ConfigIni::Save | ( | const String & | file_path | ) |
保存至 ini 文件
file_path | 文件路径 |
bool kiwano::ConfigIni::Save | ( | std::ostream & | os | ) |
保存至 ini 文件
os | 输出流 |
bool kiwano::ConfigIni::SaveToString | ( | String & | content | ) |
保存至字符串
content | 输出内容 |
void kiwano::ConfigIni::SetBool | ( | const String & | section, |
const String & | key, | ||
bool | value | ||
) |
设置值
section | section的名称 |
key | key的名称 |
value | 值 |
void kiwano::ConfigIni::SetDouble | ( | const String & | section, |
const String & | key, | ||
double | value | ||
) |
设置值
section | section的名称 |
key | key的名称 |
value | 值 |
void kiwano::ConfigIni::SetFloat | ( | const String & | section, |
const String & | key, | ||
float | value | ||
) |
设置值
section | section的名称 |
key | key的名称 |
value | 值 |
void kiwano::ConfigIni::SetInt | ( | const String & | section, |
const String & | key, | ||
int | value | ||
) |
设置值
section | section的名称 |
key | key的名称 |
value | 值 |
void kiwano::ConfigIni::SetSection | ( | const String & | section, |
const ValueMap & | values | ||
) |
设置section
section | section的名称 |
values | 键值字典 |
void kiwano::ConfigIni::SetSectionMap | ( | const SectionMap & | sections | ) |
设置所有section
sections | section字典 |
void kiwano::ConfigIni::SetString | ( | const String & | section, |
const String & | key, | ||
const String & | value | ||
) |
设置值
section | section的名称 |
key | key的名称 |
value | 值 |