diff options
author | JackLivio <jack@livio.io> | 2018-10-19 15:05:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-19 15:05:09 -0400 |
commit | d36316738785c96dab2ee892762ed08c059fffde (patch) | |
tree | 168a7c0705b5bc8f0dee7ce4b511ccf71759d9b4 /src/components/formatters | |
parent | 7f7fcbb998fb17f2954fd103349af67ea9b71a3f (diff) | |
parent | 83c5e805346d55ec7fb9f4ba8b6f6855d992273e (diff) | |
download | sdl_core-hotfix/templates_updates.tar.gz |
Merge pull request #2572 from smartdevicelink/release/5.0.05.0.0hotfix/templates_updatesfeature/show_app_menufeature/progress_bar_seekfeature/open-menu-rpcfeature/open-menu-rfeature/button
Release 5.0.0
Diffstat (limited to 'src/components/formatters')
26 files changed, 291 insertions, 267 deletions
diff --git a/src/components/formatters/include/formatters/CFormatterJsonBase.h b/src/components/formatters/include/formatters/CFormatterJsonBase.h index 1df706839f..66ffa0c1c5 100644 --- a/src/components/formatters/include/formatters/CFormatterJsonBase.h +++ b/src/components/formatters/include/formatters/CFormatterJsonBase.h @@ -38,9 +38,9 @@ #include "smart_objects/smart_object.h" #include "json/json.h" -namespace NsSmartDeviceLink { -namespace NsJSONHandler { -namespace Formatters { +namespace ns_smart_device_link { +namespace ns_json_handler { +namespace formatters { namespace meta_formatter_error_code { /** @@ -99,7 +99,7 @@ class CFormatterJsonBase { */ static void jsonValueToObj( const Json::Value& value, - NsSmartDeviceLink::NsSmartObjects::SmartObject& obj); + ns_smart_device_link::ns_smart_objects::SmartObject& obj); /** * @brief The method constructs a JSON object from the input SmartObject @@ -109,11 +109,11 @@ class CFormatterJsonBase { *input SmartObject. */ static void objToJsonValue( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& obj, + const ns_smart_device_link::ns_smart_objects::SmartObject& obj, Json::Value& value); }; } } -} // namespace NsSmartDeviceLink::NsJSONHandler::Formatters +} // namespace ns_smart_device_link::ns_json_handler::formatters #endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_CFORMATTERJSONBASE_H_ diff --git a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h index f22b1216ab..d2fdf87957 100644 --- a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h +++ b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h @@ -40,9 +40,9 @@ #include "formatters/CSmartFactory.h" #include "formatters/meta_formatter.h" -namespace NsSmartDeviceLink { -namespace NsJSONHandler { -namespace Formatters { +namespace ns_smart_device_link { +namespace ns_json_handler { +namespace formatters { /** * @brief Class is used to convert SmartObjects to JSON string and vice versa. @@ -69,7 +69,7 @@ class CFormatterJsonSDLRPCv1 : public CFormatterJsonBase { * @brief Extracts a message type from the SmartObject */ static const std::string getMessageType( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& obj); + const ns_smart_device_link::ns_smart_objects::SmartObject& obj); /** * @brief Extracts a message type from the root JSON object. @@ -117,7 +117,7 @@ class CFormatterJsonSDLRPCv1 : public CFormatterJsonBase { static const int32_t kMessageTypeNotFound; static const int32_t kCorrelationIdNotFound; - typedef NsSmartDeviceLink::NsJSONHandler::Formatters:: + typedef ns_smart_device_link::ns_json_handler::formatters:: meta_formatter_error_code::tMetaFormatterErrorCode tMetaFormatterErrorCode; @@ -129,7 +129,7 @@ class CFormatterJsonSDLRPCv1 : public CFormatterJsonBase { * @return true if success, false otherwise */ static bool toString( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& obj, + const ns_smart_device_link::ns_smart_objects::SmartObject& obj, std::string& outStr); /** @@ -142,7 +142,7 @@ class CFormatterJsonSDLRPCv1 : public CFormatterJsonBase { template <typename FunctionId, typename MessageType> static int32_t fromString( const std::string& str, - NsSmartDeviceLink::NsSmartObjects::SmartObject& out); + ns_smart_device_link::ns_smart_objects::SmartObject& out); /** * @brief Converts to string the smart object against the given schema @@ -154,17 +154,17 @@ class CFormatterJsonSDLRPCv1 : public CFormatterJsonBase { * @return formatting error code */ static tMetaFormatterErrorCode MetaFormatToString( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& object, - const NsSmartDeviceLink::NsSmartObjects::CSmartSchema& schema, + const ns_smart_device_link::ns_smart_objects::SmartObject& object, + const ns_smart_device_link::ns_smart_objects::CSmartSchema& schema, std::string& outStr); }; // ---------------------------------------------------------------------------- template <typename FunctionId, typename MessageType> -int32_t Formatters::CFormatterJsonSDLRPCv1::fromString( +int32_t formatters::CFormatterJsonSDLRPCv1::fromString( const std::string& str, - NsSmartDeviceLink::NsSmartObjects::SmartObject& out) { + ns_smart_device_link::ns_smart_objects::SmartObject& out) { int32_t result = kSuccess; try { @@ -189,7 +189,7 @@ int32_t Formatters::CFormatterJsonSDLRPCv1::fromString( MessageType messageType = MessageType::INVALID_ENUM; if (kSuccess == result) { - if (!NsSmartObjects::EnumConversionHelper<MessageType>::StringToEnum( + if (!ns_smart_objects::EnumConversionHelper<MessageType>::StringToEnum( type, &messageType)) { // If MessageType is not found than FunctionId and CorrelationId can not // be found either @@ -199,14 +199,14 @@ int32_t Formatters::CFormatterJsonSDLRPCv1::fromString( } if (kSuccess == result) { - if (!NsSmartObjects::EnumConversionHelper<FunctionId>::StringToEnum( + if (!ns_smart_objects::EnumConversionHelper<FunctionId>::StringToEnum( root[type][S_NAME].asString(), &functionId)) { result = kFunctionIdNotFound; functionId = FunctionId::INVALID_ENUM; } } - namespace S = NsSmartDeviceLink::NsJSONHandler::strings; + namespace S = ns_smart_device_link::ns_json_handler::strings; if (!(result & kMessageTypeNotFound)) { jsonValueToObj(root[type][S_PARAMETERS], out[S::S_MSG_PARAMS]); @@ -234,6 +234,6 @@ int32_t Formatters::CFormatterJsonSDLRPCv1::fromString( } } } -} // namespace NsSmartDeviceLink::NsJSONHandler::Formatters +} // namespace ns_smart_device_link::ns_json_handler::formatters #endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_CFORMATTERJSONSDLRPCV1_H_ diff --git a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h index 8260a35959..e248954552 100644 --- a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h +++ b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h @@ -38,9 +38,9 @@ #include "CFormatterJsonBase.h" #include "formatters/CSmartFactory.h" -namespace NsSmartDeviceLink { -namespace NsJSONHandler { -namespace Formatters { +namespace ns_smart_device_link { +namespace ns_json_handler { +namespace formatters { /** * @brief Class is used to convert SmartObjects to JSON string and vice versa. @@ -64,7 +64,7 @@ class CFormatterJsonSDLRPCv2 : public CFormatterJsonBase { CFormatterJsonSDLRPCv2(const CFormatterJsonSDLRPCv2&); public: - typedef NsSmartDeviceLink::NsJSONHandler::Formatters:: + typedef ns_smart_device_link::ns_json_handler::formatters:: meta_formatter_error_code::tMetaFormatterErrorCode tMetaFormatterErrorCode; @@ -76,7 +76,7 @@ class CFormatterJsonSDLRPCv2 : public CFormatterJsonBase { * @return true if success, false otherwise */ static bool toString( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& obj, + const ns_smart_device_link::ns_smart_objects::SmartObject& obj, std::string& outStr); /** @@ -91,10 +91,11 @@ class CFormatterJsonSDLRPCv2 : public CFormatterJsonBase { * @return true if success, otherwise - false */ template <typename FunctionId, typename MessageType> - static bool fromString(const std::string& str, - NsSmartDeviceLink::NsSmartObjects::SmartObject& out, - FunctionId functionId, - MessageType messageType); + static bool fromString( + const std::string& str, + ns_smart_device_link::ns_smart_objects::SmartObject& out, + FunctionId functionId, + MessageType messageType); /** * @brief Creates a SmartObject from a JSON string. @@ -113,11 +114,12 @@ class CFormatterJsonSDLRPCv2 : public CFormatterJsonBase { * @return true if success, otherwise - false */ template <typename FunctionId, typename MessageType> - static bool fromString(const std::string& str, - NsSmartDeviceLink::NsSmartObjects::SmartObject& out, - FunctionId functionId, - MessageType messageType, - int32_t correlationId); + static bool fromString( + const std::string& str, + ns_smart_device_link::ns_smart_objects::SmartObject& out, + FunctionId functionId, + MessageType messageType, + int32_t correlationId); /** * @brief Converts to string the smart object against the given schema @@ -129,15 +131,15 @@ class CFormatterJsonSDLRPCv2 : public CFormatterJsonBase { * @return formatting error code */ static tMetaFormatterErrorCode MetaFormatToString( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& object, - const NsSmartDeviceLink::NsSmartObjects::CSmartSchema& schema, + const ns_smart_device_link::ns_smart_objects::SmartObject& object, + const ns_smart_device_link::ns_smart_objects::CSmartSchema& schema, std::string& outStr); }; template <typename FunctionId, typename MessageType> inline bool CFormatterJsonSDLRPCv2::fromString( const std::string& str, - NsSmartDeviceLink::NsSmartObjects::SmartObject& out, + ns_smart_device_link::ns_smart_objects::SmartObject& out, FunctionId functionId, MessageType messageType) { bool result = true; @@ -146,7 +148,7 @@ inline bool CFormatterJsonSDLRPCv2::fromString( Json::Value root; Json::Reader reader; - namespace strings = NsSmartDeviceLink::NsJSONHandler::strings; + namespace strings = ns_smart_device_link::ns_json_handler::strings; bool result = reader.parse(str, root); if (true == result) { @@ -167,12 +169,12 @@ inline bool CFormatterJsonSDLRPCv2::fromString( template <typename FunctionId, typename MessageType> inline bool CFormatterJsonSDLRPCv2::fromString( const std::string& str, - NsSmartDeviceLink::NsSmartObjects::SmartObject& out, + ns_smart_device_link::ns_smart_objects::SmartObject& out, FunctionId functionId, MessageType messageType, int32_t correlationId) { bool result = fromString(str, out, functionId, messageType); - namespace strings = NsSmartDeviceLink::NsJSONHandler::strings; + namespace strings = ns_smart_device_link::ns_json_handler::strings; if (true == result) { out[strings::S_PARAMS][strings::S_CORRELATION_ID] = correlationId; @@ -182,6 +184,6 @@ inline bool CFormatterJsonSDLRPCv2::fromString( } } } -} // namespace NsSmartDeviceLink::NsJSONHandler::Formatters +} // namespace ns_smart_device_link::ns_json_handler::formatters #endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_CFORMATTERJSONSDLRPCV2_H_ diff --git a/src/components/formatters/include/formatters/CSmartFactory.h b/src/components/formatters/include/formatters/CSmartFactory.h index 9fed89253b..a48eab2a6b 100644 --- a/src/components/formatters/include/formatters/CSmartFactory.h +++ b/src/components/formatters/include/formatters/CSmartFactory.h @@ -40,8 +40,8 @@ #include <map> #include <string> -namespace NsSmartDeviceLink { -namespace NsJSONHandler { +namespace ns_smart_device_link { +namespace ns_json_handler { /** * @brief String constants used by SmartFactory. */ @@ -82,6 +82,10 @@ extern const std::string S_PROTOCOL_TYPE; extern const std::string S_CORRELATION_ID; /** + * @brief String constant for RPC_MSG_VERSION. + */ +extern const std::string S_RPC_MSG_VERSION; +/** * @brief String constant for "code" param name. */ extern const std::string kCode; @@ -149,8 +153,10 @@ class CSmartFactory { * * @return True if operation was successful or false otherwise. */ - bool attachSchema(NsSmartDeviceLink::NsSmartObjects::SmartObject& object, - const bool RemoveFakeParameters); + bool attachSchema( + ns_smart_device_link::ns_smart_objects::SmartObject& object, + const bool RemoveFakeParameters, + const utils::SemanticVersion& MessageVersion = utils::SemanticVersion()); /** * @brief Attach schema to the struct SmartObject. @@ -160,8 +166,9 @@ class CSmartFactory { * * @return True if operation was successful of false otherwise. */ - bool AttachSchema(const StructIdEnum struct_id, - NsSmartDeviceLink::NsSmartObjects::SmartObject& object); + bool AttachSchema( + const StructIdEnum struct_id, + ns_smart_device_link::ns_smart_objects::SmartObject& object); /** * @brief Create new SmartObject with attached function SmartSchema. @@ -176,7 +183,7 @@ class CSmartFactory { * SmartObject) function returns empty SmartObject with * null type. */ - NsSmartDeviceLink::NsSmartObjects::SmartObject CreateSmartObject( + ns_smart_device_link::ns_smart_objects::SmartObject CreateSmartObject( const FunctionIdEnum function_id, const MessageTypeEnum message_type); /** @@ -191,7 +198,7 @@ class CSmartFactory { * SmartObject) function returns empty SmartObject with * null type. */ - NsSmartDeviceLink::NsSmartObjects::SmartObject CreateSmartObject( + ns_smart_device_link::ns_smart_objects::SmartObject CreateSmartObject( const StructIdEnum struct_id); /** @@ -210,7 +217,7 @@ class CSmartFactory { */ bool GetSchema(const FunctionIdEnum function_id, const MessageTypeEnum message_type, - NsSmartDeviceLink::NsSmartObjects::CSmartSchema& result); + ns_smart_device_link::ns_smart_objects::CSmartSchema& result); /** * @brief Get SmartSchema for specific struct. @@ -227,7 +234,7 @@ class CSmartFactory { * found or false otherwise. */ bool GetSchema(const StructIdEnum struct_id, - NsSmartDeviceLink::NsSmartObjects::CSmartSchema& result); + ns_smart_device_link::ns_smart_objects::CSmartSchema& result); protected: /** @@ -237,7 +244,7 @@ class CSmartFactory { * functions. */ typedef std::map<SmartSchemaKey<FunctionIdEnum, MessageTypeEnum>, - NsSmartDeviceLink::NsSmartObjects::CSmartSchema> + ns_smart_device_link::ns_smart_objects::CSmartSchema> FuncionsSchemesMap; /** @@ -247,7 +254,7 @@ class CSmartFactory { * structs. */ typedef std::map<StructIdEnum, - NsSmartDeviceLink::NsSmartObjects::CSmartSchema> + ns_smart_device_link::ns_smart_objects::CSmartSchema> StructsSchemesMap; /** @@ -268,8 +275,9 @@ CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::CSmartFactory( template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum> bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::attachSchema( - NsSmartDeviceLink::NsSmartObjects::SmartObject& object, - const bool RemoveFakeParameters) { + ns_smart_device_link::ns_smart_objects::SmartObject& object, + const bool RemoveFakeParameters, + const utils::SemanticVersion& MessageVersion) { if (false == object.keyExists(strings::S_PARAMS)) return false; if (false == object[strings::S_PARAMS].keyExists(strings::S_MESSAGE_TYPE)) @@ -295,7 +303,9 @@ bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::attachSchema( } object.setSchema(schemaIterator->second); - schemaIterator->second.applySchema(object, RemoveFakeParameters); + + schemaIterator->second.applySchema( + object, RemoveFakeParameters, MessageVersion); return true; } @@ -303,7 +313,7 @@ bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::attachSchema( template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum> bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::AttachSchema( const StructIdEnum struct_id, - NsSmartDeviceLink::NsSmartObjects::SmartObject& object) { + ns_smart_device_link::ns_smart_objects::SmartObject& object) { typename StructsSchemesMap::iterator structs_iterator = structs_schemes_.find(struct_id); @@ -318,7 +328,7 @@ bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::AttachSchema( } template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum> -NsSmartDeviceLink::NsSmartObjects::SmartObject +ns_smart_device_link::ns_smart_objects::SmartObject CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::CreateSmartObject( const FunctionIdEnum function_id, const MessageTypeEnum message_type) { SmartSchemaKey<FunctionIdEnum, MessageTypeEnum> key(function_id, @@ -328,34 +338,34 @@ CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::CreateSmartObject( functions_schemes_.find(key); if (schema_iterator != functions_schemes_.end()) { - NsSmartDeviceLink::NsSmartObjects::SmartObject function_object( - NsSmartDeviceLink::NsSmartObjects::SmartType_Map); + ns_smart_device_link::ns_smart_objects::SmartObject function_object( + ns_smart_device_link::ns_smart_objects::SmartType_Map); function_object.setSchema(schema_iterator->second); schema_iterator->second.applySchema(function_object, false); return function_object; } - return NsSmartDeviceLink::NsSmartObjects::SmartObject(); + return ns_smart_device_link::ns_smart_objects::SmartObject(); } template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum> -NsSmartDeviceLink::NsSmartObjects::SmartObject +ns_smart_device_link::ns_smart_objects::SmartObject CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::CreateSmartObject( const StructIdEnum struct_id) { - NsSmartDeviceLink::NsSmartObjects::SmartObject struct_object( - NsSmartDeviceLink::NsSmartObjects::SmartType_Map); + ns_smart_device_link::ns_smart_objects::SmartObject struct_object( + ns_smart_device_link::ns_smart_objects::SmartType_Map); if (AttachSchema(struct_id, struct_object)) { return struct_object; } - return NsSmartDeviceLink::NsSmartObjects::SmartObject(); + return ns_smart_device_link::ns_smart_objects::SmartObject(); } template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum> bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::GetSchema( const FunctionIdEnum function_id, const MessageTypeEnum message_type, - NsSmartDeviceLink::NsSmartObjects::CSmartSchema& result) { + ns_smart_device_link::ns_smart_objects::CSmartSchema& result) { SmartSchemaKey<FunctionIdEnum, MessageTypeEnum> key(function_id, message_type); @@ -373,7 +383,7 @@ bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::GetSchema( template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum> bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::GetSchema( const StructIdEnum struct_id, - NsSmartDeviceLink::NsSmartObjects::CSmartSchema& result) { + ns_smart_device_link::ns_smart_objects::CSmartSchema& result) { typename StructsSchemesMap::iterator structs_iterator = structs_schemes_.find(struct_id); diff --git a/src/components/formatters/include/formatters/formatter_json_rpc.h b/src/components/formatters/include/formatters/formatter_json_rpc.h index 3d921ea901..842e176976 100644 --- a/src/components/formatters/include/formatters/formatter_json_rpc.h +++ b/src/components/formatters/include/formatters/formatter_json_rpc.h @@ -45,9 +45,9 @@ #include "CFormatterJsonBase.h" #include "formatters/CSmartFactory.h" -namespace NsSmartDeviceLink { -namespace NsJSONHandler { -namespace Formatters { +namespace ns_smart_device_link { +namespace ns_json_handler { +namespace formatters { /** * @brief Formatter for JSON RPC format. @@ -108,7 +108,7 @@ class FormatterJsonRpc : public CFormatterJsonBase { * * @return true if success, false otherwise. */ - static bool ToString(const NsSmartObjects::SmartObject& obj, + static bool ToString(const ns_smart_objects::SmartObject& obj, std::string& out_str); /** @@ -125,7 +125,7 @@ class FormatterJsonRpc : public CFormatterJsonBase { */ template <typename FunctionId, typename MessageType> static int32_t FromString(const std::string& str, - NsSmartObjects::SmartObject& out); + ns_smart_objects::SmartObject& out); private: /** @@ -223,7 +223,7 @@ class FormatterJsonRpc : public CFormatterJsonBase { */ template <typename FunctionId> static int32_t ParseFunctionId(const Json::Value& method_value, - NsSmartObjects::SmartObject& out); + ns_smart_objects::SmartObject& out); /** * @brief Set method. @@ -237,7 +237,7 @@ class FormatterJsonRpc : public CFormatterJsonBase { * @return true if function id was extracted successfully and set as a * value of "method" field. */ - static bool SetMethod(const NsSmartObjects::SmartObject& params, + static bool SetMethod(const ns_smart_objects::SmartObject& params, Json::Value& method_container); /** @@ -252,7 +252,7 @@ class FormatterJsonRpc : public CFormatterJsonBase { * @return true if request/response id was extracted successfully and set * as a value of "id" field. */ - static bool SetId(const NsSmartObjects::SmartObject& params, + static bool SetId(const ns_smart_objects::SmartObject& params, Json::Value& id_container); /** @@ -267,18 +267,18 @@ class FormatterJsonRpc : public CFormatterJsonBase { * @return true if message string was extracted successfully and set * as a value of "message" field. */ - static bool SetMessage(const NsSmartObjects::SmartObject& params, + static bool SetMessage(const ns_smart_objects::SmartObject& params, Json::Value& id_container); }; template <typename FunctionId, typename MessageType> int32_t FormatterJsonRpc::FromString(const std::string& str, - NsSmartObjects::SmartObject& out) { + ns_smart_objects::SmartObject& out) { int32_t result = kSuccess; try { Json::Value root; Json::Reader reader; - namespace strings = NsSmartDeviceLink::NsJSONHandler::strings; + namespace strings = ns_smart_device_link::ns_json_handler::strings; if (false == reader.parse(str, root)) { result = kParsingError | kMethodNotSpecified | kUnknownMethod | @@ -309,7 +309,7 @@ int32_t FormatterJsonRpc::FromString(const std::string& str, result |= ParseFunctionId<FunctionId>(root[kMethod], out); } out[strings::S_MSG_PARAMS] = - NsSmartObjects::SmartObject(NsSmartObjects::SmartType_Map); + ns_smart_objects::SmartObject(ns_smart_objects::SmartType_Map); } else { const Json::Value& id_value = root[kId]; @@ -323,7 +323,7 @@ int32_t FormatterJsonRpc::FromString(const std::string& str, id_value.asDouble(); } else if (true == id_value.isNull()) { out[strings::S_PARAMS][strings::S_CORRELATION_ID] = - NsSmartObjects::SmartObject(NsSmartObjects::SmartType_Null); + ns_smart_objects::SmartObject(ns_smart_objects::SmartType_Null); } else { result |= kInvalidFormat | kInvalidId; } @@ -332,14 +332,14 @@ int32_t FormatterJsonRpc::FromString(const std::string& str, message_type_string = kRequest; result |= ParseFunctionId<FunctionId>(root[kMethod], out); out[strings::S_MSG_PARAMS] = - NsSmartObjects::SmartObject(NsSmartObjects::SmartType_Map); + ns_smart_objects::SmartObject(ns_smart_objects::SmartType_Map); } else { Json::Value method_container; bool method_container_found = false; if (true == root.isMember(kResult)) { out[strings::S_MSG_PARAMS] = - NsSmartObjects::SmartObject(NsSmartObjects::SmartType_Map); + ns_smart_objects::SmartObject(ns_smart_objects::SmartType_Map); message_type_string = kResponse; response_value = root[kResult]; @@ -348,7 +348,7 @@ int32_t FormatterJsonRpc::FromString(const std::string& str, method_container_found = true; } else if (true == root.isMember(kError)) { out[strings::S_MSG_PARAMS] = - NsSmartObjects::SmartObject(NsSmartObjects::SmartType_Map); + ns_smart_objects::SmartObject(ns_smart_objects::SmartType_Map); message_type_string = kErrorResponse; response_value = root[kError]; response_value_found = true; @@ -382,7 +382,7 @@ int32_t FormatterJsonRpc::FromString(const std::string& str, if (0 == (result & kUnknownMessageType)) { MessageType message_type; - if (!NsSmartObjects::EnumConversionHelper<MessageType>::StringToEnum( + if (!ns_smart_objects::EnumConversionHelper<MessageType>::StringToEnum( message_type_string, &message_type)) { result |= kUnknownMessageType; } else { @@ -469,7 +469,7 @@ int32_t FormatterJsonRpc::FromString(const std::string& str, template <typename FunctionId> int32_t FormatterJsonRpc::ParseFunctionId(const Json::Value& method_value, - NsSmartObjects::SmartObject& out) { + ns_smart_objects::SmartObject& out) { int32_t result = kSuccess; if (false == method_value.isString()) { @@ -477,11 +477,11 @@ int32_t FormatterJsonRpc::ParseFunctionId(const Json::Value& method_value, } else { FunctionId function_id; - if (!NsSmartObjects::EnumConversionHelper<FunctionId>::CStringToEnum( + if (!ns_smart_objects::EnumConversionHelper<FunctionId>::CStringToEnum( method_value.asCString(), &function_id)) { result |= kUnknownMethod; } else { - namespace strings = NsSmartDeviceLink::NsJSONHandler::strings; + namespace strings = ns_smart_device_link::ns_json_handler::strings; out[strings::S_PARAMS][strings::S_FUNCTION_ID] = function_id; } @@ -490,8 +490,8 @@ int32_t FormatterJsonRpc::ParseFunctionId(const Json::Value& method_value, return result; } -} // namespace Formatters -} // namespace NsJSONHandler -} // namespace NsSmartDeviceLink +} // namespace formatters +} // namespace ns_json_handler +} // namespace ns_smart_device_link #endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_FORMATTER_JSON_RPC_H_ diff --git a/src/components/formatters/include/formatters/generic_json_formatter.h b/src/components/formatters/include/formatters/generic_json_formatter.h index 2b5d95fd4a..c9b9431ee5 100644 --- a/src/components/formatters/include/formatters/generic_json_formatter.h +++ b/src/components/formatters/include/formatters/generic_json_formatter.h @@ -37,9 +37,9 @@ #include "CFormatterJsonBase.h" -namespace NsSmartDeviceLink { -namespace NsJSONHandler { -namespace Formatters { +namespace ns_smart_device_link { +namespace ns_json_handler { +namespace formatters { class GenericJsonFormatter : public CFormatterJsonBase { public: @@ -49,7 +49,7 @@ class GenericJsonFormatter : public CFormatterJsonBase { * @param obj Input SmartObject. * @param out_str Resulting JSON string. */ - static void ToString(const NsSmartObjects::SmartObject& obj, + static void ToString(const ns_smart_objects::SmartObject& obj, std::string& out_str); /** @@ -61,11 +61,11 @@ class GenericJsonFormatter : public CFormatterJsonBase { * @return true if success, false otherwise. */ static bool FromString(const std::string& str, - NsSmartObjects::SmartObject& out); + ns_smart_objects::SmartObject& out); }; -} // namespace Formatters -} // namespace NsJSONHandler -} // namespace NsSmartDeviceLink +} // namespace formatters +} // namespace ns_json_handler +} // namespace ns_smart_device_link #endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_GENERIC_JSON_FORMATTER_H_ diff --git a/src/components/formatters/include/formatters/meta_formatter.h b/src/components/formatters/include/formatters/meta_formatter.h index 20abb3b848..36e39301f6 100644 --- a/src/components/formatters/include/formatters/meta_formatter.h +++ b/src/components/formatters/include/formatters/meta_formatter.h @@ -39,9 +39,9 @@ #include "smart_objects/smart_object.h" #include "smart_objects/smart_schema.h" -namespace NsSmartDeviceLink { -namespace NsJSONHandler { -namespace Formatters { +namespace ns_smart_device_link { +namespace ns_json_handler { +namespace formatters { /** * @brief Formats to string the smart object against given schema for given @@ -66,13 +66,13 @@ class CMetaFormatter { * @return true if successful, false - otherwise */ static bool CreateObjectByPattern( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& object, - const NsSmartDeviceLink::NsSmartObjects::CSmartSchema& schema, - NsSmartDeviceLink::NsSmartObjects::SmartObject& result_object); + const ns_smart_device_link::ns_smart_objects::SmartObject& object, + const ns_smart_device_link::ns_smart_objects::CSmartSchema& schema, + ns_smart_device_link::ns_smart_objects::SmartObject& result_object); }; -} // namespace NsSmartDeviceLink -} // namespace NsSmartDeviceLink::NsJSONHandler -} // namespace NsSmartDeviceLink::NsJSONHandler::Formatters +} // namespace ns_smart_device_link +} // namespace ns_smart_device_link::ns_json_handler +} // namespace ns_smart_device_link::ns_json_handler::formatters #endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_META_FORMATTER_H_ diff --git a/src/components/formatters/src/CFormatterJsonBase.cc b/src/components/formatters/src/CFormatterJsonBase.cc index 0a85a93d21..af8668543a 100644 --- a/src/components/formatters/src/CFormatterJsonBase.cc +++ b/src/components/formatters/src/CFormatterJsonBase.cc @@ -35,13 +35,13 @@ #include "formatters/CFormatterJsonBase.h" #include "utils/convert_utils.h" -void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase:: +void ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase:: jsonValueToObj(const Json::Value& value, - NsSmartDeviceLink::NsSmartObjects::SmartObject& obj) { + ns_smart_device_link::ns_smart_objects::SmartObject& obj) { try { if (value.type() == Json::objectValue) { - obj = NsSmartDeviceLink::NsSmartObjects::SmartObject( - NsSmartDeviceLink::NsSmartObjects::SmartType_Map); + obj = ns_smart_device_link::ns_smart_objects::SmartObject( + ns_smart_device_link::ns_smart_objects::SmartType_Map); Json::Value::Members members = value.getMemberNames(); @@ -49,8 +49,8 @@ void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase:: jsonValueToObj(value[members[i]], obj[members[i]]); } } else if (value.type() == Json::arrayValue) { - obj = NsSmartDeviceLink::NsSmartObjects::SmartObject( - NsSmartDeviceLink::NsSmartObjects::SmartType_Array); + obj = ns_smart_device_link::ns_smart_objects::SmartObject( + ns_smart_device_link::ns_smart_objects::SmartType_Array); for (uint32_t i = 0; i < value.size(); i++) { jsonValueToObj(value[i], obj[i]); @@ -72,11 +72,13 @@ void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase:: // ---------------------------------------------------------------------------- -void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase:: - objToJsonValue(const NsSmartDeviceLink::NsSmartObjects::SmartObject& obj, - Json::Value& item) { +void ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase:: + objToJsonValue( + const ns_smart_device_link::ns_smart_objects::SmartObject& obj, + Json::Value& item) { try { - if (NsSmartDeviceLink::NsSmartObjects::SmartType_Array == obj.getType()) { + if (ns_smart_device_link::ns_smart_objects::SmartType_Array == + obj.getType()) { item = Json::arrayValue; for (uint32_t i = 0; i < obj.length(); i++) { @@ -86,7 +88,7 @@ void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase:: item.append(value); } - } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Map == + } else if (ns_smart_device_link::ns_smart_objects::SmartType_Map == obj.getType()) { item = Json::objectValue; std::set<std::string> keys = obj.enumerate(); @@ -100,19 +102,19 @@ void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase:: item[*key] = value; } - } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Boolean == + } else if (ns_smart_device_link::ns_smart_objects::SmartType_Boolean == obj.getType()) { item = obj.asBool(); - } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Integer == + } else if (ns_smart_device_link::ns_smart_objects::SmartType_Integer == obj.getType()) { item = utils::ConvertInt64ToLongLongInt(obj.asInt()); - } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_UInteger == + } else if (ns_smart_device_link::ns_smart_objects::SmartType_UInteger == obj.getType()) { item = utils::ConvertUInt64ToLongLongUInt(obj.asUInt()); - } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Double == + } else if (ns_smart_device_link::ns_smart_objects::SmartType_Double == obj.getType()) { item = obj.asDouble(); - } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Null == + } else if (ns_smart_device_link::ns_smart_objects::SmartType_Null == obj.getType()) { item = Json::nullValue; } else { diff --git a/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc b/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc index b776b9abd8..121fd43131 100644 --- a/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc +++ b/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc @@ -34,12 +34,12 @@ #include "formatters/meta_formatter.h" #include "utils/convert_utils.h" -namespace strings = NsSmartDeviceLink::NsJSONHandler::strings; -namespace smart_objects_ns = NsSmartDeviceLink::NsSmartObjects; +namespace strings = ns_smart_device_link::ns_json_handler::strings; +namespace smart_objects_ns = ns_smart_device_link::ns_smart_objects; -namespace NsSmartDeviceLink { -namespace NsJSONHandler { -namespace Formatters { +namespace ns_smart_device_link { +namespace ns_json_handler { +namespace formatters { // ---------------------------------------------------------------------------- diff --git a/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc b/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc index 9e177ea4a8..ffbb644cc6 100644 --- a/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc +++ b/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc @@ -31,12 +31,12 @@ #include "formatters/CFormatterJsonSDLRPCv2.h" #include "formatters/meta_formatter.h" -namespace smart_objects_ns = NsSmartDeviceLink::NsSmartObjects; -namespace strings = NsSmartDeviceLink::NsJSONHandler::strings; +namespace smart_objects_ns = ns_smart_device_link::ns_smart_objects; +namespace strings = ns_smart_device_link::ns_json_handler::strings; -namespace NsSmartDeviceLink { -namespace NsJSONHandler { -namespace Formatters { +namespace ns_smart_device_link { +namespace ns_json_handler { +namespace formatters { // ---------------------------------------------------------------------------- diff --git a/src/components/formatters/src/CSmartFactory.cc b/src/components/formatters/src/CSmartFactory.cc index 6b0808fbfa..c1ee9133ca 100644 --- a/src/components/formatters/src/CSmartFactory.cc +++ b/src/components/formatters/src/CSmartFactory.cc @@ -34,19 +34,27 @@ #include "formatters/CSmartFactory.h" -const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_MSG_PARAMS( +const std::string ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS( "msg_params"); -const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS("params"); -const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_FUNCTION_ID( +const std::string ns_smart_device_link::ns_json_handler::strings::S_PARAMS( + "params"); +const std::string ns_smart_device_link::ns_json_handler::strings::S_FUNCTION_ID( "function_id"); -const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_MESSAGE_TYPE( - "message_type"); -const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_VERSION( - "protocol_version"); -const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_TYPE( - "protocol_type"); -const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_CORRELATION_ID( - "correlation_id"); -const std::string NsSmartDeviceLink::NsJSONHandler::strings::kCode("code"); -const std::string NsSmartDeviceLink::NsJSONHandler::strings::kMessage( +const std::string + ns_smart_device_link::ns_json_handler::strings::S_MESSAGE_TYPE( + "message_type"); +const std::string + ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_VERSION( + "protocol_version"); +const std::string + ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_TYPE( + "protocol_type"); +const std::string + ns_smart_device_link::ns_json_handler::strings::S_CORRELATION_ID( + "correlation_id"); +const std::string + ns_smart_device_link::ns_json_handler::strings::S_RPC_MSG_VERSION( + "rpc_msg_version"); +const std::string ns_smart_device_link::ns_json_handler::strings::kCode("code"); +const std::string ns_smart_device_link::ns_json_handler::strings::kMessage( "message"); diff --git a/src/components/formatters/src/formatter_json_rpc.cc b/src/components/formatters/src/formatter_json_rpc.cc index e349ced4d6..d50d04d0e9 100644 --- a/src/components/formatters/src/formatter_json_rpc.cc +++ b/src/components/formatters/src/formatter_json_rpc.cc @@ -35,11 +35,11 @@ #include "formatters/formatter_json_rpc.h" #include "utils/convert_utils.h" -namespace NsSmartDeviceLink { -namespace NsJSONHandler { -namespace Formatters { +namespace ns_smart_device_link { +namespace ns_json_handler { +namespace formatters { -namespace strings = NsJSONHandler::strings; +namespace strings = ns_json_handler::strings; const char* FormatterJsonRpc::kRequest = "request"; const char* FormatterJsonRpc::kResponse = "response"; @@ -56,7 +56,7 @@ const char* FormatterJsonRpc::kCode = "code"; const char* FormatterJsonRpc::kData = "data"; const char* FormatterJsonRpc::kMessage = "message"; -bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject& obj, +bool FormatterJsonRpc::ToString(const ns_smart_objects::SmartObject& obj, std::string& out_str) { bool result = true; try { @@ -64,17 +64,17 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject& obj, root[kJsonRpc] = kJsonRpcExpectedValue; - NsSmartObjects::SmartObject formatted_object(obj); + ns_smart_objects::SmartObject formatted_object(obj); Json::Value msg_params_json(Json::objectValue); formatted_object.getSchema().unapplySchema(formatted_object); bool is_message_params = formatted_object.keyExists(strings::S_MSG_PARAMS); bool empty_message_params = true; if (true == is_message_params) { - const NsSmartObjects::SmartObject& msg_params = + const ns_smart_objects::SmartObject& msg_params = formatted_object.getElement(strings::S_MSG_PARAMS); - result = (NsSmartObjects::SmartType_Map == msg_params.getType()); + result = (ns_smart_objects::SmartType_Map == msg_params.getType()); if (true == result) { objToJsonValue(msg_params, msg_params_json); } @@ -86,15 +86,16 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject& obj, if (false == formatted_object.keyExists(strings::S_PARAMS)) { result = false; } else { - const NsSmartObjects::SmartObject& params = + const ns_smart_objects::SmartObject& params = formatted_object.getElement(strings::S_PARAMS); - if (NsSmartObjects::SmartType_Map != params.getType()) { + if (ns_smart_objects::SmartType_Map != params.getType()) { result = false; } else { - const NsSmartObjects::SmartObject& message_type_object = + const ns_smart_objects::SmartObject& message_type_object = params.getElement(strings::S_MESSAGE_TYPE); - if (NsSmartObjects::SmartType_String != message_type_object.getType()) { + if (ns_smart_objects::SmartType_String != + message_type_object.getType()) { result = false; } else { const std::string message_type = message_type_object.asString(); @@ -113,10 +114,10 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject& obj, if (false == params.keyExists(strings::kCode)) { result = false; } else { - const NsSmartObjects::SmartObject& code = + const ns_smart_objects::SmartObject& code = params.getElement(strings::kCode); - if (NsSmartObjects::SmartType_Integer != code.getType()) { + if (ns_smart_objects::SmartType_Integer != code.getType()) { result = false; } else { root[kResult][kCode] = @@ -131,9 +132,9 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject& obj, result = result && SetMethod(params, root[kError][kData]); result = result && SetMessage(params, root[kError]); - const NsSmartObjects::SmartObject& code = + const ns_smart_objects::SmartObject& code = params.getElement(strings::kCode); - if (NsSmartObjects::SmartType_Integer != code.getType()) { + if (ns_smart_objects::SmartType_Integer != code.getType()) { result = false; } else { root[kError][kCode] = @@ -151,15 +152,15 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject& obj, return result; } -bool FormatterJsonRpc::SetMethod(const NsSmartObjects::SmartObject& params, +bool FormatterJsonRpc::SetMethod(const ns_smart_objects::SmartObject& params, Json::Value& method_container) { bool result = false; if (true == params.keyExists(strings::S_FUNCTION_ID)) { - const NsSmartObjects::SmartObject& function_id = + const ns_smart_objects::SmartObject& function_id = params.getElement(strings::S_FUNCTION_ID); - if (NsSmartObjects::SmartType_String == function_id.getType()) { + if (ns_smart_objects::SmartType_String == function_id.getType()) { method_container[kMethod] = function_id.asString(); result = true; } @@ -168,15 +169,15 @@ bool FormatterJsonRpc::SetMethod(const NsSmartObjects::SmartObject& params, return result; } -bool FormatterJsonRpc::SetId(const NsSmartObjects::SmartObject& params, +bool FormatterJsonRpc::SetId(const ns_smart_objects::SmartObject& params, Json::Value& id_container) { bool result = false; if (true == params.keyExists(strings::S_CORRELATION_ID)) { - const NsSmartObjects::SmartObject& id = + const ns_smart_objects::SmartObject& id = params.getElement(strings::S_CORRELATION_ID); - if (NsSmartObjects::SmartType_Integer == id.getType()) { + if (ns_smart_objects::SmartType_Integer == id.getType()) { id_container[kId] = utils::ConvertUInt64ToLongLongUInt(id.asUInt()); result = true; } @@ -185,15 +186,15 @@ bool FormatterJsonRpc::SetId(const NsSmartObjects::SmartObject& params, return result; } -bool FormatterJsonRpc::SetMessage(const NsSmartObjects::SmartObject& params, +bool FormatterJsonRpc::SetMessage(const ns_smart_objects::SmartObject& params, Json::Value& message_container) { bool result = false; if (true == params.keyExists(strings::kMessage)) { - const NsSmartObjects::SmartObject& message = + const ns_smart_objects::SmartObject& message = params.getElement(strings::kMessage); - if (NsSmartObjects::SmartType_String == message.getType()) { + if (ns_smart_objects::SmartType_String == message.getType()) { message_container[kMessage] = message.asString(); result = true; } @@ -202,6 +203,6 @@ bool FormatterJsonRpc::SetMessage(const NsSmartObjects::SmartObject& params, return result; } -} // namespace Formatters -} // namespace NsJSONHandler -} // namespace NsSmartDeviceLink +} // namespace formatters +} // namespace ns_json_handler +} // namespace ns_smart_device_link diff --git a/src/components/formatters/src/generic_json_formatter.cc b/src/components/formatters/src/generic_json_formatter.cc index 7789a915c2..07b03484d2 100644 --- a/src/components/formatters/src/generic_json_formatter.cc +++ b/src/components/formatters/src/generic_json_formatter.cc @@ -34,11 +34,11 @@ #include "formatters/generic_json_formatter.h" -namespace NsSmartDeviceLink { -namespace NsJSONHandler { -namespace Formatters { +namespace ns_smart_device_link { +namespace ns_json_handler { +namespace formatters { -void GenericJsonFormatter::ToString(const NsSmartObjects::SmartObject& obj, +void GenericJsonFormatter::ToString(const ns_smart_objects::SmartObject& obj, std::string& out_str) { Json::Value json_root; objToJsonValue(obj, json_root); @@ -46,7 +46,7 @@ void GenericJsonFormatter::ToString(const NsSmartObjects::SmartObject& obj, } bool GenericJsonFormatter::FromString(const std::string& str, - NsSmartObjects::SmartObject& out) { + ns_smart_objects::SmartObject& out) { Json::Value json_root; Json::Reader reader; bool result = reader.parse(str, json_root); @@ -58,6 +58,6 @@ bool GenericJsonFormatter::FromString(const std::string& str, return result; } -} // namespace Formatters -} // namespace NsJSONHandler -} // namespace NsSmartDeviceLink +} // namespace formatters +} // namespace ns_json_handler +} // namespace ns_smart_device_link diff --git a/src/components/formatters/src/meta_formatter.cc b/src/components/formatters/src/meta_formatter.cc index fafb84e938..82dd611498 100644 --- a/src/components/formatters/src/meta_formatter.cc +++ b/src/components/formatters/src/meta_formatter.cc @@ -38,15 +38,15 @@ #include "formatters/meta_formatter.h" -namespace formatter_ns = NsSmartDeviceLink::NsJSONHandler::Formatters; -namespace smart_objects_ns = NsSmartDeviceLink::NsSmartObjects; +namespace formatter_ns = ns_smart_device_link::ns_json_handler::formatters; +namespace smart_objects_ns = ns_smart_device_link::ns_smart_objects; //--------------------------------------------------------------- bool formatter_ns::CMetaFormatter::CreateObjectByPattern( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& object, - const NsSmartDeviceLink::NsSmartObjects::CSmartSchema& schema, - NsSmartDeviceLink::NsSmartObjects::SmartObject& result_object) { + const ns_smart_device_link::ns_smart_objects::SmartObject& object, + const ns_smart_device_link::ns_smart_objects::CSmartSchema& schema, + ns_smart_device_link::ns_smart_objects::SmartObject& result_object) { if (smart_objects_ns::SmartType_Invalid == result_object.getType()) { return false; } diff --git a/src/components/formatters/test/CFormatterJsonBase_test.cc b/src/components/formatters/test/CFormatterJsonBase_test.cc index ff1f60b8df..1cd9c55bbc 100644 --- a/src/components/formatters/test/CFormatterJsonBase_test.cc +++ b/src/components/formatters/test/CFormatterJsonBase_test.cc @@ -42,8 +42,8 @@ namespace test { namespace components { namespace formatters { -using namespace NsSmartDeviceLink::NsSmartObjects; -using namespace NsSmartDeviceLink::NsJSONHandler::Formatters; +using namespace ns_smart_device_link::ns_smart_objects; +using namespace ns_smart_device_link::ns_json_handler::formatters; TEST(CFormatterJsonBaseTest, JSonStringValueToSmartObj_ExpectSuccessful) { // Arrange value diff --git a/src/components/formatters/test/CSmartFactory_test.cc b/src/components/formatters/test/CSmartFactory_test.cc index 3713d076e2..3aba109e58 100644 --- a/src/components/formatters/test/CSmartFactory_test.cc +++ b/src/components/formatters/test/CSmartFactory_test.cc @@ -68,7 +68,7 @@ TEST(CSmartFactoryTest, std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(errors::eType::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -82,7 +82,7 @@ TEST(CSmartFactoryTest, EXPECT_FALSE(SmartType::SmartType_Map == obj.getType()); EXPECT_TRUE(SmartType::SmartType_Null == obj.getType()); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(errors::eType::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -104,7 +104,7 @@ TEST( std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); + EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -127,7 +127,7 @@ TEST( std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OUT_OF_RANGE, obj.validate(&report)); + EXPECT_EQ(errors::eType::OUT_OF_RANGE, obj.validate(&report)); EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -150,7 +150,7 @@ TEST( std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::INVALID_VALUE, obj.validate(&report)); + EXPECT_EQ(errors::eType::INVALID_VALUE, obj.validate(&report)); EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -174,7 +174,7 @@ TEST(CSmartFactoryTest, std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(errors::eType::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -198,7 +198,7 @@ TEST( std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); + EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -236,7 +236,7 @@ TEST( std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::INVALID_VALUE, obj.validate(&report)); + EXPECT_EQ(errors::eType::INVALID_VALUE, obj.validate(&report)); EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -253,7 +253,7 @@ TEST(CSmartFactoryTest, std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(errors::eType::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -270,7 +270,7 @@ TEST( std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(1u, keys.size()); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); + EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -287,7 +287,7 @@ TEST(CSmartFactoryTest, std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(errors::eType::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -304,12 +304,12 @@ TEST(CSmartFactoryTest, obj["image"]["text"] = "test2"; obj["image"]["position"] = 100; rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj["image"].validate(&report)); + EXPECT_EQ(errors::eType::OK, obj["image"].validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(3u, keys.size()); report = rpc::ValidationReport("RPC"); - EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(errors::eType::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -328,13 +328,13 @@ TEST( obj["image"]["position"] = 100; // Check object "image" rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj["image"].validate(&report)); + EXPECT_EQ(errors::eType::OK, obj["image"].validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(3u, keys.size()); // Check global object report = rpc::ValidationReport("RPC"); - EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(errors::eType::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -352,13 +352,13 @@ TEST( obj["image"]["position"] = 100; // Check object "image" rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj["image"].validate(&report)); + EXPECT_EQ(errors::eType::OK, obj["image"].validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); // Check global object report = rpc::ValidationReport("RPC"); - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); + EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -377,13 +377,13 @@ TEST( obj["image"]["position"] = 100; // Check object "image" rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj["image"].validate(&report)); + EXPECT_EQ(errors::eType::OK, obj["image"].validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(3u, keys.size()); // Check global object report = rpc::ValidationReport("RPC"); - EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(errors::eType::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -402,7 +402,7 @@ TEST( EXPECT_EQ(2u, keys.size()); // Check global object rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); + EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -422,7 +422,7 @@ TEST( EXPECT_EQ(3u, keys.size()); // Check global object rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::INVALID_VALUE, obj.validate(&report)); + EXPECT_EQ(errors::eType::INVALID_VALUE, obj.validate(&report)); EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } diff --git a/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc b/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc index a4d40b4478..fe9d2ec0e1 100644 --- a/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc +++ b/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc @@ -43,7 +43,7 @@ TEST(CFormatterJsonSDLRPCv1Test, EmptySmartObjectToString) { SmartObject srcObj; rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, srcObj.validate(&report)); + EXPECT_EQ(errors::eType::OK, srcObj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::string jsonString; @@ -74,7 +74,7 @@ TEST(CFormatterJsonSDLRPCv1Test, SmObjWithRequestWithoutMsgNotValid_ToString) { srcObj[S_PARAMS][S_PROTOCOL_VERSION] = 1; rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, + EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, srcObj.validate(&report)); EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); @@ -108,7 +108,7 @@ TEST(CFormatterJsonSDLRPCv1Test, srcObj[S_MSG_PARAMS][""] = ""; rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, srcObj.validate(&report)); + EXPECT_EQ(errors::eType::OK, srcObj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::string jsonString; @@ -341,7 +341,7 @@ TEST(CFormatterJsonSDLRPCv1Test, StringRequestToSmObj) { EXPECT_EQ(CFormatterJsonSDLRPCv1::kSuccess, result); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(errors::eType::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::request); EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::RegisterAppInterface); @@ -487,7 +487,7 @@ TEST(CFormatterJsonSDLRPCv1Test, StringNotificationToSmartObject) { inputJsonString, obj); EXPECT_EQ(CFormatterJsonSDLRPCv1::kSuccess, result); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(errors::eType::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::notification); EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::SetGlobalProperties); diff --git a/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc b/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc index c7e6f61674..628e9956bb 100644 --- a/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc +++ b/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc @@ -42,7 +42,7 @@ TEST(CFormatterJsonSDLRPCv2Test, EmptySmartObjectToString) { SmartObject srcObj; rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, srcObj.validate(&report)); + EXPECT_EQ(errors::eType::OK, srcObj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::string jsonString; @@ -67,7 +67,7 @@ TEST(CFormatterJsonSDLRPCv2Test, SmObjWithRequestWithoutMsgNotValid_ToString) { srcObj[S_PARAMS][S_PROTOCOL_VERSION] = 2; rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, + EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, srcObj.validate(&report)); EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); @@ -94,7 +94,7 @@ TEST(CFormatterJsonSDLRPCv2Test, srcObj[S_MSG_PARAMS][""] = ""; rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, srcObj.validate(&report)); + EXPECT_EQ(errors::eType::OK, srcObj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::string jsonString; @@ -270,7 +270,7 @@ TEST(CFormatterJsonSDLRPCv2Test, StringRequestWithoutCorIdToSmObj) { EXPECT_EQ(true, result); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); + EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::request); EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::RegisterAppInterface); @@ -317,7 +317,7 @@ TEST(CFormatterJsonSDLRPCv2Test, StringRequestWithCorIdToSmObj) { EXPECT_EQ(true, result); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(errors::eType::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::request); EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::RegisterAppInterface); @@ -384,7 +384,7 @@ TEST(CFormatterJsonSDLRPCv2Test, StringNotificationToSmartObject) { corId); EXPECT_EQ(true, result); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(errors::eType::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::notification); EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::SetGlobalProperties); diff --git a/src/components/formatters/test/formatter_json_rpc_test.cc b/src/components/formatters/test/formatter_json_rpc_test.cc index e882bed618..f397accbd4 100644 --- a/src/components/formatters/test/formatter_json_rpc_test.cc +++ b/src/components/formatters/test/formatter_json_rpc_test.cc @@ -49,9 +49,9 @@ namespace test { namespace components { namespace formatters_test { -using namespace NsSmartDeviceLink::NsSmartObjects; -using namespace NsSmartDeviceLink::NsJSONHandler::Formatters; -using namespace NsSmartDeviceLink::NsJSONHandler::strings; +using namespace ns_smart_device_link::ns_smart_objects; +using namespace ns_smart_device_link::ns_json_handler::formatters; +using namespace ns_smart_device_link::ns_json_handler::strings; void CompactJson(std::string& str) { Json::Value root; @@ -150,7 +150,7 @@ TEST(FormatterJsonRPCTest, UpperBoundValuesInSystemRequest_ToString_Success) { hmi_apis::HMI_API factory; EXPECT_TRUE(factory.attachSchema(obj, false)); rpc::ValidationReport report("RPC"); - EXPECT_EQ(Errors::OK, obj.validate(&report)); + EXPECT_EQ(errors::OK, obj.validate(&report)); EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::string result; // Convert SmartObject to Json string diff --git a/src/components/formatters/test/generic_json_formatter_test.cc b/src/components/formatters/test/generic_json_formatter_test.cc index 41ecfd9ee3..97840eb110 100644 --- a/src/components/formatters/test/generic_json_formatter_test.cc +++ b/src/components/formatters/test/generic_json_formatter_test.cc @@ -38,8 +38,8 @@ namespace components { namespace formatters { TEST(GenericJsonFormatter, ToString) { - namespace smartobj = NsSmartDeviceLink::NsSmartObjects; - namespace formatters = NsSmartDeviceLink::NsJSONHandler::Formatters; + namespace smartobj = ns_smart_device_link::ns_smart_objects; + namespace formatters = ns_smart_device_link::ns_json_handler::formatters; smartobj::SmartObject obj; std::string result; @@ -93,8 +93,8 @@ TEST(GenericJsonFormatter, ToString) { } TEST(GenericJsonFormatter, FromString) { - namespace smartobj = NsSmartDeviceLink::NsSmartObjects; - namespace formatters = NsSmartDeviceLink::NsJSONHandler::Formatters; + namespace smartobj = ns_smart_device_link::ns_smart_objects; + namespace formatters = ns_smart_device_link::ns_json_handler::formatters; smartobj::SmartObject result; diff --git a/src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h b/src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h index 8f5ee96ce5..4b1ca94b98 100644 --- a/src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h +++ b/src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h @@ -52,9 +52,9 @@ namespace test { namespace components { namespace formatters { -using namespace NsSmartDeviceLink::NsSmartObjects; -using namespace NsSmartDeviceLink::NsJSONHandler; -using namespace NsSmartDeviceLink::NsJSONHandler::strings; +using namespace ns_smart_device_link::ns_smart_objects; +using namespace ns_smart_device_link::ns_json_handler; +using namespace ns_smart_device_link::ns_json_handler::strings; using namespace hmi_apis; namespace TestType { @@ -107,9 +107,9 @@ class CSmartFactoryTest : public CSmartFactory<FunctionIdTest::eType, protected: typedef std::map<const StructIdentifiersTest::eType, - utils::SharedPtr<ISchemaItem> > TStructsSchemaItems; + std::shared_ptr<ISchemaItem> > TStructsSchemaItems; - static utils::SharedPtr<ISchemaItem> ProvideObjectSchemaItemForStruct( + static std::shared_ptr<ISchemaItem> ProvideObjectSchemaItemForStruct( TStructsSchemaItems& struct_schema_items, const StructIdentifiersTest::eType struct_id); @@ -147,10 +147,10 @@ class CSmartFactoryTest : public CSmartFactory<FunctionIdTest::eType, const std::set<FunctionIdTest::eType>& function_id_items, const std::set<MessageTypeTest::eType>& message_type_items); - static utils::SharedPtr<ISchemaItem> InitStructSchemaItem_Common_1( + static std::shared_ptr<ISchemaItem> InitStructSchemaItem_Common_1( TStructsSchemaItems& struct_schema_items); - static utils::SharedPtr<ISchemaItem> InitStructSchemaItem_Common_2(); + static std::shared_ptr<ISchemaItem> InitStructSchemaItem_Common_2(); }; } // namespace formatters diff --git a/src/components/formatters/test/include/formatters/create_smartSchema.h b/src/components/formatters/test/include/formatters/create_smartSchema.h index 4d7a217317..73ff9ba77b 100644 --- a/src/components/formatters/test/include/formatters/create_smartSchema.h +++ b/src/components/formatters/test/include/formatters/create_smartSchema.h @@ -40,9 +40,9 @@ namespace test { namespace components { namespace formatters { -using namespace NsSmartDeviceLink::NsJSONHandler::strings; -using namespace NsSmartDeviceLink::NsJSONHandler::Formatters; -using namespace NsSmartDeviceLink::NsSmartObjects; +using namespace ns_smart_device_link::ns_json_handler::strings; +using namespace ns_smart_device_link::ns_json_handler::formatters; +using namespace ns_smart_device_link::ns_smart_objects; namespace FunctionIDTest { enum eType { diff --git a/src/components/formatters/test/include/formatters/meta_formatter_test_helper.h b/src/components/formatters/test/include/formatters/meta_formatter_test_helper.h index a58f69e386..0ee21d092c 100644 --- a/src/components/formatters/test/include/formatters/meta_formatter_test_helper.h +++ b/src/components/formatters/test/include/formatters/meta_formatter_test_helper.h @@ -51,24 +51,24 @@ class CMetaFormatterTestHelper : public ::testing::Test { virtual void TearDown(); void AnyObjectToJsonString( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& obj, + const ns_smart_device_link::ns_smart_objects::SmartObject& obj, std::string& result_string); void FillObjectIdenticalToSchema( - NsSmartDeviceLink::NsSmartObjects::SmartObject& obj); + ns_smart_device_link::ns_smart_objects::SmartObject& obj); void FillObjectIdenticalToSchemaWithoutNoMandatoriesParams( - NsSmartDeviceLink::NsSmartObjects::SmartObject& obj); + ns_smart_device_link::ns_smart_objects::SmartObject& obj); void CompareObjects( - const NsSmartDeviceLink::NsSmartObjects::SmartObject& first, - const NsSmartDeviceLink::NsSmartObjects::SmartObject& second); + const ns_smart_device_link::ns_smart_objects::SmartObject& first, + const ns_smart_device_link::ns_smart_objects::SmartObject& second); void FillObjectWithDefaultValues( - NsSmartDeviceLink::NsSmartObjects::SmartObject& obj); + ns_smart_device_link::ns_smart_objects::SmartObject& obj); void FillObjectWithoutSomeMandatoryFields( - NsSmartDeviceLink::NsSmartObjects::SmartObject& obj); + ns_smart_device_link::ns_smart_objects::SmartObject& obj); // Members std::set<FunctionIDTest::eType> function_id_items_; diff --git a/src/components/formatters/test/src/SmartFactoryTestHelper.cc b/src/components/formatters/test/src/SmartFactoryTestHelper.cc index 2dd76f85f8..d48f9f58a0 100644 --- a/src/components/formatters/test/src/SmartFactoryTestHelper.cc +++ b/src/components/formatters/test/src/SmartFactoryTestHelper.cc @@ -148,7 +148,7 @@ CSmartFactoryTest::CSmartFactoryTest() void CSmartFactoryTest::InitStructSchemes( TStructsSchemaItems& struct_schema_items) { - utils::SharedPtr<ISchemaItem> struct_schema_item_Common_1 = + std::shared_ptr<ISchemaItem> struct_schema_item_Common_1 = InitStructSchemaItem_Common_1(struct_schema_items); struct_schema_items.insert(std::make_pair(StructIdentifiersTest::Common_1, struct_schema_item_Common_1)); @@ -156,7 +156,7 @@ void CSmartFactoryTest::InitStructSchemes( std::make_pair(StructIdentifiersTest::Common_1, CSmartSchema(struct_schema_item_Common_1))); - utils::SharedPtr<ISchemaItem> struct_schema_item_Common_2 = + std::shared_ptr<ISchemaItem> struct_schema_item_Common_2 = InitStructSchemaItem_Common_2(); struct_schema_items.insert(std::make_pair(StructIdentifiersTest::Common_2, struct_schema_item_Common_2)); @@ -187,7 +187,7 @@ void CSmartFactoryTest::InitFunctionSchemes( CObjectSchemaItem::SMember(CStringSchemaItem::create(), true); CObjectSchemaItem::Members root_members_map; - root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS] = + root_members_map[ns_smart_device_link::ns_json_handler::strings::S_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(params_members), true); @@ -269,7 +269,7 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function1_response( const std::set<FunctionIdTest::eType>& function_id_items, const std::set<MessageTypeTest::eType>& message_type_items) { // Function parameter available. - utils::SharedPtr<ISchemaItem> available_SchemaItem = + std::shared_ptr<ISchemaItem> available_SchemaItem = CBoolSchemaItem::create(TSchemaItemParameter<bool>()); CObjectSchemaItem::Members schema_members; @@ -333,7 +333,7 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function2_response( const std::set<FunctionIdTest::eType>& function_id_items, const std::set<MessageTypeTest::eType>& message_type_items) { // Function parameter available. - utils::SharedPtr<ISchemaItem> available_SchemaItem = + std::shared_ptr<ISchemaItem> available_SchemaItem = CBoolSchemaItem::create(TSchemaItemParameter<bool>()); CObjectSchemaItem::Members schema_members; @@ -399,7 +399,7 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function3_response( // Function parameter available. // // Must be true if VR is present and ready to communicate with SDL. - utils::SharedPtr<ISchemaItem> available_SchemaItem = + std::shared_ptr<ISchemaItem> available_SchemaItem = CBoolSchemaItem::create(TSchemaItemParameter<bool>()); CObjectSchemaItem::Members schema_members; @@ -431,12 +431,12 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function3_response( return CSmartSchema(CObjectSchemaItem::create(root_members_map)); } -utils::SharedPtr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_1( +std::shared_ptr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_1( TStructsSchemaItems& struct_schema_items) { // Struct member text. // // Text to display - utils::SharedPtr<ISchemaItem> text_SchemaItem = + std::shared_ptr<ISchemaItem> text_SchemaItem = CStringSchemaItem::create(TSchemaItemParameter<size_t>(1), TSchemaItemParameter<size_t>(500), TSchemaItemParameter<std::string>()); @@ -444,14 +444,14 @@ utils::SharedPtr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_1( // Struct member image. // // Image struct - utils::SharedPtr<ISchemaItem> image_SchemaItem = + std::shared_ptr<ISchemaItem> image_SchemaItem = ProvideObjectSchemaItemForStruct(struct_schema_items, StructIdentifiersTest::Common_2); // Struct member position. // // Position to display item - utils::SharedPtr<ISchemaItem> position_SchemaItem = + std::shared_ptr<ISchemaItem> position_SchemaItem = TNumberSchemaItem<int32_t>::create(TSchemaItemParameter<int32_t>(1), TSchemaItemParameter<int32_t>(500), TSchemaItemParameter<int32_t>()); @@ -472,19 +472,19 @@ utils::SharedPtr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_1( return CObjectSchemaItem::create(schema_members); } -utils::SharedPtr<ISchemaItem> +std::shared_ptr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_2() { // Struct member text. // // Text to display - utils::SharedPtr<ISchemaItem> text_SchemaItem = + std::shared_ptr<ISchemaItem> text_SchemaItem = CStringSchemaItem::create(TSchemaItemParameter<size_t>(1), TSchemaItemParameter<size_t>(500), TSchemaItemParameter<std::string>()); // Struct member position. // // Position to display item - utils::SharedPtr<ISchemaItem> position_SchemaItem = + std::shared_ptr<ISchemaItem> position_SchemaItem = TNumberSchemaItem<int32_t>::create(TSchemaItemParameter<int32_t>(1), TSchemaItemParameter<int32_t>(500), TSchemaItemParameter<int32_t>()); @@ -497,7 +497,7 @@ CSmartFactoryTest::InitStructSchemaItem_Common_2() { return CObjectSchemaItem::create(schema_members); } -utils::SharedPtr<ISchemaItem> +std::shared_ptr<ISchemaItem> CSmartFactoryTest::ProvideObjectSchemaItemForStruct( TStructsSchemaItems& struct_schema_items, const StructIdentifiersTest::eType struct_id) { @@ -506,5 +506,6 @@ CSmartFactoryTest::ProvideObjectSchemaItemForStruct( if (it != struct_schema_items.end()) { return it->second; } - return NsSmartDeviceLink::NsSmartObjects::CAlwaysFalseSchemaItem::create(); + return ns_smart_device_link::ns_smart_objects::CAlwaysFalseSchemaItem:: + create(); } diff --git a/src/components/formatters/test/src/create_smartSchema.cc b/src/components/formatters/test/src/create_smartSchema.cc index 1497fbf281..3602fc3de7 100644 --- a/src/components/formatters/test/src/create_smartSchema.cc +++ b/src/components/formatters/test/src/create_smartSchema.cc @@ -35,9 +35,9 @@ namespace test { namespace components { namespace formatters { -using namespace NsSmartDeviceLink::NsJSONHandler::strings; -using namespace NsSmartDeviceLink::NsJSONHandler::Formatters; -using namespace NsSmartDeviceLink::NsSmartObjects; +using namespace ns_smart_device_link::ns_json_handler::strings; +using namespace ns_smart_device_link::ns_json_handler::formatters; +using namespace ns_smart_device_link::ns_smart_objects; template <> const EnumConversionHelper<FunctionIDTest::eType>::EnumToCStringMap diff --git a/src/components/formatters/test/src/meta_formatter_test_helper.cc b/src/components/formatters/test/src/meta_formatter_test_helper.cc index 897c8d364d..b322510f6c 100644 --- a/src/components/formatters/test/src/meta_formatter_test_helper.cc +++ b/src/components/formatters/test/src/meta_formatter_test_helper.cc @@ -36,8 +36,8 @@ namespace test { namespace components { namespace formatters { -using namespace NsSmartDeviceLink::NsJSONHandler::strings; -using namespace NsSmartDeviceLink::NsJSONHandler::Formatters; +using namespace ns_smart_device_link::ns_json_handler::strings; +using namespace ns_smart_device_link::ns_json_handler::formatters; void CMetaFormatterTestHelper::SetUp() { function_id_items_.insert(FunctionIDTest::RegisterAppInterface); |