-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#990: refactor script options parser #468
Changes from all commits
3b8102a
64e01da
4418b3d
62872d0
51beabe
9d0943c
dfabf34
3028278
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "base/javacontainer/script_options/converter_legacy.h" | ||
#include "base/javacontainer/script_options/string_ops.h" | ||
#include <iostream> | ||
#include <sstream> | ||
|
||
namespace SWIGVMContainers { | ||
|
||
namespace JavaScriptOptions { | ||
|
||
ConverterLegacy::ConverterLegacy() | ||
: Converter() | ||
, m_jarPaths() {} | ||
|
||
void ConverterLegacy::convertExternalJar(const std::string& value) { | ||
std::istringstream stream(value); | ||
std::string jar; | ||
|
||
while (std::getline(stream, jar, ':')) { | ||
m_jarPaths.insert(jar); | ||
} | ||
} | ||
|
||
|
||
} //namespace JavaScriptOptions | ||
|
||
} //namespace SWIGVMContainers |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef SCRIPTOPTIONLINEPARSERCONVERTERLEGACY_H | ||
#define SCRIPTOPTIONLINEPARSERCONVERTERLEGACY_H 1 | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <set> | ||
#include <memory> | ||
|
||
#include "base/javacontainer/script_options/converter.h" | ||
|
||
|
||
|
||
namespace SWIGVMContainers { | ||
|
||
namespace JavaScriptOptions { | ||
|
||
class ConverterLegacy : public Converter { | ||
|
||
public: | ||
ConverterLegacy(); | ||
|
||
void convertExternalJar(const std::string & value); | ||
|
||
const std::set<std::string> & getJarPaths() const { | ||
return m_jarPaths; | ||
} | ||
|
||
private: | ||
|
||
std::set<std::string> m_jarPaths; | ||
|
||
}; | ||
|
||
|
||
|
||
|
||
} //namespace JavaScriptOptions | ||
|
||
} //namespace SWIGVMContainers | ||
|
||
#endif //SCRIPTOPTIONLINEPARSERCONVERTER_H |
Nicoretti marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "base/javacontainer/script_options/converter_v2.h" | ||
#include "base/javacontainer/script_options/string_ops.h" | ||
#include <iostream> | ||
#include <sstream> | ||
|
||
namespace SWIGVMContainers { | ||
|
||
namespace JavaScriptOptions { | ||
|
||
ConverterV2::ConverterV2() | ||
: Converter() | ||
, m_jarPaths() {} | ||
|
||
void ConverterV2::convertExternalJar(const std::string & value) { | ||
std::istringstream stream(value); | ||
std::string jar; | ||
|
||
while (std::getline(stream, jar, ':')) { | ||
m_jarPaths.insert(jar); | ||
} | ||
} | ||
|
||
} //namespace JavaScriptOptions | ||
|
||
} //namespace SWIGVMContainers |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef SCRIPTOPTIONLINEPARSERCONVERTERV2_H | ||
#define SCRIPTOPTIONLINEPARSERCONVERTERV2_H 1 | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <set> | ||
#include <memory> | ||
|
||
#include "base/javacontainer/script_options/converter.h" | ||
|
||
|
||
|
||
namespace SWIGVMContainers { | ||
|
||
namespace JavaScriptOptions { | ||
|
||
class ConverterV2 : public Converter { | ||
|
||
public: | ||
ConverterV2(); | ||
|
||
void convertExternalJar(const std::string & value); | ||
|
||
const std::set<std::string> & getJarPaths() const { | ||
return m_jarPaths; | ||
} | ||
Comment on lines
+24
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Often, it is sufficient to expose only iterators rather than the full underlying (internal) data structure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function will change in a future PR completely. I only wanted to keep the size of the PR as small as possible. |
||
|
||
private: | ||
|
||
std::set<std::string> m_jarPaths; | ||
|
||
}; | ||
|
||
|
||
|
||
|
||
} //namespace JavaScriptOptions | ||
|
||
} //namespace SWIGVMContainers | ||
|
||
#endif //SCRIPTOPTIONLINEPARSERCONVERTER_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trimming happens in the Parser, or?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, here
Also there is unit test ensuring that we don't change the behavior:
script-languages/exaudfclient/base/javacontainer/test/cpp/javacontainer_test.cc
Line 49 in 3028278