Skip to content

Commit

Permalink
Issue #46 - Fix Visual C++ build
Browse files Browse the repository at this point in the history
  • Loading branch information
vldtecno committed May 26, 2024
1 parent b7eddd3 commit bc1e868
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 20 deletions.
5 changes: 3 additions & 2 deletions PTN_Engine/ImportExport/IFileExporter.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@

#include "PTN_Engine/ImportExport/IFileExporter.h"
#include "PTN_Engine/ImportExport/ActionsThreadOptionConversions.h"
#include "PTN_Engine/PTN_Engine.h"
#include "PTN_Engine/PTN_Exception.h"

namespace ptne
{
using namespace std;

void IFileExporter::_export(const PTN_Engine &ptnEngine)
IFileExporter::~IFileExporter() = default;

void IFileExporter::_exportInt(const PTN_Engine &ptnEngine)
{
if (ptnEngine.isEventLoopRunning())
{
Expand Down
4 changes: 3 additions & 1 deletion PTN_Engine/ImportExport/IFileImporter.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ namespace ptne
{
using namespace std;

void IFileImporter::_import(PTN_Engine &ptnEngine) const
IFileImporter::~IFileImporter() = default;

void IFileImporter::_importInt(PTN_Engine &ptnEngine) const
{
if (ptnEngine.isEventLoopRunning())
{
Expand Down
13 changes: 8 additions & 5 deletions PTN_Engine/ImportExport/XML/src/XML/XML_FileExporter.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* limitations under the License.
*/

#include "PTN_Engine/PTN_Engine.h"
#include "XML/XML_FileExporter.h"
#include "PTN_Engine/PTN_Engine.h"
#include <pugixml.hpp>
#include <vector>

Expand All @@ -26,7 +26,9 @@ namespace ptne
using namespace pugi;
using namespace std;

void XML_FileExporter::_export(const PTN_Engine &ptnEngine, const string& filePath)
XML_FileExporter::~XML_FileExporter() = default;

void XML_FileExporter::_export(const PTN_Engine &ptnEngine, const string &filePath)
{
m_filePath = filePath;
m_rootNode = m_document.append_child("PTN-Engine");
Expand All @@ -36,7 +38,7 @@ void XML_FileExporter::_export(const PTN_Engine &ptnEngine, const string& filePa
m_placesNode = m_rootNode.append_child("Places");
m_transitionsNode = m_rootNode.append_child("Transitions");
m_arcsNode = m_rootNode.append_child("Arcs");
IFileExporter::_export(ptnEngine);
IFileExporter::_exportInt(ptnEngine);
saveFile();
}

Expand Down Expand Up @@ -70,9 +72,10 @@ void XML_FileExporter::exportTransition(const TransitionProperties &transitionPr
}

xml_node requireNoActionsInExecution = transitionNode.append_child("RequireNoActionsInExecution");
requireNoActionsInExecution.append_attribute("value").set_value(transitionProperties.requireNoActionsInExecution? "true" : "false");
requireNoActionsInExecution.append_attribute("value").set_value(
transitionProperties.requireNoActionsInExecution ? "true" : "false");

auto exportArcs = [this](const vector<ArcProperties> arcsProperties, const string &typeStr)
auto exportArcs = [this](const vector<ArcProperties> &arcsProperties, const string &typeStr)
{
for (const auto &arcProperties : arcsProperties)
{
Expand Down
2 changes: 1 addition & 1 deletion PTN_Engine/ImportExport/XML/src/XML/XML_FileExporter.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace ptne
class XML_FileExporter : public IFileExporter
{
public:
~XML_FileExporter() override = default;
~XML_FileExporter() override;
XML_FileExporter() = default;
XML_FileExporter(const XML_FileExporter &) = delete;
XML_FileExporter(XML_FileExporter &&) = delete;
Expand Down
4 changes: 3 additions & 1 deletion PTN_Engine/ImportExport/XML/src/XML/XML_FileImporter.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,15 @@ size_t getNodeValue(const string &nodeName, const xml_node &xmlNode)

namespace ptne
{
XML_FileImporter::~XML_FileImporter() = default;

void XML_FileImporter::_import(const string &filePath, PTN_Engine &ptnEngine)
{
if (const auto &result = m_document.load_file(filePath.c_str()); !result)
{
throw PTN_Exception(result.description());
}
IFileImporter::_import(ptnEngine);
IFileImporter::_importInt(ptnEngine);
}

string XML_FileImporter::importActionsThreadOption() const
Expand Down
2 changes: 1 addition & 1 deletion PTN_Engine/ImportExport/XML/src/XML/XML_FileImporter.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PTN_Engine;
class XML_FileImporter : public IFileImporter //, public IFileImporter
{
public:
~XML_FileImporter() override = default;
~XML_FileImporter() override;
XML_FileImporter() = default;
XML_FileImporter(const XML_FileImporter &) = delete;
XML_FileImporter(XML_FileImporter &&) = delete;
Expand Down
9 changes: 5 additions & 4 deletions PTN_Engine/ImportExport/include/PTN_Engine/ImportExport/IFileExporter.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@
namespace ptne
{

struct ArcProperties;
class PTN_Engine;
class PlaceProperties;
class TransitionProperties;
struct PlaceProperties;
struct TransitionProperties;

//!
//! \brief The IFileExporter class is an interface for all PTN_Engine file exporters.
//!
class DLL_PUBLIC IFileExporter
{
public:
virtual ~IFileExporter() = default;
virtual ~IFileExporter();

//!
//! \brief Export a PTN_Engine object to a file.
Expand All @@ -44,7 +45,7 @@ class DLL_PUBLIC IFileExporter
virtual void _export(const PTN_Engine &ptnEngine, const std::string &filePath) = 0;

protected:
void _export(const PTN_Engine &ptnEngine);
void _exportInt(const PTN_Engine &ptnEngine);

private:
virtual void exportActionsThreadOption(const std::string &actionsThreadOption) = 0;
Expand Down
10 changes: 5 additions & 5 deletions PTN_Engine/ImportExport/include/PTN_Engine/ImportExport/IFileImporter.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
namespace ptne
{

class ArcProperties;
struct ArcProperties;
class PTN_Engine;
class PlaceProperties;
class TransitionProperties;
struct PlaceProperties;
struct TransitionProperties;

//!
//! \brief The IFileImporter class is an interface class for all PTN_Engine file importers.
//!
class DLL_PUBLIC IFileImporter
{
public:
virtual ~IFileImporter() = default;
virtual ~IFileImporter();

//!
//! \brief Import a PTN_Engine object from a file.
Expand All @@ -46,7 +46,7 @@ class DLL_PUBLIC IFileImporter
virtual void _import(const std::string &filePath, PTN_Engine &ptnEngine) = 0;

protected:
void _import(PTN_Engine &ptnEngine) const;
void _importInt(PTN_Engine &ptnEngine) const;

private:
virtual std::string importActionsThreadOption() const = 0;
Expand Down

0 comments on commit bc1e868

Please sign in to comment.