Own fork of MbedSmartRest

Dependents:   MbedSmartRestMain MbedSmartRestMain

Fork of MbedSmartRest by Cumulocity Official

Revision:
11:e1bee9a77652
Parent:
7:8159a2d12e4e
--- a/ParsedValue.cpp	Thu Oct 23 14:41:58 2014 +0200
+++ b/ParsedValue.cpp	Sat Nov 15 11:21:01 2014 +0100
@@ -32,75 +32,81 @@
 #include <ctype.h>
 #include <errno.h>
 
+
+/*-------------------------------------------------------------------------*/
 ParsedValue::ParsedValue(const char *str, bool copy) :
-    _value(str, copy),
-    _float(0.0),
-    _integer(0l)
+	_value(str, copy),
+	_float(0.0),
+	_integer(0l)
 {
-    if (_value.valueType() != VALUE_NULL) {
-        _type = VALUE_CHARACTER;
-        extractValue();
-    } else {
-        _type = VALUE_NULL;
-    }
+	if (_value.valueType() != VALUE_NULL)
+	{
+		_type = VALUE_CHARACTER;
+		extractValue();
+	}
+	else
+	{
+		_type = VALUE_NULL;
+	}
 }
-
+/*-------------------------------------------------------------------------*/
 uint8_t ParsedValue::valueType() const
 {
-    return _type;
+	return _type;
 }
-
+/*-------------------------------------------------------------------------*/
 long ParsedValue::integerValue() const
 {
-    return _integer;
+	return _integer;
 }
-
+/*-------------------------------------------------------------------------*/
 double ParsedValue::floatValue() const
 {
-    return _float;
+	return _float;
 }
-
+/*-------------------------------------------------------------------------*/
 const char * ParsedValue::characterValue() const
 {
-    if (_type != VALUE_CHARACTER)
-        return NULL;
-    return _value.characterValue();
+	if (_type != VALUE_CHARACTER)
+		return NULL;
+	return _value.characterValue();
 }
-
+/*-------------------------------------------------------------------------*/
 size_t ParsedValue::write(AbstractDataSink& sink) const
 {
-    return _value.write(sink);
+	return _value.write(sink);
 }
-
+/*-------------------------------------------------------------------------*/
 size_t ParsedValue::length() const
 {
-    return _value.length();
+	return _value.length();
 }
-
+/*-------------------------------------------------------------------------*/
 Value* ParsedValue::copy() const
 {
-    return new ParsedValue(_value.characterValue(), true);
+	return new ParsedValue(_value.characterValue(), true);
 }
-
+/*-------------------------------------------------------------------------*/
 void ParsedValue::extractValue()
 {
-    const char *str; char *ptr;
-    
-    str = _value.characterValue();
-    if ((*str == '\0') || (isspace(*str)))
-        return;
+	const char *str; char *ptr;
+
+	str = _value.characterValue();
+	if ((*str == '\0') || (isspace(*str)))
+		return;
 
-    errno = 0;
-    if ((((_integer = strtol(str, &ptr, 10)) != 0) || (errno == 0)) &&
-        (*ptr == '\0')) {
-        _type = VALUE_INTEGER;
-        return;
-    }
+	errno = 0;
+	if ((((_integer = strtol(str, &ptr, 10)) != 0) || (errno == 0)) &&
+			(*ptr == '\0')) {
+		_type = VALUE_INTEGER;
+		return;
+	}
 
-    errno = 0;
-    if ((((_float = strtod(str, &ptr)) != 0.0) || (errno == 0)) &&
-        (*ptr == '\0')) {
-        _type = VALUE_FLOAT;
-        return;
-    }
+	errno = 0;
+	if ((((_float = strtod(str, &ptr)) != 0.0) || (errno == 0)) &&
+			(*ptr == '\0')) {
+		_type = VALUE_FLOAT;
+		return;
+	}
 }
+/*-------------------------------------------------------------------------*/