48 lines
1.8 KiB
C++
48 lines
1.8 KiB
C++
/*
|
|
* SimpleIniParser
|
|
* Copyright (c) 2019 Nichole Mattera
|
|
*
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "IniOption.hpp"
|
|
|
|
namespace simpleIniParser {
|
|
enum class IniSectionType {
|
|
Any,
|
|
Section,
|
|
SemicolonComment,
|
|
HashtagComment,
|
|
HekateCaption,
|
|
};
|
|
|
|
class IniSection {
|
|
public:
|
|
IniSectionType type;
|
|
std::string value;
|
|
std::vector<IniOption *> options;
|
|
|
|
IniSection(IniSectionType type, std::string value);
|
|
~IniSection();
|
|
IniOption * findFirstOption(std::string key, bool caseSensitive = true, IniOptionType type = IniOptionType::Any, IniOptionSearchField field = IniOptionSearchField::Key);
|
|
IniOption * findOrCreateFirstOption(std::string key, std::string val, bool caseSensitive = true, IniOptionType type = IniOptionType::Any, IniOptionSearchField field = IniOptionSearchField::Key);
|
|
std::string build();
|
|
static IniSection * parse(std::string line, bool parseComments);
|
|
};
|
|
}
|