-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjsd_string.cpp
More file actions
32 lines (29 loc) · 800 Bytes
/
Copy pathjsd_string.cpp
File metadata and controls
32 lines (29 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "jsd_string.hpp"
#include "../utility/base64.hpp"
namespace JSON {
void parse(std::string& value, std::string const& name,
PropertyTree const& object, ParsingOptions const& options)
{
try
{
if (!options.strings_are_binary)
{
SJSON_GET_VALUE(std::string, name, value, "");
}
else
{
std::string encoded;
SJSON_GET_VALUE(std::string, name, encoded, "");
decodeBase64 <char, std::basic_string> (encoded, value);
}
}
catch (boost::property_tree::ptree_bad_data& exc)
{
SJSON_DEFAULT_PROPERTY_ERROR_HANDLER("", "");
}
catch (boost::property_tree::ptree_bad_path& exc)
{
SJSON_DEFAULT_PATH_ERROR_HANDLER("", "");
}
}
} // JSON