mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
JSON: Made ::dump const, because it should be
This commit is contained in:
parent
8c36db1272
commit
965b7cfd3d
2 changed files with 12 additions and 12 deletions
12
src/JSON.cpp
12
src/JSON.cpp
|
@ -51,7 +51,7 @@ json::jtype json::value::type ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string json::value::dump ()
|
std::string json::value::dump () const
|
||||||
{
|
{
|
||||||
return "<value>";
|
return "<value>";
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ json::jtype json::string::type ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string json::string::dump ()
|
std::string json::string::dump () const
|
||||||
{
|
{
|
||||||
return std::string ("\"") + _data + "\"";
|
return std::string ("\"") + _data + "\"";
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ json::jtype json::number::type ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string json::number::dump ()
|
std::string json::number::dump () const
|
||||||
{
|
{
|
||||||
return format (_dvalue);
|
return format (_dvalue);
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ json::jtype json::literal::type ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string json::literal::dump ()
|
std::string json::literal::dump () const
|
||||||
{
|
{
|
||||||
if (_lvalue == nullvalue) return "null";
|
if (_lvalue == nullvalue) return "null";
|
||||||
else if (_lvalue == falsevalue) return "false";
|
else if (_lvalue == falsevalue) return "false";
|
||||||
|
@ -221,7 +221,7 @@ json::jtype json::array::type ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string json::array::dump ()
|
std::string json::array::dump () const
|
||||||
{
|
{
|
||||||
std::string output;
|
std::string output;
|
||||||
output += "[";
|
output += "[";
|
||||||
|
@ -331,7 +331,7 @@ json::jtype json::object::type ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string json::object::dump ()
|
std::string json::object::dump () const
|
||||||
{
|
{
|
||||||
std::string output;
|
std::string output;
|
||||||
output += "{";
|
output += "{";
|
||||||
|
|
12
src/JSON.h
12
src/JSON.h
|
@ -51,7 +51,7 @@ namespace json
|
||||||
virtual ~value () {}
|
virtual ~value () {}
|
||||||
static value* parse (Nibbler&);
|
static value* parse (Nibbler&);
|
||||||
virtual jtype type ();
|
virtual jtype type ();
|
||||||
virtual std::string dump ();
|
virtual std::string dump () const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class string : public value
|
class string : public value
|
||||||
|
@ -62,7 +62,7 @@ namespace json
|
||||||
~string () {}
|
~string () {}
|
||||||
static string* parse (Nibbler&);
|
static string* parse (Nibbler&);
|
||||||
jtype type ();
|
jtype type ();
|
||||||
std::string dump ();
|
std::string dump () const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string _data;
|
std::string _data;
|
||||||
|
@ -75,7 +75,7 @@ namespace json
|
||||||
~number () {}
|
~number () {}
|
||||||
static number* parse (Nibbler&);
|
static number* parse (Nibbler&);
|
||||||
jtype type ();
|
jtype type ();
|
||||||
std::string dump ();
|
std::string dump () const;
|
||||||
operator double () const;
|
operator double () const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -89,7 +89,7 @@ namespace json
|
||||||
~literal () {}
|
~literal () {}
|
||||||
static literal* parse (Nibbler&);
|
static literal* parse (Nibbler&);
|
||||||
jtype type ();
|
jtype type ();
|
||||||
std::string dump ();
|
std::string dump () const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum literal_value {none, nullvalue, falsevalue, truevalue};
|
enum literal_value {none, nullvalue, falsevalue, truevalue};
|
||||||
|
@ -103,7 +103,7 @@ namespace json
|
||||||
~array ();
|
~array ();
|
||||||
static array* parse (Nibbler&);
|
static array* parse (Nibbler&);
|
||||||
jtype type ();
|
jtype type ();
|
||||||
std::string dump ();
|
std::string dump () const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::vector <value*> _data;
|
std::vector <value*> _data;
|
||||||
|
@ -117,7 +117,7 @@ namespace json
|
||||||
static object* parse (Nibbler&);
|
static object* parse (Nibbler&);
|
||||||
static bool parse_pair (Nibbler&, std::string&, value*&);
|
static bool parse_pair (Nibbler&, std::string&, value*&);
|
||||||
jtype type ();
|
jtype type ();
|
||||||
std::string dump ();
|
std::string dump () const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::map <std::string, value*> _data;
|
std::map <std::string, value*> _data;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue