summaryrefslogtreecommitdiff
path: root/src/components/smart_objects/include/smart_objects/smart_object.h
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2017-05-04 12:18:40 -0400
committerJacob Keeler <jacob.keeler@livioradio.com>2017-05-04 12:18:40 -0400
commit884e897941a600c11b7fcfa3d8cf59ce15eb3571 (patch)
tree1d5b0d1abbdcdd7c2661a59b3c10b6110fbf53a3 /src/components/smart_objects/include/smart_objects/smart_object.h
parentdc9732721e1690159fb56e0b5f5e9d643c9a9d44 (diff)
downloadsdl_core-884e897941a600c11b7fcfa3d8cf59ce15eb3571.tar.gz
Invalid data responses now return useful error messages in `info` field
Diffstat (limited to 'src/components/smart_objects/include/smart_objects/smart_object.h')
-rw-r--r--src/components/smart_objects/include/smart_objects/smart_object.h52
1 files changed, 51 insertions, 1 deletions
diff --git a/src/components/smart_objects/include/smart_objects/smart_object.h b/src/components/smart_objects/include/smart_objects/smart_object.h
index 98e58fffd1..95d52209f7 100644
--- a/src/components/smart_objects/include/smart_objects/smart_object.h
+++ b/src/components/smart_objects/include/smart_objects/smart_object.h
@@ -674,7 +674,7 @@ class SmartObject FINAL {
*
* @return Result of validation.
*/
- Errors::eType validate();
+ Errors::eType validate(std::string& errorMessage);
/**
* @brief Sets new schema
@@ -699,6 +699,21 @@ class SmartObject FINAL {
SmartType getType() const;
/**
+ * @brief Sets new key for this object
+ *
+ * @param std::string New key sequesnce
+ * @return void
+ **/
+ void setKey(const std::string& NewKey);
+
+ /**
+ * @brief Returns current object type
+ *
+ * @return std::string
+ **/
+ std::string getKey() const;
+
+ /**
* @brief Returns length of object
*
* If object has type string, array or map then method returns corresponded
@@ -727,6 +742,35 @@ class SmartObject FINAL {
return !(*this == Other);
}
+ static std::string typeToString(SmartType type) {
+ switch (type) {
+ case SmartType_Null:
+ return "Null";
+ case SmartType_Boolean:
+ return "Boolean";
+ case SmartType_Integer:
+ return "Integer";
+ case SmartType_Character:
+ return "Character";
+ case SmartType_String:
+ return "String";
+ case SmartType_Double:
+ return "Double";
+ case SmartType_Map:
+ return "Object";
+ case SmartType_Array:
+ return "Array";
+ case SmartType_Binary:
+ return "Binary_Data";
+ case SmartType_UInteger:
+ return "Unsigned_Integer";
+ case SmartType_Invalid:
+ return "Invalid_Type";
+ default:
+ return "Unknown_Type";
+ }
+ }
+
protected:
static std::string OperatorToTransform(const SmartMap::value_type& pair);
/**
@@ -976,6 +1020,12 @@ class SmartObject FINAL {
* @brief Validation schema, attached to the object
**/
CSmartSchema m_schema;
+
+ /**
+ * @brief Key sequence that describes where the current object is within an
+ *object structure, for debugging purposes
+ **/
+ std::string* m_key;
};
/**