/usr/include/Wt/Json/Parser is in libwt-dev 3.3.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2011 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WT_JSON_PARSER_H_
#define WT_JSON_PARSER_H_
#include <string>
#include <Wt/WException>
namespace Wt {
namespace Json {
class Object;
class Value;
/*! \brief A parse error.
*
* Exception thrown or returned by a JSON parsing function.
*
* \ingroup json
*/
class ParseError : public WException
{
public:
ParseError();
ParseError(const std::string& message);
void setError(const std::string& message);
};
/*! \brief Parse function
*
* This function parses the input string (which represents a UTF-8
* JSON-encoded data structure) into the \p result value. On success,
* the result value contains either an Array or Object.
*
* If validateUTF8 is true, the parser will sanitize (security scan for
* invalid UTF-8) the UTF-8 input string before parsing starts.
*
* \throws ParseError when the input is not a correct JSON structure.
*
* \ingroup json
*/
WT_API extern void parse(const std::string& input, Value& result, bool validateUTF8 = true);
/*! \brief Parse function
*
* This function parses the input string (which represents a UTF-8
* JSON-encoded data structure) into the \p result value. On success,
* the result value contains either an Array or Object.
*
* If validateUTF8 is true, the parser will sanitize (security scan for
* invalid UTF-8) the UTF-8 input string before parsing starts.
*
* This method returns \c true if the parse was succesful, or reports an
* error in into the \p error value otherwise.
*
* \ingroup json
*/
WT_API extern bool parse(const std::string& input, Value& result,
ParseError& error, bool validateUTF8 = true);
/*! \brief Parse function
*
* This function parses the input string (which represents a UTF-8
* JSON-encoded data structure) into the \p result object.
*
* If validateUTF8 is true, the parser will sanitize (security scan for
* invalid UTF-8) the UTF-8 input string before parsing starts.
*
* \throws ParseError when the input is not a correct JSON structure.
* \throws TypeException when the JSON structure does not represent an Object.
*
* \ingroup json
*/
WT_API extern void parse(const std::string& input, Object& result,
bool validateUTF8 = true);
/*! \brief Parse function
*
* This function parses the input string (which represents a UTF-8
* JSON-encoded data structure) into the \p result value. On success,
* the result value contains either an Array or Object.
*
* If validateUTF8 is true, the parser will sanitize (security scan for
* invalid UTF-8) the UTF-8 input string before parsing starts.
*
* This method returns \c true if the parse was succesful, or reports an
* error in into the \p error value otherwise.
*
* \ingroup json
*/
WT_API extern bool parse(const std::string& input, Object& result,
ParseError& error, bool validateUTF8 = true);
#ifdef WT_TARGET_JAVA
class Parser {
Object parse(const std::string& input, bool validateUTF8 = true);
};
#endif
}
}
#endif // WT_JSON_PARSER_H_
|