From da04db2668e2f5f6216ef1534b5c73d86626822f Mon Sep 17 00:00:00 2001 From: Michal Michalski Date: Wed, 4 Dec 2019 08:58:26 +0100 Subject: [PATCH] [common] MessageStorageFindFolders simplified implementation. + add default constructor to PlatformResult + add tools::PostMessage overload for json message [Verification] code compiles. Signed-off-by: Michal Michalski Change-Id: Iafed8da9ebc6519f84f3341324f7ef4908ac9e61 --- src/common/extension.cc | 4 ++++ src/common/extension.h | 1 + src/common/platform_result.cc | 4 ++++ src/common/platform_result.h | 1 + 4 files changed, 10 insertions(+) diff --git a/src/common/extension.cc b/src/common/extension.cc index 9fc1547..713e03e 100644 --- a/src/common/extension.cc +++ b/src/common/extension.cc @@ -250,6 +250,10 @@ void Instance::PostMessage(Instance* that, const char* msg) { LoggerE("Trying to post message to non-existing instance: [%p], ignoring", that); } +void Instance::PostMessage(Instance* that, const picojson::value& json) { + Instance::PostMessage(that, json.serialize().c_str()); +} + void Instance::PostMessage(const char* msg) { ScopeLogger(); if (!xw_instance_) { diff --git a/src/common/extension.h b/src/common/extension.h index 9bb16f4..f9e0e68 100644 --- a/src/common/extension.h +++ b/src/common/extension.h @@ -94,6 +94,7 @@ class Instance { virtual ~Instance(); static void PostMessage(Instance* that, const char* msg); + static void PostMessage(Instance* that, const picojson::value& json); void PostMessage(const char* msg); void SendSyncReply(const char* reply); diff --git a/src/common/platform_result.cc b/src/common/platform_result.cc index f376528..39c3021 100644 --- a/src/common/platform_result.cc +++ b/src/common/platform_result.cc @@ -19,6 +19,10 @@ namespace common { +PlatformResult::PlatformResult() + : PlatformResult(ErrorCode::NO_ERROR, "NO_ERROR") { +} + PlatformResult::PlatformResult(const ErrorCode& error_code, const std::string& message) : error_code_(error_code), message_(message) { ScopeLogger(); diff --git a/src/common/platform_result.h b/src/common/platform_result.h index 2683045..95b7c30 100644 --- a/src/common/platform_result.h +++ b/src/common/platform_result.h @@ -72,6 +72,7 @@ enum class ErrorCode : int { class PlatformResult { public: + explicit PlatformResult(); explicit PlatformResult(const ErrorCode& error_code, const std::string& message = ""); ErrorCode error_code() const { -- 2.7.4