Skip to content

Commit

Permalink
Separate file for version compatibility handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacsv committed Jun 1, 2020
1 parent d6de027 commit c5d14fe
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 23 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.6)
set (VSE_VERSION_1 0)
set (VSE_VERSION_2 2)
set (VSE_VERSION_3 12)
set (VSE_APP_NAME VisualScriptEngine)
set (VSE_LIB_NAME VisualScriptEngine)

function (SetCompilerOptions module)
set (DebugOptions)
Expand Down
2 changes: 1 addition & 1 deletion Sources/NodeUIEngine/NUIE_ClipboardHandler.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "NUIE_ClipboardHandler.hpp"
#include "NUIE_VersionInfo.hpp"
#include "NUIE_VersionCompatibility.hpp"

namespace NUIE
{
Expand Down
2 changes: 1 addition & 1 deletion Sources/NodeUIEngine/NUIE_NodeEditor.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "NUIE_NodeEditor.hpp"
#include "NUIE_NodeCommonMenuCommands.hpp"
#include "NUIE_NodeUIManagerCommands.hpp"
#include "NUIE_Version.hpp"
#include "NUIE_VersionCompatibility.hpp"
#include "NE_MemoryStream.hpp"

#include <fstream>
Expand Down
14 changes: 0 additions & 14 deletions Sources/NodeUIEngine/NUIE_Version.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#include "NUIE_Version.hpp"
#include "NUIE_VersionInfo.hpp"

#include <array>

namespace NUIE
{
Expand Down Expand Up @@ -77,15 +74,4 @@ NE::Stream::Status Version::Write (NE::OutputStream& outputStream) const
return outputStream.GetStatus ();
}

const Version& GetCurrentVersion ()
{
static const Version EngineVersion (VSE_VERSION_1, VSE_VERSION_2, VSE_VERSION_3);
return EngineVersion;
}

bool IsCompatibleVersion (const Version& version)
{
return version <= GetCurrentVersion ();
}

}
3 changes: 0 additions & 3 deletions Sources/NodeUIEngine/NUIE_Version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ class Version
std::array<int, 3> versions;
};

const Version& GetCurrentVersion ();
bool IsCompatibleVersion (const Version& version);

}

#endif
18 changes: 18 additions & 0 deletions Sources/NodeUIEngine/NUIE_VersionCompatibility.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "NUIE_VersionCompatibility.hpp"
#include "NUIE_VersionInfo.hpp"

namespace NUIE
{

const Version& GetCurrentVersion ()
{
static const Version EngineVersion (VSE_VERSION_1, VSE_VERSION_2, VSE_VERSION_3);
return EngineVersion;
}

bool IsCompatibleVersion (const Version& version)
{
return version <= GetCurrentVersion ();
}

}
14 changes: 14 additions & 0 deletions Sources/NodeUIEngine/NUIE_VersionCompatibility.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef NUIE_VERSIONCOMPATIBILITY_HPP
#define NUIE_VERSIONCOMPATIBILITY_HPP

#include "NUIE_Version.hpp"

namespace NUIE
{

const Version& GetCurrentVersion ();
bool IsCompatibleVersion (const Version& version);

}

#endif
2 changes: 1 addition & 1 deletion Sources/NodeUIEngine/NUIE_VersionInfo.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define VSE_VERSION_1 @VSE_VERSION_1@
#define VSE_VERSION_2 @VSE_VERSION_2@
#define VSE_VERSION_3 @VSE_VERSION_3@
#define VSE_APP_NAME L"@VSE_APP_NAME@"
#define VSE_LIB_NAME L"@VSE_LIB_NAME@"
#define VSE_VERSION_STRING L"v@VSE_VERSION_1@.@VSE_VERSION_2@.@VSE_VERSION_3@"

#endif
5 changes: 3 additions & 2 deletions Sources/WindowsAppSupport/WAS_ClipboardHandler.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "WAS_ClipboardHandler.hpp"
#include "NE_Debug.hpp"
#include "NUIE_VersionInfo.hpp"
#include "NUIE_VersionCompatibility.hpp"
#include "NE_Debug.hpp"

namespace WAS
{
Expand All @@ -9,7 +10,7 @@ ClipboardHandler::ClipboardHandler () :
NUIE::ClipboardHandler (),
formatId (0)
{
formatId = RegisterClipboardFormat (VSE_APP_NAME);
formatId = RegisterClipboardFormat (VSE_LIB_NAME);
}

ClipboardHandler::~ClipboardHandler ()
Expand Down

0 comments on commit c5d14fe

Please sign in to comment.