Line | |
---|
1 | // Copyright Benoit Blanchon 2014-2016
|
---|
2 | // MIT License
|
---|
3 | //
|
---|
4 | // Arduino JSON library
|
---|
5 | // https://github.com/bblanchon/ArduinoJson
|
---|
6 | // If you like this project, please add a star!
|
---|
7 |
|
---|
8 | #pragma once
|
---|
9 |
|
---|
10 | #include <stdlib.h>
|
---|
11 |
|
---|
12 | namespace ArduinoJson {
|
---|
13 | namespace Internals {
|
---|
14 | template <typename TFloat>
|
---|
15 | TFloat parse(const char *);
|
---|
16 |
|
---|
17 | template <>
|
---|
18 | inline float parse<float>(const char *s) {
|
---|
19 | return static_cast<float>(strtod(s, NULL));
|
---|
20 | }
|
---|
21 |
|
---|
22 | template <>
|
---|
23 | inline double parse<double>(const char *s) {
|
---|
24 | return strtod(s, NULL);
|
---|
25 | }
|
---|
26 |
|
---|
27 | template <>
|
---|
28 | inline long parse<long>(const char *s) {
|
---|
29 | return strtol(s, NULL, 10);
|
---|
30 | }
|
---|
31 |
|
---|
32 | template <>
|
---|
33 | inline int parse<int>(const char *s) {
|
---|
34 | return atoi(s);
|
---|
35 | }
|
---|
36 |
|
---|
37 | #if ARDUINOJSON_USE_LONG_LONG
|
---|
38 | template <>
|
---|
39 | inline long long parse<long long>(const char *s) {
|
---|
40 | return strtoll(s, NULL, 10);
|
---|
41 | }
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | #if ARDUINOJSON_USE_INT64
|
---|
45 | template <>
|
---|
46 | inline __int64 parse<__int64>(const char *s) {
|
---|
47 | return _strtoi64(s, NULL, 10);
|
---|
48 | }
|
---|
49 | #endif
|
---|
50 | }
|
---|
51 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.