Commit 2854efba authored by legoc's avatar legoc
Browse files

(split) Implemented Instance::getResult() with optional string result

parent ce1e1776
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* Removed Option enum and defined OUTPUSTREAM as const int. * Removed Option enum and defined OUTPUSTREAM as const int.
* Added Instance::waitFor() and Instance::waitFor(int) for python binding. * Added Instance::waitFor() and Instance::waitFor(int) for python binding.
* Implemented subscriber and requester with optional string result in receive() function. * Implemented subscriber and requester with optional string result in receive() function.
* Implemented Instance::getResult() with optional string result.
1.0.2 1.0.2
----- -----
......
...@@ -291,8 +291,8 @@ public: ...@@ -291,8 +291,8 @@ public:
*/ */
int getExitCode() const; int getExitCode() const;
bool getBinaryResult(std::string& result); std::optional<std::string> getBinaryResult();
bool getResult(std::string& result); std::optional<std::string> getResult();
std::shared_ptr<OutputStreamSocket> getOutputStreamSocket(); std::shared_ptr<OutputStreamSocket> getOutputStreamSocket();
......
...@@ -748,21 +748,19 @@ int Instance::getExitCode() const { ...@@ -748,21 +748,19 @@ int Instance::getExitCode() const {
return m_exitCode; return m_exitCode;
} }
bool Instance::getBinaryResult(std::string& result) { std::optional<std::string> Instance::getBinaryResult() {
waitFor(); waitFor();
result = m_resultData;
return m_hasResult; if (m_hasResult) {
} return m_resultData;
}
bool Instance::getResult(std::string& result) {
string bytes; return {};
getBinaryResult(bytes); }
parse(bytes, result);
return m_hasResult; std::optional<std::string> Instance::getResult() {
return getBinaryResult();
} }
std::shared_ptr<OutputStreamSocket> Instance::getOutputStreamSocket() { std::shared_ptr<OutputStreamSocket> Instance::getOutputStreamSocket() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment