App: add methods to change import/export module of a registered filetype

This commit is contained in:
wmayer
2020-01-18 15:29:44 +01:00
parent a3622ee49f
commit 120b69c74f
5 changed files with 69 additions and 11 deletions

View File

@@ -130,13 +130,13 @@
using namespace App;
using namespace std;
using namespace boost;
using namespace boost::program_options;
// scriptings (scripts are built-in but can be overridden by command line option)
#include <App/InitScript.h>
#include <App/TestScript.h>
#include <App/CMakeScript.h>
using namespace boost::program_options;
// scriptings (scripts are built-in but can be overridden by command line option)
#include <App/InitScript.h>
#include <App/TestScript.h>
#include <App/CMakeScript.h>
#ifdef _MSC_VER // New handler for Microsoft Visual C++ compiler
# pragma warning( disable : 4535 )
@@ -1082,6 +1082,16 @@ void Application::addImportType(const char* Type, const char* ModuleName)
}
}
void Application::changeImportModule(const char* Type, const char* OldModuleName, const char* NewModuleName)
{
for (auto& it : _mImportTypes) {
if (it.filter == Type && it.module == OldModuleName) {
it.module = NewModuleName;
break;
}
}
}
std::vector<std::string> Application::getImportModules(const char* Type) const
{
std::vector<std::string> modules;
@@ -1195,6 +1205,16 @@ void Application::addExportType(const char* Type, const char* ModuleName)
}
}
void Application::changeExportModule(const char* Type, const char* OldModuleName, const char* NewModuleName)
{
for (auto& it : _mExportTypes) {
if (it.filter == Type && it.module == OldModuleName) {
it.module = NewModuleName;
break;
}
}
}
std::vector<std::string> Application::getExportModules(const char* Type) const
{
std::vector<std::string> modules;
@@ -2256,7 +2276,7 @@ void Application::LoadParameters(void)
#if defined(_MSC_VER)
// fix weird error while linking boost (all versions of VC)
// VS2010: https://forum.freecadweb.org/viewtopic.php?f=4&t=1886&p=12553&hilit=boost%3A%3Afilesystem%3A%3Aget#p12553
// VS2010: https://forum.freecadweb.org/viewtopic.php?f=4&t=1886&p=12553&hilit=boost%3A%3Afilesystem%3A%3Aget#p12553
namespace boost { namespace program_options { std::string arg="arg"; } }
#if (defined (BOOST_VERSION) && (BOOST_VERSION >= 104100))
namespace boost { namespace program_options {
@@ -2946,7 +2966,7 @@ std::string Application::FindHomePath(const char* sCall)
binPath += L"bin";
SetDllDirectoryW(binPath.c_str());
// https://stackoverflow.com/questions/5625884/conversion-of-stdwstring-to-qstring-throws-linker-error
// https://stackoverflow.com/questions/5625884/conversion-of-stdwstring-to-qstring-throws-linker-error
#ifdef _MSC_VER
QString str = QString::fromUtf16(reinterpret_cast<const ushort *>(homePath.c_str()));
#else