class Poco::JSON::ParseHandler

Overview

ParseHandler is the default handler for the JSON Parser. More…

#include <ParseHandler.h>

class ParseHandler: public Poco::JSON::Handler
{
public:
    // construction

    ParseHandler(bool preserveObjectOrder = false);

    // methods

    virtual
    void
    reset();

    virtual
    void
    startObject();

    virtual
    void
    endObject();

    virtual
    void
    startArray();

    virtual
    void
    endArray();

    virtual
    void
    key(const std::string& k);

    virtual
    Dynamic::Var
    asVar() const;

    virtual
    void
    value(int v);

    virtual
    void
    value(unsigned v);

    virtual
    void
    value(const std::string& s);

    virtual
    void
    value(double d);

    virtual
    void
    value(bool b);

    virtual
    void
    null();
};

Inherited Members

public:
    // typedefs

    typedef SharedPtr<Handler> Ptr;

    // methods

    virtual
    void
    reset() = 0;

    virtual
    void
    startObject() = 0;

    virtual
    void
    endObject() = 0;

    virtual
    void
    startArray() = 0;

    virtual
    void
    endArray() = 0;

    virtual
    void
    key(const std::string& k) = 0;

    virtual
    void
    null() = 0;

    virtual
    void
    value(int v) = 0;

    virtual
    void
    value(unsigned v) = 0;

    virtual
    void
    value(const std::string& value) = 0;

    virtual
    void
    value(double d) = 0;

    virtual
    void
    value(bool b) = 0;

    virtual
    Poco::Dynamic::Var
    asVar() const;

    virtual
    Poco::DynamicStruct
    asStruct() const;

Detailed Documentation

ParseHandler is the default handler for the JSON Parser.

This handler will construct an Object or Array based on the handlers called by the Parser.

Construction

ParseHandler(bool preserveObjectOrder = false)

Creates the ParseHandler.

If preserveObjectOrder is true, the order of properties inside objects is preserved. Otherwise, items will be sorted by keys.

Methods

virtual
void
reset()

Resets the handler state.

virtual
void
startObject()

Handles a ‘{‘; a new object is started.

virtual
void
endObject()

Handles a ‘}’; the object is closed.

virtual
void
startArray()

Handles a ‘[‘; a new array is started.

virtual
void
endArray()

Handles a ‘]’; the array is closed.

virtual
void
key(const std::string& k)

A key is read.

virtual
Dynamic::Var
asVar() const

Returns the result of the parser (an object or an array).

virtual
void
value(int v)

An integer value is read.

virtual
void
value(unsigned v)

An unsigned value is read.

This will only be triggered if the value cannot fit into a signed int.

virtual
void
value(const std::string& s)

A string value is read.

virtual
void
value(double d)

A double value is read.

virtual
void
value(bool b)

A boolean value is read.

virtual
void
null()

A null value is read.