Skip to content

Commit

Permalink
Fixed compiler errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tomuben committed Oct 15, 2024
1 parent a846279 commit ef099fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
16 changes: 7 additions & 9 deletions exaudfclient/base/javacontainer/javacontainer_builder.cc
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
#include "base/javacontainer/javacontainer_builder.h"
#include "base/javacontainer/script_options/parser_ctpg.h"
#include "base/javacontainer/script_options/parser_legacy.h"
#include "base/javacontainer/javacontainer.h"
#include "base/swig_factory/swig_factory_impl.h"

#ifdef ENABLE_JAVA_VM

namespace SWIGVMContainers {

JavaContainerBuilder::JavaContainerBuilder()
: m_parser() {}
: m_useCtpgParser(false) {}

JavaContainerBuilder& JavaContainerBuilder::useCtpgParser(const bool useCtpgParser) {
if (useCtpgParser) {
m_parser = std::make_unique<JavaScriptOptions::ScriptOptionLinesParserCTPG>(std::make_unique<SwigFactoryImpl>());
}
m_useCtpgParser = useCtpgParser;
return *this;
}

JavaVMach* JavaContainerBuilder::build() {
if (m_parser) {
return new JavaVMach(false, std::move(m_parser));
std::unique_ptr<JavaScriptOptions::ScriptOptionsParser> parser;
if (m_useCtpgParser) {
parser = std::make_unique<JavaScriptOptions::ScriptOptionLinesParserCTPG>(std::make_unique<SwigFactoryImpl>());
} else {
m_parser = std::make_unique<JavaScriptOptions::ScriptOptionLinesParserLegacy>(std::make_unique<SwigFactoryImpl>());
return new JavaVMach(false, std::move(m_parser));
parser = std::make_unique<JavaScriptOptions::ScriptOptionLinesParserLegacy>(std::make_unique<SwigFactoryImpl>());
}
return new JavaVMach(false, std::move(parser));
}


Expand Down
5 changes: 2 additions & 3 deletions exaudfclient/base/javacontainer/javacontainer_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
#define JAVACONTAINER_BUILDER_H

#include <memory>
#include "base/javacontainer/javacontainer.h"

#ifdef ENABLE_JAVA_VM

namespace SWIGVMContainers {

class JavaVMach;

namespace JavaScriptOptions {

struct ScriptOptionsParser;
Expand All @@ -24,7 +23,7 @@ class JavaContainerBuilder {
JavaVMach* build();

private:
std::unique_ptr<JavaScriptOptions::ScriptOptionsParser> m_parser;
bool m_useCtpgParser;
};

} //namespace SWIGVMContainers
Expand Down
5 changes: 1 addition & 4 deletions exaudfclient/exaudfclient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
#include "protegrityclient.h"
#endif

#include "base/swig_factory/swig_factory_impl.h"

using namespace std;
using namespace SWIGVMContainers;

Expand Down Expand Up @@ -140,7 +138,6 @@ int main(int argc, char **argv) {
::setlocale(LC_ALL, "en_US.utf8");

std::function<SWIGVMContainers::SWIGVM*()>vmMaker=[](){return nullptr;}; // the initial vm maker returns NULL
SwigFactoryImpl swigFactory;
#ifdef UDF_PLUGIN_CLIENT
vmMaker = [](){return new SWIGVMContainers::Protegrity(false);};
#else
Expand All @@ -163,7 +160,7 @@ int main(int argc, char **argv) {
} else if (strcmp(argv[2], "lang=java")==0)
{
#ifdef ENABLE_JAVA_VM
vmMaker = [&](){return SWIGVMContainers::JavaContainerBuilder().build()};
vmMaker = [&](){return SWIGVMContainers::JavaContainerBuilder().build();};
#else
throw SWIGVM::exception("this exaudfclient has been compilied without Java support");
#endif
Expand Down

0 comments on commit ef099fd

Please sign in to comment.