Mercurial > hg > orthanc-stone
comparison Resources/CodeGeneration/template.in.h @ 499:baa9e1e932db bgo-commands-codegen
wasm + ts demonstrator WORKS!
author | bgo-osimis |
---|---|
date | Sun, 24 Feb 2019 20:22:56 +0100 |
parents | 6405435480ae |
children | ce49eae4c887 |
comparison
equal
deleted
inserted
replaced
498:6d62fc8a6988 | 499:baa9e1e932db |
---|---|
9 #include <sstream> | 9 #include <sstream> |
10 #include <assert.h> | 10 #include <assert.h> |
11 #include <memory> | 11 #include <memory> |
12 #include <optional> | 12 #include <optional> |
13 #include <json/json.h> | 13 #include <json/json.h> |
14 #include <gtest/gtest.h> | |
15 | 14 |
16 //#define STONEGEN_NO_CPP11 1 | 15 //#define STONEGEN_NO_CPP11 1 |
17 | 16 |
18 #ifdef STONEGEN_NO_CPP11 | 17 #ifdef STONEGEN_NO_CPP11 |
19 #define StoneSmartPtr std::auto_ptr | 18 #define StoneSmartPtr std::auto_ptr |
124 template<typename T> | 123 template<typename T> |
125 Json::Value _StoneSerializeValue(const std::map<std::string,T>& value) | 124 Json::Value _StoneSerializeValue(const std::map<std::string,T>& value) |
126 { | 125 { |
127 Json::Value result(Json::objectValue); | 126 Json::Value result(Json::objectValue); |
128 | 127 |
129 for (std::map<std::string, T>::const_iterator it = value.cbegin(); | 128 for (typename std::map<std::string, T>::const_iterator it = value.cbegin(); |
130 it != value.cend(); ++it) | 129 it != value.cend(); ++it) |
131 { | 130 { |
132 // it->first it->second | 131 // it->first it->second |
133 result[it->first] = _StoneSerializeValue(it->second); | 132 result[it->first] = _StoneSerializeValue(it->second); |
134 } | 133 } |
137 | 136 |
138 template<typename T> | 137 template<typename T> |
139 std::ostream& StoneDumpValue(std::ostream& out, const std::map<std::string,T>& value, int indent) | 138 std::ostream& StoneDumpValue(std::ostream& out, const std::map<std::string,T>& value, int indent) |
140 { | 139 { |
141 out << MakeIndent(indent) << "{\n"; | 140 out << MakeIndent(indent) << "{\n"; |
142 for (std::map<std::string, T>::const_iterator it = value.cbegin(); | 141 for (typename std::map<std::string, T>::const_iterator it = value.cbegin(); |
143 it != value.cend(); ++it) | 142 it != value.cend(); ++it) |
144 { | 143 { |
145 out << MakeIndent(indent+2) << "\"" << it->first << "\" : "; | 144 out << MakeIndent(indent+2) << "\"" << it->first << "\" : "; |
146 StoneDumpValue(out, it->second, indent+2); | 145 StoneDumpValue(out, it->second, indent+2); |
147 } | 146 } |