A client for the SmartREST protocol from Cumulocity.
Fork of MbedSmartRest by
ParsedValue.h@0:f76673e7f275, 2014-01-23 (annotated)
- Committer:
- vwochnik
- Date:
- Thu Jan 23 14:36:46 2014 +0000
- Revision:
- 0:f76673e7f275
initial commit, only abstraction
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vwochnik | 0:f76673e7f275 | 1 | /* |
vwochnik | 0:f76673e7f275 | 2 | * ParsedValue.h |
vwochnik | 0:f76673e7f275 | 3 | * |
vwochnik | 0:f76673e7f275 | 4 | * Created on: Nov 1, 2013 |
vwochnik | 0:f76673e7f275 | 5 | * * Authors: Vincent Wochnik <v.wochnik@gmail.com> |
vwochnik | 0:f76673e7f275 | 6 | * |
vwochnik | 0:f76673e7f275 | 7 | * Copyright (c) 2013 Cumulocity GmbH |
vwochnik | 0:f76673e7f275 | 8 | * |
vwochnik | 0:f76673e7f275 | 9 | * Permission is hereby granted, free of charge, to any person obtaining |
vwochnik | 0:f76673e7f275 | 10 | * a copy of this software and associated documentation files (the |
vwochnik | 0:f76673e7f275 | 11 | * "Software"), to deal in the Software without restriction, including |
vwochnik | 0:f76673e7f275 | 12 | * without limitation the rights to use, copy, modify, merge, publish, |
vwochnik | 0:f76673e7f275 | 13 | * distribute, sublicense, and/or sell copies of the Software, and to |
vwochnik | 0:f76673e7f275 | 14 | * permit persons to whom the Software is furnished to do so, subject to |
vwochnik | 0:f76673e7f275 | 15 | * the following conditions: |
vwochnik | 0:f76673e7f275 | 16 | * |
vwochnik | 0:f76673e7f275 | 17 | * The above copyright notice and this permission notice shall be |
vwochnik | 0:f76673e7f275 | 18 | * included in all copies or substantial portions of the Software. |
vwochnik | 0:f76673e7f275 | 19 | * |
vwochnik | 0:f76673e7f275 | 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
vwochnik | 0:f76673e7f275 | 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
vwochnik | 0:f76673e7f275 | 22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
vwochnik | 0:f76673e7f275 | 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
vwochnik | 0:f76673e7f275 | 24 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
vwochnik | 0:f76673e7f275 | 25 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
vwochnik | 0:f76673e7f275 | 26 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
vwochnik | 0:f76673e7f275 | 27 | */ |
vwochnik | 0:f76673e7f275 | 28 | |
vwochnik | 0:f76673e7f275 | 29 | #ifndef PARSEDVALUE_H |
vwochnik | 0:f76673e7f275 | 30 | #define PARSEDVALUE_H |
vwochnik | 0:f76673e7f275 | 31 | |
vwochnik | 0:f76673e7f275 | 32 | #include "Value.h" |
vwochnik | 0:f76673e7f275 | 33 | #include "CharValue.h" |
vwochnik | 0:f76673e7f275 | 34 | |
vwochnik | 0:f76673e7f275 | 35 | class ParsedValue : public Value |
vwochnik | 0:f76673e7f275 | 36 | { |
vwochnik | 0:f76673e7f275 | 37 | public: |
vwochnik | 0:f76673e7f275 | 38 | ParsedValue(const char*, bool=false); |
vwochnik | 0:f76673e7f275 | 39 | |
vwochnik | 0:f76673e7f275 | 40 | uint8_t valueType() const; |
vwochnik | 0:f76673e7f275 | 41 | long integerValue() const; |
vwochnik | 0:f76673e7f275 | 42 | double floatValue() const; |
vwochnik | 0:f76673e7f275 | 43 | const char * characterValue() const; |
vwochnik | 0:f76673e7f275 | 44 | |
vwochnik | 0:f76673e7f275 | 45 | size_t write(AbstractDataSink&) const; |
vwochnik | 0:f76673e7f275 | 46 | size_t length() const; |
vwochnik | 0:f76673e7f275 | 47 | Value* copy() const; |
vwochnik | 0:f76673e7f275 | 48 | |
vwochnik | 0:f76673e7f275 | 49 | private: |
vwochnik | 0:f76673e7f275 | 50 | void extractValue(); |
vwochnik | 0:f76673e7f275 | 51 | |
vwochnik | 0:f76673e7f275 | 52 | private: |
vwochnik | 0:f76673e7f275 | 53 | CharValue _value; |
vwochnik | 0:f76673e7f275 | 54 | uint8_t _type; |
vwochnik | 0:f76673e7f275 | 55 | double _float; |
vwochnik | 0:f76673e7f275 | 56 | uint8_t _digits; |
vwochnik | 0:f76673e7f275 | 57 | bool _zflag; |
vwochnik | 0:f76673e7f275 | 58 | long _integer; |
vwochnik | 0:f76673e7f275 | 59 | }; |
vwochnik | 0:f76673e7f275 | 60 | |
vwochnik | 0:f76673e7f275 | 61 | #endif |