-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4bdf667
commit 8bc60b8
Showing
57 changed files
with
4,564 additions
and
4,564 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
*.pro.user | ||
*.pro.user.* | ||
|
||
*.pro.user | ||
*.pro.user.* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
TEMPLATE = lib | ||
|
||
QT -= qui | ||
QT += xml | ||
|
||
TARGET = CfgReader | ||
|
||
DEFINES += CFG_READER_LIB | ||
|
||
DESTDIR = ../../lib | ||
|
||
CONFIG(debug, debug|release) { | ||
|
||
TARGET = $$join(TARGET,,,_d) | ||
} else { | ||
|
||
} | ||
|
||
INCLUDEPATH += ./include | ||
|
||
HEADERS += $$files(./include/*.h) | ||
SOURCES += $$files(./src/*.cpp) | ||
TEMPLATE = lib | ||
|
||
QT -= qui | ||
QT += xml | ||
|
||
TARGET = CfgReader | ||
|
||
DEFINES += CFG_READER_LIB | ||
|
||
DESTDIR = ../../lib | ||
|
||
CONFIG(debug, debug|release) { | ||
|
||
TARGET = $$join(TARGET,,,_d) | ||
} else { | ||
|
||
} | ||
|
||
INCLUDEPATH += ./include | ||
|
||
HEADERS += $$files(./include/*.h) | ||
SOURCES += $$files(./src/*.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,89 @@ | ||
//------------------------------------------------------------------------------ | ||
// | ||
// XML config reader library | ||
// (с) maisvendoo 17/09/2016 | ||
// Developer: Dmitry Pritykin | ||
// | ||
//------------------------------------------------------------------------------ | ||
/*! | ||
* \file | ||
* \brief XML config reader library | ||
* \copyright maisvendoo | ||
* \author Dmitry Pritykin | ||
* \date 17/09/2016 | ||
*/ | ||
|
||
#ifndef CFGREADER_H | ||
#define CFGREADER_H | ||
|
||
#include <QDomDocument> | ||
#include <QDomElement> | ||
#include <QDomNode> | ||
#include <QString> | ||
#include <QFile> | ||
#include <QtGlobal> | ||
|
||
#if defined(CFG_READER_LIB) | ||
#define CFG_READER_EXPORT Q_DECL_EXPORT | ||
#else | ||
#define CFG_READER_EXPORT Q_DECL_IMPORT | ||
#endif | ||
|
||
/*! | ||
* \class CfgReader | ||
* \brief Work with XML config file | ||
*/ | ||
//----------------------------------------------------------------------------- | ||
// | ||
//----------------------------------------------------------------------------- | ||
class CFG_READER_EXPORT CfgReader | ||
{ | ||
public: | ||
|
||
CfgReader(); | ||
~CfgReader(); | ||
|
||
/// Loading of XML file | ||
bool load(QString path); | ||
|
||
/// Find first section by name | ||
QDomNode getFirstSection(QString section); | ||
/// Find next section | ||
QDomNode getNextSection(); | ||
|
||
/// Get field in section | ||
QDomNode getField(QDomNode secNode, QString field); | ||
|
||
/// Get string field | ||
bool getString(QString section, QString field, QString &value); | ||
/// Get string field | ||
bool getString(QDomNode secNode, QString field, QString &value); | ||
/// Get double field | ||
bool getDouble(QString section, QString filed, double &value); | ||
/// Get double field | ||
bool getDouble(QDomNode secNode, QString field, double &value); | ||
/// Get integer field | ||
bool getInt(QString section, QString filed, int &value); | ||
/// Get integer field | ||
bool getInt(QDomNode secNode, QString field, int &value); | ||
/// Get boolean filed | ||
bool getBool(QString section, QString field, bool &value); | ||
/// Get boolean field | ||
bool getBool(QDomNode secNode, QString field, bool &value); | ||
|
||
private: | ||
|
||
/// File object | ||
QFile *file; | ||
/// File name | ||
QString file_name; | ||
/// Document object | ||
QDomDocument domDoc; | ||
/// First element in document | ||
QDomElement firstElement; | ||
/// Current document node for parsed file | ||
QDomNode curNode; | ||
}; | ||
|
||
#endif // CFGREADER_H | ||
|
||
//------------------------------------------------------------------------------ | ||
// | ||
// XML config reader library | ||
// (с) maisvendoo 17/09/2016 | ||
// Developer: Dmitry Pritykin | ||
// | ||
//------------------------------------------------------------------------------ | ||
/*! | ||
* \file | ||
* \brief XML config reader library | ||
* \copyright maisvendoo | ||
* \author Dmitry Pritykin | ||
* \date 17/09/2016 | ||
*/ | ||
|
||
#ifndef CFGREADER_H | ||
#define CFGREADER_H | ||
|
||
#include <QDomDocument> | ||
#include <QDomElement> | ||
#include <QDomNode> | ||
#include <QString> | ||
#include <QFile> | ||
#include <QtGlobal> | ||
|
||
#if defined(CFG_READER_LIB) | ||
#define CFG_READER_EXPORT Q_DECL_EXPORT | ||
#else | ||
#define CFG_READER_EXPORT Q_DECL_IMPORT | ||
#endif | ||
|
||
/*! | ||
* \class CfgReader | ||
* \brief Work with XML config file | ||
*/ | ||
//----------------------------------------------------------------------------- | ||
// | ||
//----------------------------------------------------------------------------- | ||
class CFG_READER_EXPORT CfgReader | ||
{ | ||
public: | ||
|
||
CfgReader(); | ||
~CfgReader(); | ||
|
||
/// Loading of XML file | ||
bool load(QString path); | ||
|
||
/// Find first section by name | ||
QDomNode getFirstSection(QString section); | ||
/// Find next section | ||
QDomNode getNextSection(); | ||
|
||
/// Get field in section | ||
QDomNode getField(QDomNode secNode, QString field); | ||
|
||
/// Get string field | ||
bool getString(QString section, QString field, QString &value); | ||
/// Get string field | ||
bool getString(QDomNode secNode, QString field, QString &value); | ||
/// Get double field | ||
bool getDouble(QString section, QString filed, double &value); | ||
/// Get double field | ||
bool getDouble(QDomNode secNode, QString field, double &value); | ||
/// Get integer field | ||
bool getInt(QString section, QString filed, int &value); | ||
/// Get integer field | ||
bool getInt(QDomNode secNode, QString field, int &value); | ||
/// Get boolean filed | ||
bool getBool(QString section, QString field, bool &value); | ||
/// Get boolean field | ||
bool getBool(QDomNode secNode, QString field, bool &value); | ||
|
||
private: | ||
|
||
/// File object | ||
QFile *file; | ||
/// File name | ||
QString file_name; | ||
/// Document object | ||
QDomDocument domDoc; | ||
/// First element in document | ||
QDomElement firstElement; | ||
/// Current document node for parsed file | ||
QDomNode curNode; | ||
}; | ||
|
||
#endif // CFGREADER_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
//------------------------------------------------------------------------------ | ||
// | ||
// Strings to numbers conversion | ||
// (с) maisvendoo 17/09/2016 | ||
// Devleloper: Dmitry Pritykin | ||
// | ||
//------------------------------------------------------------------------------ | ||
/*! | ||
* \file | ||
* \brief Strings to numbers conversion | ||
* \copyright maisvendoo | ||
* \author Dmitry Pritykin | ||
* \date 17/09/2016 | ||
*/ | ||
|
||
#ifndef CONVERT_H | ||
#define CONVERT_H | ||
|
||
#include <QString> | ||
#include <QtGlobal> | ||
|
||
/// QString to double | ||
extern "C" Q_DECL_EXPORT bool TextToDouble(QString text, double &value); | ||
/// QString to integer | ||
extern "C" Q_DECL_EXPORT bool TextToInt(QString text, int &value); | ||
/// Erase all spaces from QString | ||
QString EraseSpaces(QString str); | ||
|
||
#endif | ||
//------------------------------------------------------------------------------ | ||
// | ||
// Strings to numbers conversion | ||
// (с) maisvendoo 17/09/2016 | ||
// Devleloper: Dmitry Pritykin | ||
// | ||
//------------------------------------------------------------------------------ | ||
/*! | ||
* \file | ||
* \brief Strings to numbers conversion | ||
* \copyright maisvendoo | ||
* \author Dmitry Pritykin | ||
* \date 17/09/2016 | ||
*/ | ||
|
||
#ifndef CONVERT_H | ||
#define CONVERT_H | ||
|
||
#include <QString> | ||
#include <QtGlobal> | ||
|
||
/// QString to double | ||
extern "C" Q_DECL_EXPORT bool TextToDouble(QString text, double &value); | ||
/// QString to integer | ||
extern "C" Q_DECL_EXPORT bool TextToInt(QString text, int &value); | ||
/// Erase all spaces from QString | ||
QString EraseSpaces(QString str); | ||
|
||
#endif |
Oops, something went wrong.