Skip to content

Commit 146a948

Browse files
committed
Document json_symbol.cpp
1 parent 760dd0b commit 146a948

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/util/json_symbol.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Author: Chris Smowton, [email protected]
1313
#include <util/source_location.h>
1414
#include <util/type.h>
1515

16+
/// Return string value for a given key if present in the json object.
17+
/// \param in: The json object that is getting fetched as a string.
18+
/// \param key: The key for the json value to be fetched.
19+
/// \return: A string value for the corresponding key.
1620
static const std::string &
1721
try_get_string(const jsont &in, const std::string &key)
1822
{
@@ -21,13 +25,20 @@ try_get_string(const jsont &in, const std::string &key)
2125
return in.value;
2226
}
2327

28+
/// Return boolean value for a given key if present in the json object.
29+
/// \param in: The json object that is getting fetched as a boolean.
30+
/// \param key: The key for the json value to be fetched.
31+
/// \return: A boolean value for the corresponding key.
2432
static bool try_get_bool(const jsont &in, const std::string &key)
2533
{
2634
if(!(in.is_true() || in.is_false()))
2735
throw "symbol_from_json: expected bool for key '" + key + "'";
2836
return in.is_true();
2937
}
3038

39+
/// Deserialise a json object to a symbolt.
40+
/// \param in: The json object that is getting fetched as a string.
41+
/// \return: A symbolt representing the json object.
3142
symbolt symbol_from_json(const jsont &in)
3243
{
3344
if(!in.is_object())

0 commit comments

Comments
 (0)