summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2017-09-29 09:50:12 -0400
committerjacobkeeler <jacob.keeler@livioradio.com>2017-09-29 09:50:12 -0400
commit3800d598555ea45f2b61741b53a959cdd678e705 (patch)
treecdd3b3a19a5c1adc72895b10ee11e9c043e606b0
parent18b0a605c3b665c4de6633acf4a24b7ed6ebbd90 (diff)
downloadsdl_core-3800d598555ea45f2b61741b53a959cdd678e705.tar.gz
Deprecate old validate methods
-rw-r--r--src/components/smart_objects/include/smart_objects/always_false_schema_item.h10
-rw-r--r--src/components/smart_objects/include/smart_objects/always_true_schema_item.h10
-rw-r--r--src/components/smart_objects/include/smart_objects/array_schema_item.h14
-rw-r--r--src/components/smart_objects/include/smart_objects/default_shema_item.h18
-rw-r--r--src/components/smart_objects/include/smart_objects/enum_schema_item.h18
-rw-r--r--src/components/smart_objects/include/smart_objects/number_schema_item.h19
-rw-r--r--src/components/smart_objects/include/smart_objects/object_schema_item.h10
-rw-r--r--src/components/smart_objects/include/smart_objects/schema_item.h16
-rw-r--r--src/components/smart_objects/include/smart_objects/smart_object.h11
-rw-r--r--src/components/smart_objects/include/smart_objects/smart_schema.h20
-rw-r--r--src/components/smart_objects/include/smart_objects/string_schema_item.h10
-rw-r--r--src/components/smart_objects/src/always_false_schema_item.cc5
-rw-r--r--src/components/smart_objects/src/always_true_schema_item.cc4
-rw-r--r--src/components/smart_objects/src/array_schema_item.cc5
-rw-r--r--src/components/smart_objects/src/object_schema_item.cc5
-rw-r--r--src/components/smart_objects/src/schema_item.cc4
-rw-r--r--src/components/smart_objects/src/smart_object.cc5
-rw-r--r--src/components/smart_objects/src/smart_schema.cc5
-rw-r--r--src/components/smart_objects/src/string_schema_item.cc5
19 files changed, 187 insertions, 7 deletions
diff --git a/src/components/smart_objects/include/smart_objects/always_false_schema_item.h b/src/components/smart_objects/include/smart_objects/always_false_schema_item.h
index 6e62be6f2d..ea0ce33bd0 100644
--- a/src/components/smart_objects/include/smart_objects/always_false_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/always_false_schema_item.h
@@ -49,10 +49,20 @@ class CAlwaysFalseSchemaItem : public ISchemaItem {
**/
static utils::SharedPtr<CAlwaysFalseSchemaItem> create();
/**
+ * @deprecated
* @brief Validate smart object.
* @param Object Object to validate.
* @return Errors::ERROR
**/
+ // DEPRECATED
+ Errors::eType validate(const SmartObject& Object) OVERRIDE;
+ /**
+ * @brief Validate smart object.
+ * @param Object Object to validate.
+ * @param errorMessage string reference to be filled with an appropriate error
+ *message if an error occurs
+ * @return Errors::ERROR
+ **/
Errors::eType validate(const SmartObject& Object,
std::string& errorMessage) OVERRIDE;
diff --git a/src/components/smart_objects/include/smart_objects/always_true_schema_item.h b/src/components/smart_objects/include/smart_objects/always_true_schema_item.h
index 54e8bc9baa..0141e12ecb 100644
--- a/src/components/smart_objects/include/smart_objects/always_true_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/always_true_schema_item.h
@@ -49,10 +49,20 @@ class CAlwaysTrueSchemaItem : public ISchemaItem {
**/
static utils::SharedPtr<CAlwaysTrueSchemaItem> create();
/**
+ * @deprecated
* @brief Validate smart object.
* @param Object Object to validate.
* @return NsSmartObjects::Errors::eType
**/
+ // DEPRECATED
+ Errors::eType validate(const SmartObject& Object) OVERRIDE;
+ /**
+ * @brief Validate smart object.
+ * @param Object Object to validate.
+ * @param errorMessage string reference to be filled with an appropriate error
+ *message if an error occurs
+ * @return NsSmartObjects::Errors::eType
+ **/
Errors::eType validate(const SmartObject& Object,
std::string& errorMessage) OVERRIDE;
diff --git a/src/components/smart_objects/include/smart_objects/array_schema_item.h b/src/components/smart_objects/include/smart_objects/array_schema_item.h
index c8057d6ca1..455d50bf4b 100644
--- a/src/components/smart_objects/include/smart_objects/array_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/array_schema_item.h
@@ -63,9 +63,23 @@ class CArraySchemaItem : public ISchemaItem {
TSchemaItemParameter<size_t>());
/**
+ * @deprecated
+ *
+ * @brief Validate smart object.
+ *
+ * @param Object Object to validate.
+ *
+ * @return NsSmartObjects::Errors::eType
+ **/
+ // DEPRECATED
+ Errors::eType validate(const SmartObject& Object) OVERRIDE;
+
+ /**
* @brief Validate smart object.
*
* @param Object Object to validate.
+ * @param errorMessage string reference to be filled with an appropriate error
+ * message if an error occurs
*
* @return NsSmartObjects::Errors::eType
**/
diff --git a/src/components/smart_objects/include/smart_objects/default_shema_item.h b/src/components/smart_objects/include/smart_objects/default_shema_item.h
index a9bf5ae6da..0cd5f42ac8 100644
--- a/src/components/smart_objects/include/smart_objects/default_shema_item.h
+++ b/src/components/smart_objects/include/smart_objects/default_shema_item.h
@@ -50,9 +50,19 @@ class CDefaultSchemaItem : public ISchemaItem {
public:
typedef TSchemaItemParameter<Type> ParameterType;
/**
+ * @deprecated
* @brief Validate smart object.
* @param Object Object to validate.
- * @return NsSmartObjects::Errors::eType
+ * @return Errors::ERROR
+ **/
+ // DEPRECATED
+ Errors::eType validate(const SmartObject& Object) OVERRIDE;
+ /**
+ * @brief Validate smart object.
+ * @param Object Object to validate.
+ * @param errorMessage string reference to be filled with an appropriate error
+ *message if an error occurs
+ * @return Errors::ERROR
**/
Errors::eType validate(const SmartObject& Object,
std::string& errorMessage) OVERRIDE;
@@ -99,6 +109,12 @@ CDefaultSchemaItem<Type>::CDefaultSchemaItem(const ParameterType& DefaultValue)
: mDefaultValue(DefaultValue) {}
template <typename Type>
+Errors::eType CDefaultSchemaItem<Type>::validate(const SmartObject& Object) {
+ std::string errorMessage;
+ return validate(Object, errorMessage);
+}
+
+template <typename Type>
Errors::eType CDefaultSchemaItem<Type>::validate(const SmartObject& Object,
std::string& errorMessage) {
if (getSmartType() != Object.getType()) {
diff --git a/src/components/smart_objects/include/smart_objects/enum_schema_item.h b/src/components/smart_objects/include/smart_objects/enum_schema_item.h
index 1ca0fe07af..2c0ae53aed 100644
--- a/src/components/smart_objects/include/smart_objects/enum_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/enum_schema_item.h
@@ -65,9 +65,19 @@ class TEnumSchemaItem : public CDefaultSchemaItem<EnumType> {
const TSchemaItemParameter<EnumType>& DefaultValue =
TSchemaItemParameter<EnumType>());
/**
+ * @deprecated
* @brief Validate smart object.
* @param Object Object to validate.
- * @return NsSmartObjects::Errors::eType
+ * @return Errors::ERROR
+ **/
+ // DEPRECATED
+ Errors::eType validate(const SmartObject& Object) OVERRIDE;
+ /**
+ * @brief Validate smart object.
+ * @param Object Object to validate.
+ * @param errorMessage string reference to be filled with an appropriate error
+ *message if an error occurs
+ * @return Errors::ERROR
**/
Errors::eType validate(const SmartObject& Object,
std::string& errorMessage) OVERRIDE;
@@ -207,6 +217,12 @@ utils::SharedPtr<TEnumSchemaItem<EnumType> > TEnumSchemaItem<EnumType>::create(
}
template <typename EnumType>
+Errors::eType TEnumSchemaItem<EnumType>::validate(const SmartObject& Object) {
+ std::string errorMessage;
+ return validate(Object, errorMessage);
+}
+
+template <typename EnumType>
Errors::eType TEnumSchemaItem<EnumType>::validate(const SmartObject& Object,
std::string& errorMessage) {
if (SmartType_Integer != Object.getType()) {
diff --git a/src/components/smart_objects/include/smart_objects/number_schema_item.h b/src/components/smart_objects/include/smart_objects/number_schema_item.h
index dc45bfb625..dddb7c3b02 100644
--- a/src/components/smart_objects/include/smart_objects/number_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/number_schema_item.h
@@ -65,9 +65,19 @@ class TNumberSchemaItem : public CDefaultSchemaItem<NumberType> {
TSchemaItemParameter<NumberType>());
/**
+ * @deprecated
* @brief Validate smart object.
* @param Object Object to validate.
- * @return NsSmartObjects::Errors::eType
+ * @return Errors::ERROR
+ **/
+ // DEPRECATED
+ Errors::eType validate(const SmartObject& Object) OVERRIDE;
+ /**
+ * @brief Validate smart object.
+ * @param Object Object to validate.
+ * @param errorMessage string reference to be filled with an appropriate error
+ *message if an error occurs
+ * @return Errors::ERROR
**/
Errors::eType validate(const SmartObject& Object,
std::string& errorMessage) OVERRIDE;
@@ -128,6 +138,13 @@ bool TNumberSchemaItem<NumberType>::isValidNumberType(SmartType type) {
template <typename NumberType>
Errors::eType TNumberSchemaItem<NumberType>::validate(
+ const SmartObject& Object) {
+ std::string errorMessage;
+ return validate(Object, errorMessage);
+}
+
+template <typename NumberType>
+Errors::eType TNumberSchemaItem<NumberType>::validate(
const SmartObject& Object, std::string& errorMessage) {
if (!isValidNumberType(Object.getType())) {
if (!Object.getKey().empty()) {
diff --git a/src/components/smart_objects/include/smart_objects/object_schema_item.h b/src/components/smart_objects/include/smart_objects/object_schema_item.h
index 781f6a729c..92e2936722 100644
--- a/src/components/smart_objects/include/smart_objects/object_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/object_schema_item.h
@@ -84,10 +84,20 @@ class CObjectSchemaItem : public ISchemaItem {
**/
static utils::SharedPtr<CObjectSchemaItem> create(const Members& Members);
/**
+ * @deprecated
* @brief Validate smart object.
* @param Object Object to validate.
* @return NsSmartObjects::Errors::eType
**/
+ // DEPRECATED
+ Errors::eType validate(const SmartObject& Object) OVERRIDE;
+ /**
+ * @brief Validate smart object.
+ * @param Object Object to validate.
+ * @param errorMessage string reference to be filled with an appropriate error
+ *message if an error occurs
+ * @return NsSmartObjects::Errors::eType
+ **/
Errors::eType validate(const SmartObject& Object,
std::string& errorMessage) OVERRIDE;
/**
diff --git a/src/components/smart_objects/include/smart_objects/schema_item.h b/src/components/smart_objects/include/smart_objects/schema_item.h
index c1737417db..9cee326fdd 100644
--- a/src/components/smart_objects/include/smart_objects/schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/schema_item.h
@@ -47,9 +47,23 @@ class SmartObject;
class ISchemaItem {
public:
/**
- * @brief Validate object.
+ * @deprecated
+ *
+ * @brief Validate smart object.
+ *
+ * @param Object Object to validate.
+ *
+ * @return NsSmartObjects::Errors::eType
+ **/
+ // DEPRECATED
+ virtual Errors::eType validate(const SmartObject& Object);
+
+ /**
+ * @brief Validate smart object.
*
* @param Object Object to validate.
+ * @param errorMessage string reference to be filled with an appropriate error
+ * message if an error occurs
*
* @return NsSmartObjects::Errors::eType
**/
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 95d52209f7..ef3775e098 100644
--- a/src/components/smart_objects/include/smart_objects/smart_object.h
+++ b/src/components/smart_objects/include/smart_objects/smart_object.h
@@ -670,10 +670,21 @@ class SmartObject FINAL {
bool isValid() const;
/**
+ * @deprecated
* @brief Validates object according to attached schema.
*
* @return Result of validation.
*/
+ // DEPRECATED
+ Errors::eType validate();
+
+ /**
+ * @brief Validates object according to attached schema.
+ *
+ * @param errorMessage string reference to be filled with an appropriate error
+ *message if an error occurs
+ * @return Result of validation.
+ */
Errors::eType validate(std::string& errorMessage);
/**
diff --git a/src/components/smart_objects/include/smart_objects/smart_schema.h b/src/components/smart_objects/include/smart_objects/smart_schema.h
index 3fd67053ae..e9aaf2e97c 100644
--- a/src/components/smart_objects/include/smart_objects/smart_schema.h
+++ b/src/components/smart_objects/include/smart_objects/smart_schema.h
@@ -61,12 +61,26 @@ class CSmartSchema FINAL {
explicit CSmartSchema(const ISchemaItemPtr SchemaItem);
/**
+ * @deprecated
+ *
* @brief Validate smart object.
*
- * @param Object SmartObject to validate.
+ * @param Object Object to validate.
*
- * @return Result of validation.
- */
+ * @return NsSmartObjects::Errors::eType
+ **/
+ // DEPRECATED
+ Errors::eType validate(const SmartObject& Object) const;
+
+ /**
+ * @brief Validate smart object.
+ *
+ * @param Object Object to validate.
+ * @param errorMessage string reference to be filled with an appropriate error
+ *message if an error occurs
+ *
+ * @return NsSmartObjects::Errors::eType
+ **/
Errors::eType validate(const SmartObject& Object,
std::string& errorMessage) const;
diff --git a/src/components/smart_objects/include/smart_objects/string_schema_item.h b/src/components/smart_objects/include/smart_objects/string_schema_item.h
index 20d8040e29..755e2f7258 100644
--- a/src/components/smart_objects/include/smart_objects/string_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/string_schema_item.h
@@ -62,10 +62,20 @@ class CStringSchemaItem : public CDefaultSchemaItem<std::string> {
const TSchemaItemParameter<std::string>& DefaultValue =
TSchemaItemParameter<std::string>());
/**
+ * @deprecated
* @brief Validate smart object.
* @param Object Object to validate.
* @return NsSmartObjects::Errors::eType
**/
+ // DEPRECATED
+ Errors::eType validate(const SmartObject& Object) OVERRIDE;
+ /**
+ * @brief Validate smart object.
+ * @param Object Object to validate.
+ * @param errorMessage string reference to be filled with an appropriate error
+ *message if an error occurs
+ * @return NsSmartObjects::Errors::eType
+ **/
Errors::eType validate(const SmartObject& Object,
std::string& errorMessage) OVERRIDE;
diff --git a/src/components/smart_objects/src/always_false_schema_item.cc b/src/components/smart_objects/src/always_false_schema_item.cc
index a08ad32b1b..d6e2db3900 100644
--- a/src/components/smart_objects/src/always_false_schema_item.cc
+++ b/src/components/smart_objects/src/always_false_schema_item.cc
@@ -41,6 +41,11 @@ utils::SharedPtr<CAlwaysFalseSchemaItem> CAlwaysFalseSchemaItem::create() {
return new CAlwaysFalseSchemaItem();
}
+Errors::eType CAlwaysFalseSchemaItem::validate(const SmartObject& object) {
+ std::string errorMessage;
+ return validate(object, errorMessage);
+}
+
Errors::eType CAlwaysFalseSchemaItem::validate(const SmartObject& object,
std::string& errorMessage) {
errorMessage.assign("Generic error");
diff --git a/src/components/smart_objects/src/always_true_schema_item.cc b/src/components/smart_objects/src/always_true_schema_item.cc
index 0b1b8af0c5..2521dbc2d4 100644
--- a/src/components/smart_objects/src/always_true_schema_item.cc
+++ b/src/components/smart_objects/src/always_true_schema_item.cc
@@ -39,6 +39,10 @@ utils::SharedPtr<CAlwaysTrueSchemaItem> CAlwaysTrueSchemaItem::create() {
return new CAlwaysTrueSchemaItem();
}
+Errors::eType CAlwaysTrueSchemaItem::validate(const SmartObject& object) {
+ return Errors::OK;
+}
+
Errors::eType CAlwaysTrueSchemaItem::validate(const SmartObject& object,
std::string& errorMessage) {
return Errors::OK;
diff --git a/src/components/smart_objects/src/array_schema_item.cc b/src/components/smart_objects/src/array_schema_item.cc
index 4c6731c159..99d0a89252 100644
--- a/src/components/smart_objects/src/array_schema_item.cc
+++ b/src/components/smart_objects/src/array_schema_item.cc
@@ -41,6 +41,11 @@ utils::SharedPtr<CArraySchemaItem> CArraySchemaItem::create(
return new CArraySchemaItem(ElementSchemaItem, MinSize, MaxSize);
}
+Errors::eType CArraySchemaItem::validate(const SmartObject& Object) {
+ std::string errorMessage;
+ return validate(Object, errorMessage);
+}
+
Errors::eType CArraySchemaItem::validate(const SmartObject& Object,
std::string& errorMessage) {
if (SmartType_Array != Object.getType()) {
diff --git a/src/components/smart_objects/src/object_schema_item.cc b/src/components/smart_objects/src/object_schema_item.cc
index 997f72b6ac..1a699e9fdd 100644
--- a/src/components/smart_objects/src/object_schema_item.cc
+++ b/src/components/smart_objects/src/object_schema_item.cc
@@ -56,6 +56,11 @@ utils::SharedPtr<CObjectSchemaItem> CObjectSchemaItem::create(
return new CObjectSchemaItem(members);
}
+Errors::eType CObjectSchemaItem::validate(const SmartObject& object) {
+ std::string errorMessage;
+ return validate(object, errorMessage);
+}
+
Errors::eType CObjectSchemaItem::validate(const SmartObject& object,
std::string& errorMessage) {
if (SmartType_Map != object.getType()) {
diff --git a/src/components/smart_objects/src/schema_item.cc b/src/components/smart_objects/src/schema_item.cc
index 5e3614ae06..27e2b04c73 100644
--- a/src/components/smart_objects/src/schema_item.cc
+++ b/src/components/smart_objects/src/schema_item.cc
@@ -35,6 +35,10 @@
namespace NsSmartDeviceLink {
namespace NsSmartObjects {
+Errors::eType ISchemaItem::validate(const SmartObject& Object) {
+ return Errors::ERROR;
+}
+
Errors::eType ISchemaItem::validate(const SmartObject& object,
std::string& errorMessage) {
return Errors::ERROR;
diff --git a/src/components/smart_objects/src/smart_object.cc b/src/components/smart_objects/src/smart_object.cc
index dcd0ff9f91..0e3070e524 100644
--- a/src/components/smart_objects/src/smart_object.cc
+++ b/src/components/smart_objects/src/smart_object.cc
@@ -890,6 +890,11 @@ bool SmartObject::isValid() const {
return (Errors::OK == m_schema.validate(*this, errorMessage));
}
+Errors::eType SmartObject::validate() {
+ std::string errorMessage;
+ return validate(errorMessage);
+}
+
Errors::eType SmartObject::validate(std::string& errorMessage) {
return m_schema.validate(*this, errorMessage);
}
diff --git a/src/components/smart_objects/src/smart_schema.cc b/src/components/smart_objects/src/smart_schema.cc
index 6c18f70fd2..2c99244b76 100644
--- a/src/components/smart_objects/src/smart_schema.cc
+++ b/src/components/smart_objects/src/smart_schema.cc
@@ -40,6 +40,11 @@ CSmartSchema::CSmartSchema() : mSchemaItem(CAlwaysTrueSchemaItem::create()) {}
CSmartSchema::CSmartSchema(const ISchemaItemPtr SchemaItem)
: mSchemaItem(SchemaItem) {}
+Errors::eType CSmartSchema::validate(const SmartObject& Object) const {
+ std::string errorMessage;
+ return validate(Object, errorMessage);
+}
+
Errors::eType CSmartSchema::validate(const SmartObject& object,
std::string& errorMessage) const {
return mSchemaItem->validate(object, errorMessage);
diff --git a/src/components/smart_objects/src/string_schema_item.cc b/src/components/smart_objects/src/string_schema_item.cc
index 63d01f0c18..f82ce9378c 100644
--- a/src/components/smart_objects/src/string_schema_item.cc
+++ b/src/components/smart_objects/src/string_schema_item.cc
@@ -45,6 +45,11 @@ utils::SharedPtr<CStringSchemaItem> CStringSchemaItem::create(
return new CStringSchemaItem(MinLength, MaxLength, DefaultValue);
}
+Errors::eType CStringSchemaItem::validate(const SmartObject& Object) {
+ std::string errorMessage;
+ return validate(Object, errorMessage);
+}
+
Errors::eType CStringSchemaItem::validate(const SmartObject& Object,
std::string& errorMessage) {
if (SmartType_String != Object.getType()) {