rippled
JsonPropertyStream.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLE_JSON_JSONPROPERTYSTREAM_H_INCLUDED
21 #define RIPPLE_JSON_JSONPROPERTYSTREAM_H_INCLUDED
22 
23 #include <ripple/json/json_value.h>
24 #include <ripple/beast/utility/PropertyStream.h>
25 
26 namespace ripple {
27 
30 {
31 public:
34 
35 public:
37  Json::Value const& top() const;
38 
39 protected:
40 
41  void map_begin () override;
42  void map_begin (std::string const& key) override;
43  void map_end () override;
44  void add (std::string const& key, short value) override;
45  void add (std::string const& key, unsigned short value) override;
46  void add (std::string const& key, int value) override;
47  void add (std::string const& key, unsigned int value) override;
48  void add (std::string const& key, long value) override;
49  void add (std::string const& key, float v) override;
50  void add (std::string const& key, double v) override;
51  void add (std::string const& key, std::string const& v) override;
52  void array_begin () override;
53  void array_begin (std::string const& key) override;
54  void array_end () override;
55 
56  void add (short value) override;
57  void add (unsigned short value) override;
58  void add (int value) override;
59  void add (unsigned int value) override;
60  void add (long value) override;
61  void add (float v) override;
62  void add (double v) override;
63  void add (std::string const& v) override;
64 };
65 
66 }
67 
68 #endif
std::string
STL class.
ripple::JsonPropertyStream::top
Json::Value const & top() const
Definition: JsonPropertyStream.cpp:32
ripple::JsonPropertyStream::add
void add(std::string const &key, short value) override
Definition: JsonPropertyStream.cpp:58
std::vector< Json::Value * >
ripple::JsonPropertyStream::JsonPropertyStream
JsonPropertyStream()
Definition: JsonPropertyStream.cpp:25
ripple::JsonPropertyStream
A PropertyStream::Sink which produces a Json::Value of type objectValue.
Definition: JsonPropertyStream.h:29
ripple::JsonPropertyStream::map_begin
void map_begin() override
Definition: JsonPropertyStream.cpp:37
ripple::JsonPropertyStream::map_end
void map_end() override
Definition: JsonPropertyStream.cpp:53
ripple::JsonPropertyStream::m_stack
std::vector< Json::Value * > m_stack
Definition: JsonPropertyStream.h:33
ripple::JsonPropertyStream::array_end
void array_end() override
Definition: JsonPropertyStream.cpp:114
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::JsonPropertyStream::array_begin
void array_begin() override
Definition: JsonPropertyStream.cpp:98
beast::PropertyStream
Abstract stream with RAII containers that produce a property tree.
Definition: PropertyStream.h:36
ripple::JsonPropertyStream::m_top
Json::Value m_top
Definition: JsonPropertyStream.h:32
Json::Value
Represents a JSON value.
Definition: json_value.h:141