7e4eb3 | 2010-05-30 | Martin Stjernholm | | // $Id: JSON.pmod.in,v 1.3 2010/05/30 21:04:31 mast Exp $
|
df4c9a | 2010-05-28 | Martin Stjernholm | |
|
9eb502 | 2010-05-28 | Martin Stjernholm | | #pike __REAL_VERSION__
|
df4c9a | 2010-05-28 | Martin Stjernholm | |
|
9eb502 | 2010-05-28 | Martin Stjernholm | | //! @ignore
|
df4c9a | 2010-05-28 | Martin Stjernholm | | #if !constant (@module@)
constant this_program_does_not_exist = 1;
#else
inherit @module@;
//! @endignore
|
9eb502 | 2010-05-28 | Martin Stjernholm | | //! @appears Standards.JSON module
//!
//! Tools for handling the JSON structured data format. See
//! @url{http://www.json.org/@} and RFC 4627.
|
df4c9a | 2010-05-28 | Martin Stjernholm | | True true = True();
False false = False();
Null null = Null();
//! Objects representing the three JSON literals @expr{true@},
//! @expr{false@} and @expr{null@}. @expr{true@} and @expr{false@}
|
7e4eb3 | 2010-05-30 | Martin Stjernholm | | //! should behave as expected in boolean contexts. @expr{null@} is
//! false in a boolean context.
|
df4c9a | 2010-05-28 | Martin Stjernholm | |
class True
//! Type for the @[true] object.
{
string encode_json() {return "true";}
protected string _sprintf (int flag) {return flag == 'O' && "JSON.true";}
}
class False
//! Type for the @[false] object.
{
int `!() {return 1;}
string encode_json() {return "false";}
protected string _sprintf (int flag) {return flag == 'O' && "JSON.false";}
}
class Null
//! Type for the @[null] object.
{
|
7e4eb3 | 2010-05-30 | Martin Stjernholm | | int `!() {return 1;}
|
df4c9a | 2010-05-28 | Martin Stjernholm | | string encode_json() {return "null";}
protected string _sprintf (int flag) {return flag == 'O' && "JSON.null";}
}
#endif // constant (@module@)
|