summaryrefslogtreecommitdiffstats
path: root/parameter/FixedPointParameterType.h
diff options
context:
space:
mode:
authorFrancois Gaffie <francois.gaffie@intel.com>2014-04-08 14:56:08 +0200
committerMattijs Korpershoek <mattijsx.korpershoek@intel.com>2014-06-25 10:52:26 +0200
commita17d5a584a9b681e2eb48465815d275eb5fccb8f (patch)
treeeb311ae15fdf461e1d8f3d568d4fb5eb65ed92cf /parameter/FixedPointParameterType.h
parent59cc1e33810c55e6fa1e3bd320e1cf29e24d23be (diff)
downloadexternal_parameter-framework-a17d5a584a9b681e2eb48465815d275eb5fccb8f.zip
external_parameter-framework-a17d5a584a9b681e2eb48465815d275eb5fccb8f.tar.gz
external_parameter-framework-a17d5a584a9b681e2eb48465815d275eb5fccb8f.tar.bz2
Fix Fixed Point convert issue.
BZ: 185336 Convert is failing when trying to convert the string value to integer value within FixedPointParameterType class. This patch fixes the issue by requesting to convert the string into a signed type. Change-Id: I77987eb1564292bd6dcdd0da4db52c4b4f92818f Signed-off-by: Francois Gaffie <francois.gaffie@intel.com> Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Diffstat (limited to 'parameter/FixedPointParameterType.h')
-rw-r--r--parameter/FixedPointParameterType.h65
1 files changed, 63 insertions, 2 deletions
diff --git a/parameter/FixedPointParameterType.h b/parameter/FixedPointParameterType.h
index 7f204ff..acb638a 100644
--- a/parameter/FixedPointParameterType.h
+++ b/parameter/FixedPointParameterType.h
@@ -64,8 +64,69 @@ private:
uint32_t getUtilSizeInBits() const;
// Range computation
void getRange(double& dMin, double& dMax) const;
- // Out of range error
- string getOutOfRangeError(const string& strValue, bool bRawValueSpace, bool bHexaValue) const;
+
+ /**
+ * Checks if a string has the written representation of an hexadecimal number (Which is
+ * the prefix "Ox" in C++).
+ *
+ * @param[in] strValue Parameter read from the XML file representated as a string.
+ *
+ * @return true if the string is written as hexa, false otherwise.
+ */
+ bool isHexadecimal(const string& strValue) const;
+
+ /**
+ * Convert a decimal raw represented string into an unsigned long integer.
+ * In case of a failing conversion or encodability, this function set the error to
+ * illegal value provided and gives the range allowed for the parameter.
+ *
+ * @param[in] strValue Parameter read from the XML file representated as a string in decimal
+ * raw format
+ * @param[out] uiValue Parameter representated as a long unsigned integer.
+ * @param[in:out] parameterAccessContext Parameter access context.
+ *
+ * @return true if the string was successfully converted, false otherwise.
+ */
+ bool convertFromDecimal(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const;
+
+ /**
+ * Convert an hexadecimal raw represented string into an unsigned long integer.
+ * In case of a failing conversion or encodability, this function set the error to
+ * illegal value provided and gives the range allowed for the parameter.
+ *
+ * @param[in] strValue Parameter read from the XML file representated as a string in hexadecimal
+ * raw format
+ * @param[out] uiValue Parameter representated as a long unsigned integer.
+ * @param[in:out] parameterAccessContext Parameter access context.
+ *
+ * @return true if the string was successfully converted, false otherwise.
+ */
+ bool convertFromHexadecimal(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const;
+
+ /**
+ * Convert a QI QF represented string into an unsigned long integer.
+ * In case of a failing conversion or encodability, this function set the error to
+ * illegal value provided and gives the range allowed for the parameter.
+ *
+ * @param[in] strValue Parameter read from the XML file representated as a string in QIQF
+ * representation.
+ * @param[out] uiValue Parameter representated as a long unsigned integer.
+ * @param[in:out] parameterAccessContext Parameter access context.
+ *
+ * @return true if the string was successfully converted, false otherwise.
+ */
+ bool convertFromQiQf(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const;
+
+ /**
+ * Set the out of range error.
+ * In case of a failing conversion or encodability, this function set the error to
+ * illegal value provided and gives the range allowed for the parameter.
+ *
+ * @param[in] strValue Parameter read from the XML file representated as a string
+ * @param[in:out] parameterAccessContext Parameter Access Context
+ */
+ void setOutOfRangeError(const string& strValue, CParameterAccessContext& parameterAccessContext) const;
+
// Check if data is encodable
bool checkValueAgainstRange(double dValue) const;
// Data conversion