PreVerify/QtYaml/QtYaml.h

35 lines
812 B
C
Raw Normal View History

2024-09-09 19:18:28 +08:00
#pragma once
#include <QString>
#include <yaml-cpp/yaml.h>
#include <vector>
#include "logger.h"
class QtYaml : public QObject
{
LOG4QT_DECLARE_QCLASS_LOGGER
public:
QtYaml() {}
~QtYaml() {}
YAML::Node LoadFile2(QString fileName);
bool LoadFile(QString& fileName);
bool LoadString(QString& data);
bool GetString(std::string sec, std::string key, std::string& s);
bool GetBool(std::string sec, std::string key, bool& b);
bool GetInt(std::string sec, std::string key, int& n);
bool GetDouble(std::string sec, std::string key, double& f);
private:
QString m_fileName;
YAML::Node m_node;
private:
QtYaml(QtYaml const&) = delete;
void operator=(QtYaml const&) = delete;
};
void split(std::vector<std::string>& strings, std::string data);
void split(std::vector<int>& ints, std::string data);