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/beast/utility/PropertyStream.h>
24 #include <ripple/json/json_value.h>
25 
26 namespace ripple {
27 
30 {
31 public:
34 
35 public:
37  Json::Value const&
38  top() const;
39 
40 protected:
41  void
42  map_begin() override;
43  void
44  map_begin(std::string const& key) override;
45  void
46  map_end() override;
47  void
48  add(std::string const& key, short value) override;
49  void
50  add(std::string const& key, unsigned short value) override;
51  void
52  add(std::string const& key, int value) override;
53  void
54  add(std::string const& key, unsigned int value) override;
55  void
56  add(std::string const& key, long value) override;
57  void
58  add(std::string const& key, float v) override;
59  void
60  add(std::string const& key, double v) override;
61  void
62  add(std::string const& key, std::string const& v) override;
63  void
64  array_begin() override;
65  void
66  array_begin(std::string const& key) override;
67  void
68  array_end() override;
69 
70  void
71  add(short value) override;
72  void
73  add(unsigned short value) override;
74  void
75  add(int value) override;
76  void
77  add(unsigned int value) override;
78  void
79  add(long value) override;
80  void
81  add(float v) override;
82  void
83  add(double v) override;
84  void
85  add(std::string const& v) override;
86 };
87 
88 } // namespace ripple
89 
90 #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:62
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:38
ripple::JsonPropertyStream::map_end
void map_end() override
Definition: JsonPropertyStream.cpp:56
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:128
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:110
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:145