Home
|
Develop
|
Download
|
Contact
test
example_jsonelement_load.cpp
1
27
#include <Pds/Ra>
28
29
int
main(
void
)
30
{
31
std::cout<<
"TypeOfString:\n"
;
32
std::cout<<
Pds::JsonElement::TypeOfString
(
" true "
)<<
"\n"
;
33
std::cout<<
Pds::JsonElement::TypeOfString
(
" -123 "
)<<
"\n"
;
34
std::cout<<
Pds::JsonElement::TypeOfString
(
"-1.23e-1"
)<<
"\n"
;
35
std::cout<<
Pds::JsonElement::TypeOfString
(
" \"xx\" "
)<<
"\n"
;
36
std::cout<<
Pds::JsonElement::TypeOfString
(
"{ \"data\": 7 }"
)<<
"\n"
;
37
std::cout<<
Pds::JsonElement::TypeOfString
(
"[ -1 , +2 ]"
)<<
"\n"
;
38
std::cout<<
Pds::JsonElement::TypeOfString
(
"[ -1.3 , -2.3 ]"
)<<
"\n"
;
39
std::cout<<
Pds::JsonElement::TypeOfString
(
"[ true , false]"
)<<
"\n"
;
40
std::cout<<
Pds::JsonElement::TypeOfString
(
"[ \"aa\",\"b\"]"
)<<
"\n"
;
41
std::cout<<
Pds::JsonElement::TypeOfString
(
"[ {\"a\":1}, {\"b\":2}]"
)<<
"\n"
;
42
43
std::cout<<
"\nLoadFromStringOfType:\n"
;
44
45
std::cout<<
Pds::JsonElement::LoadFromStringOfType
(
"Boolean"
,
" true "
);
46
std::cout<<
Pds::JsonElement::LoadFromStringOfType
(
"Integer"
,
" -123 "
);
47
std::cout<<
Pds::JsonElement::LoadFromStringOfType
(
"Real"
,
"-1.23e-1"
);
48
std::cout<<
Pds::JsonElement::LoadFromStringOfType
(
"String"
,
" \"xx\" "
);
49
std::cout<<
Pds::JsonElement::LoadFromStringOfType
(
"Json"
,
"{ \"data\": 7 }"
);
50
std::cout<<
Pds::JsonElement::LoadFromStringOfType
(
"ArrayI"
,
"[ -1 , +2 ]"
);
51
std::cout<<
Pds::JsonElement::LoadFromStringOfType
(
"ArrayR"
,
"[ -1.3 , -2.3 ]"
);
52
std::cout<<
Pds::JsonElement::LoadFromStringOfType
(
"ArrayB"
,
"[ true , false]"
);
53
std::cout<<
Pds::JsonElement::LoadFromStringOfType
(
"ArrayS"
,
"[ \"aa\",\"b\"]"
);
54
std::cout<<
Pds::JsonElement::LoadFromStringOfType
(
"ArrayJ"
,
"[ {\"a\":1}, {\"b\":2}]"
);
55
56
return
0;
57
}
Pds::JsonElement::TypeOfString
static std::string TypeOfString(const std::string &elstr)
Retorna un std::string indicando o tipo de dato en elstr.
Pds::JsonElement::LoadFromStringOfType
static Pds::JsonElement LoadFromStringOfType(const std::string &type, const std::string &data)
Enlaces de interés
Manual de referencia generado el Martes, 10 de Octubre de 2023 18:23:40 para la biblioteca
libpdsramm
usando Generado el Martes, 10 de Octubre de 2023 18:23:40 para libpdsramm por
1.9.4