summaryrefslogtreecommitdiff
path: root/src/common/ceph_json.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/ceph_json.h')
-rw-r--r--src/common/ceph_json.h33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/common/ceph_json.h b/src/common/ceph_json.h
index 53a2aefbf80..324aa9f52c0 100644
--- a/src/common/ceph_json.h
+++ b/src/common/ceph_json.h
@@ -230,18 +230,6 @@ static void encode_json(const char *name, const T& val, Formatter *f)
f->close_section();
}
-template<class T>
-static void encode_json(const char *name, const std::list<T>& l, Formatter *f)
-{
- f->open_array_section(name);
- for (typename std::list<T>::const_iterator iter = l.begin(); iter != l.end(); ++iter) {
- f->open_object_section("obj");
- encode_json(name, *iter, f);
- f->close_section();
- }
- f->close_section();
-}
-
class utime_t;
void encode_json(const char *name, const string& val, Formatter *f);
@@ -253,6 +241,27 @@ void encode_json(const char *name, unsigned long val, Formatter *f);
void encode_json(const char *name, const utime_t& val, Formatter *f);
void encode_json(const char *name, const bufferlist& bl, Formatter *f);
+template<class T>
+static void encode_json(const char *name, const std::list<T>& l, Formatter *f)
+{
+ f->open_array_section(name);
+ for (typename std::list<T>::const_iterator iter = l.begin(); iter != l.end(); ++iter) {
+ encode_json("obj", *iter, f);
+ }
+ f->close_section();
+}
+
+template<class K, class V>
+void encode_json(const char *name, const map<K, V>& m, Formatter *f)
+{
+ f->open_array_section(name);
+ typename map<K,V>::const_iterator iter;
+ for (iter = m.begin(); iter != m.end(); ++iter) {
+ encode_json("obj", iter->second, f);
+ }
+ f->close_section();
+}
+
template<class K, class V>
void encode_json_map(const char *name, const char *index_name,
const char *object_name, const char *value_name,