|
|
@@ -1,6 +1,5 @@
|
|
|
#include "iniparser.h"
|
|
|
|
|
|
-#include <list>
|
|
|
#include <sstream>
|
|
|
|
|
|
#include "hdef.h"
|
|
|
@@ -286,6 +285,25 @@ int IniParser::SaveAs(const char* filepath) {
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+std::list<std::string> IniParser::GetKeys(const std::string& section)
|
|
|
+{
|
|
|
+ std::list<std::string> ret;
|
|
|
+ if (root_ == NULL) return std::move(ret);
|
|
|
+
|
|
|
+ IniNode* pSection = root_;
|
|
|
+ if (section.length() != 0) {
|
|
|
+ pSection = root_->Get(section, IniNode::INI_NODE_TYPE_SECTION);
|
|
|
+ if (pSection == NULL) return std::move(ret);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (auto pNode : pSection->children) {
|
|
|
+ if (pNode->type == IniNode::INI_NODE_TYPE_KEY_VALUE) {
|
|
|
+ ret.push_back(pNode->label);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return std::move(ret);
|
|
|
+}
|
|
|
+
|
|
|
std::string IniParser::GetValue(const std::string& key, const std::string& section) {
|
|
|
if (root_ == NULL) return "";
|
|
|
|