implementace pugi xml
This commit is contained in:
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -65,7 +65,10 @@
|
||||
"bitset": "cpp",
|
||||
"codecvt": "cpp",
|
||||
"xtree": "cpp",
|
||||
"map": "cpp"
|
||||
"map": "cpp",
|
||||
"csignal": "cpp",
|
||||
"filesystem": "cpp",
|
||||
"list": "cpp"
|
||||
},
|
||||
"C_Cpp.errorSquiggles": "enabledIfIncludesResolve"
|
||||
}
|
||||
74
include/pugiconfig.hpp
Normal file
74
include/pugiconfig.hpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* pugixml parser - version 1.7
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2015, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at http://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
*
|
||||
* This work is based on the pugxml parser, which is:
|
||||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
|
||||
#ifndef HEADER_PUGICONFIG_HPP
|
||||
#define HEADER_PUGICONFIG_HPP
|
||||
|
||||
// Uncomment this to enable wchar_t mode
|
||||
// #define PUGIXML_WCHAR_MODE
|
||||
|
||||
// Uncomment this to enable compact mode
|
||||
// #define PUGIXML_COMPACT
|
||||
|
||||
// Uncomment this to disable XPath
|
||||
// #define PUGIXML_NO_XPATH
|
||||
|
||||
// Uncomment this to disable STL
|
||||
// #define PUGIXML_NO_STL
|
||||
|
||||
// Uncomment this to disable exceptions
|
||||
// #define PUGIXML_NO_EXCEPTIONS
|
||||
|
||||
// Set this to control attributes for public classes/functions, i.e.:
|
||||
// #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL
|
||||
// #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL
|
||||
// #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall
|
||||
// In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead
|
||||
|
||||
// Tune these constants to adjust memory-related behavior
|
||||
// #define PUGIXML_MEMORY_PAGE_SIZE 32768
|
||||
// #define PUGIXML_MEMORY_OUTPUT_STACK 10240
|
||||
// #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096
|
||||
|
||||
// Uncomment this to switch to header-only version
|
||||
// #define PUGIXML_HEADER_ONLY
|
||||
|
||||
// Uncomment this to enable long long support
|
||||
// #define PUGIXML_HAS_LONG_LONG
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2015 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
1400
include/pugixml.hpp
Normal file
1400
include/pugixml.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,8 @@
|
||||
#include <filesystem>
|
||||
#include "plcLicence.h"
|
||||
#include "utils.h"
|
||||
#include "pugixml.hpp"
|
||||
|
||||
|
||||
#define CID_LENGTH 32
|
||||
#define CSD_LENGTH 32
|
||||
@@ -58,47 +60,20 @@ PlcLicence::PlcLicence()
|
||||
/// @param dataFileName
|
||||
void PlcLicence::processConfigFile(string &dataFileName)
|
||||
{
|
||||
std::string content;
|
||||
|
||||
#ifdef LINUX
|
||||
// dataFileName = getCompletePath(dataFileName);
|
||||
#endif
|
||||
std::ifstream inputFile(dataFileName);
|
||||
|
||||
if (inputFile.is_open())
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_parse_result result = doc.load_file("licData.xml");
|
||||
if (result)
|
||||
{
|
||||
content.assign((std::istreambuf_iterator<char>(inputFile)), (std::istreambuf_iterator<char>()));
|
||||
inputFile.close();
|
||||
// std::cout << "File content:\n" << content << std::endl;
|
||||
this->stationName = doc.child("data").child("station").child_value();
|
||||
this->distributor = doc.child("data").child("distributor").child_value();
|
||||
;
|
||||
// cout << doc.child("data").child("plcType").attribute("t").value() << endl;
|
||||
// cout << doc.child("data").child("plcType").child_value() << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Unable to open the file." << std::endl;
|
||||
}
|
||||
|
||||
string station = getXmlContentFromString(content, "station");
|
||||
string distributor = getXmlContentFromString(content, "distributor");
|
||||
|
||||
// cout << station;
|
||||
// cout << distributor;
|
||||
|
||||
this->stationName = station;
|
||||
this->distributor = distributor;
|
||||
|
||||
// char stationCh[station.length()] = {};
|
||||
// getCharsFromString(station, stationCh);
|
||||
|
||||
// char distributorCh[distributor.length()] = {};
|
||||
// getCharsFromString(distributor, distributorCh);
|
||||
|
||||
// this->stationName = stationCh;
|
||||
// this->distributor = distributorCh;
|
||||
|
||||
// this->stationName = "ceskatrebova";
|
||||
// this->distributor = "RO1";
|
||||
|
||||
// cout << this->stationName << "\n";
|
||||
// cout << this->distributor << "\n";
|
||||
}
|
||||
|
||||
PlcLicence::PlcLicence(map<string, string> &arguments)
|
||||
|
||||
12444
src/pugixml.cpp
Normal file
12444
src/pugixml.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user