Mercurial > hg > orthanc-stone
annotate Applications/Samples/StoneSampleCommands_generated.hpp @ 1221:e2435a524029
merge
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Sat, 07 Dec 2019 17:47:35 +0100 |
parents | 4eccf698e52f |
children | 8a0a62189f46 |
rev | line source |
---|---|
653
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
1 /* |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
2 1 2 3 4 5 6 7 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
3 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
4 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
5 Generated on 2019-03-18 12:07:42.696093 by stonegentool |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
6 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
7 */ |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
8 #pragma once |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
9 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
10 #include <exception> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
11 #include <iostream> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
12 #include <string> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
13 #include <sstream> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
14 #include <assert.h> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
15 #include <memory> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
16 #include <json/json.h> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
17 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
18 //#define STONEGEN_NO_CPP11 1 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
19 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
20 #ifdef STONEGEN_NO_CPP11 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
21 #define StoneSmartPtr std::auto_ptr |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
22 #else |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
23 #define StoneSmartPtr std::unique_ptr |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
24 #endif |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
25 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
26 namespace StoneSampleCommands |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
27 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
28 /** Throws in case of problem */ |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
29 inline void _StoneDeserializeValue(int32_t& destValue, const Json::Value& jsonValue) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
30 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
31 destValue = jsonValue.asInt(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
32 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
33 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
34 inline Json::Value _StoneSerializeValue(int32_t value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
35 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
36 Json::Value result(value); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
37 return result; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
38 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
39 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
40 inline void _StoneDeserializeValue(Json::Value& destValue, const Json::Value& jsonValue) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
41 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
42 destValue = jsonValue; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
43 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
44 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
45 inline Json::Value _StoneSerializeValue(Json::Value value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
46 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
47 return value; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
48 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
49 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
50 /** Throws in case of problem */ |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
51 inline void _StoneDeserializeValue(double& destValue, const Json::Value& jsonValue) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
52 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
53 destValue = jsonValue.asDouble(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
54 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
55 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
56 inline Json::Value _StoneSerializeValue(double value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
57 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
58 Json::Value result(value); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
59 return result; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
60 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
61 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
62 /** Throws in case of problem */ |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
63 inline void _StoneDeserializeValue(bool& destValue, const Json::Value& jsonValue) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
64 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
65 destValue = jsonValue.asBool(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
66 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
67 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
68 inline Json::Value _StoneSerializeValue(bool value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
69 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
70 Json::Value result(value); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
71 return result; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
72 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
73 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
74 /** Throws in case of problem */ |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
75 inline void _StoneDeserializeValue( |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
76 std::string& destValue |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
77 , const Json::Value& jsonValue) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
78 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
79 destValue = jsonValue.asString(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
80 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
81 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
82 inline Json::Value _StoneSerializeValue(const std::string& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
83 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
84 // the following is better than |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
85 Json::Value result(value.data(),value.data()+value.size()); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
86 return result; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
87 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
88 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
89 inline std::string MakeIndent(size_t indent) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
90 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
91 char* txt = reinterpret_cast<char*>(malloc(indent+1)); // NO EXCEPTION BELOW!!!!!!!!!!!! |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
92 for(size_t i = 0; i < indent; ++i) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
93 txt[i] = ' '; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
94 txt[indent] = 0; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
95 std::string retVal(txt); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
96 free(txt); // NO EXCEPTION ABOVE !!!!!!!!!! |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
97 return retVal; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
98 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
99 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
100 // generic dumper |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
101 template<typename T> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
102 std::ostream& StoneDumpValue(std::ostream& out, const T& value, size_t indent) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
103 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
104 out << MakeIndent(indent) << value; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
105 return out; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
106 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
107 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
108 // string dumper |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
109 inline std::ostream& StoneDumpValue(std::ostream& out, const std::string& value, size_t indent) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
110 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
111 out << MakeIndent(indent) << "\"" << value << "\""; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
112 return out; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
113 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
114 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
115 /** Throws in case of problem */ |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
116 template<typename T> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
117 void _StoneDeserializeValue( |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
118 std::map<std::string, T>& destValue, const Json::Value& jsonValue) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
119 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
120 destValue.clear(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
121 for ( |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
122 Json::Value::const_iterator itr = jsonValue.begin(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
123 itr != jsonValue.end(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
124 itr++) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
125 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
126 std::string key; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
127 _StoneDeserializeValue(key, itr.key()); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
128 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
129 T innerDestValue; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
130 _StoneDeserializeValue(innerDestValue, *itr); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
131 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
132 destValue[key] = innerDestValue; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
133 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
134 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
135 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
136 template<typename T> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
137 Json::Value _StoneSerializeValue(const std::map<std::string,T>& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
138 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
139 Json::Value result(Json::objectValue); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
140 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
141 for (typename std::map<std::string, T>::const_iterator it = value.cbegin(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
142 it != value.cend(); ++it) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
143 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
144 // it->first it->second |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
145 result[it->first] = _StoneSerializeValue(it->second); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
146 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
147 return result; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
148 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
149 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
150 template<typename T> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
151 std::ostream& StoneDumpValue(std::ostream& out, const std::map<std::string,T>& value, size_t indent) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
152 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
153 out << MakeIndent(indent) << "{\n"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
154 for (typename std::map<std::string, T>::const_iterator it = value.cbegin(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
155 it != value.cend(); ++it) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
156 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
157 out << MakeIndent(indent+2) << "\"" << it->first << "\" : "; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
158 StoneDumpValue(out, it->second, indent+2); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
159 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
160 out << MakeIndent(indent) << "}\n"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
161 return out; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
162 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
163 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
164 /** Throws in case of problem */ |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
165 template<typename T> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
166 void _StoneDeserializeValue( |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
167 std::vector<T>& destValue, const Json::Value& jsonValue) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
168 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
169 destValue.clear(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
170 destValue.reserve(jsonValue.size()); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
171 for (Json::Value::ArrayIndex i = 0; i != jsonValue.size(); i++) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
172 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
173 T innerDestValue; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
174 _StoneDeserializeValue(innerDestValue, jsonValue[i]); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
175 destValue.push_back(innerDestValue); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
176 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
177 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
178 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
179 template<typename T> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
180 Json::Value _StoneSerializeValue(const std::vector<T>& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
181 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
182 Json::Value result(Json::arrayValue); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
183 for (size_t i = 0; i < value.size(); ++i) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
184 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
185 result.append(_StoneSerializeValue(value[i])); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
186 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
187 return result; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
188 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
189 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
190 template<typename T> |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
191 std::ostream& StoneDumpValue(std::ostream& out, const std::vector<T>& value, size_t indent) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
192 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
193 out << MakeIndent(indent) << "[\n"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
194 for (size_t i = 0; i < value.size(); ++i) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
195 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
196 StoneDumpValue(out, value[i], indent+2); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
197 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
198 out << MakeIndent(indent) << "]\n"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
199 return out; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
200 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
201 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
202 inline void StoneCheckSerializedValueTypeGeneric(const Json::Value& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
203 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
204 if ((!value.isMember("type")) || (!value["type"].isString())) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
205 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
206 std::stringstream ss; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
207 ss << "Cannot deserialize value ('type' key invalid)"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
208 throw std::runtime_error(ss.str()); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
209 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
210 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
211 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
212 inline void StoneCheckSerializedValueType( |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
213 const Json::Value& value, std::string typeStr) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
214 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
215 StoneCheckSerializedValueTypeGeneric(value); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
216 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
217 std::string actTypeStr = value["type"].asString(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
218 if (actTypeStr != typeStr) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
219 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
220 std::stringstream ss; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
221 ss << "Cannot deserialize type" << actTypeStr |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
222 << "into " << typeStr; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
223 throw std::runtime_error(ss.str()); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
224 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
225 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
226 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
227 // end of generic methods |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
228 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
229 // end of generic methods |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
230 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
231 enum Tool { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
232 Tool_LineMeasure, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
233 Tool_CircleMeasure, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
234 Tool_Crop, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
235 Tool_Windowing, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
236 Tool_Zoom, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
237 Tool_Pan, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
238 Tool_Move, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
239 Tool_Rotate, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
240 Tool_Resize, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
241 Tool_Mask, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
242 }; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
243 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
244 inline std::string ToString(const Tool& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
245 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
246 if( value == Tool_LineMeasure) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
247 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
248 return std::string("LineMeasure"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
249 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
250 if( value == Tool_CircleMeasure) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
251 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
252 return std::string("CircleMeasure"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
253 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
254 if( value == Tool_Crop) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
255 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
256 return std::string("Crop"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
257 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
258 if( value == Tool_Windowing) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
259 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
260 return std::string("Windowing"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
261 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
262 if( value == Tool_Zoom) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
263 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
264 return std::string("Zoom"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
265 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
266 if( value == Tool_Pan) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
267 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
268 return std::string("Pan"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
269 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
270 if( value == Tool_Move) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
271 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
272 return std::string("Move"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
273 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
274 if( value == Tool_Rotate) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
275 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
276 return std::string("Rotate"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
277 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
278 if( value == Tool_Resize) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
279 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
280 return std::string("Resize"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
281 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
282 if( value == Tool_Mask) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
283 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
284 return std::string("Mask"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
285 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
286 std::stringstream ss; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
287 ss << "Value \"" << value << "\" cannot be converted to Tool. Possible values are: " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
288 << " LineMeasure = " << static_cast<int64_t>(Tool_LineMeasure) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
289 << " CircleMeasure = " << static_cast<int64_t>(Tool_CircleMeasure) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
290 << " Crop = " << static_cast<int64_t>(Tool_Crop) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
291 << " Windowing = " << static_cast<int64_t>(Tool_Windowing) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
292 << " Zoom = " << static_cast<int64_t>(Tool_Zoom) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
293 << " Pan = " << static_cast<int64_t>(Tool_Pan) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
294 << " Move = " << static_cast<int64_t>(Tool_Move) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
295 << " Rotate = " << static_cast<int64_t>(Tool_Rotate) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
296 << " Resize = " << static_cast<int64_t>(Tool_Resize) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
297 << " Mask = " << static_cast<int64_t>(Tool_Mask) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
298 << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
299 std::string msg = ss.str(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
300 throw std::runtime_error(msg); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
301 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
302 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
303 inline void FromString(Tool& value, std::string strValue) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
304 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
305 if( strValue == std::string("LineMeasure") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
306 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
307 value = Tool_LineMeasure; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
308 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
309 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
310 if( strValue == std::string("CircleMeasure") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
311 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
312 value = Tool_CircleMeasure; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
313 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
314 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
315 if( strValue == std::string("Crop") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
316 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
317 value = Tool_Crop; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
318 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
319 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
320 if( strValue == std::string("Windowing") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
321 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
322 value = Tool_Windowing; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
323 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
324 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
325 if( strValue == std::string("Zoom") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
326 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
327 value = Tool_Zoom; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
328 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
329 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
330 if( strValue == std::string("Pan") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
331 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
332 value = Tool_Pan; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
333 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
334 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
335 if( strValue == std::string("Move") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
336 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
337 value = Tool_Move; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
338 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
339 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
340 if( strValue == std::string("Rotate") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
341 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
342 value = Tool_Rotate; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
343 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
344 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
345 if( strValue == std::string("Resize") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
346 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
347 value = Tool_Resize; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
348 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
349 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
350 if( strValue == std::string("Mask") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
351 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
352 value = Tool_Mask; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
353 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
354 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
355 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
356 std::stringstream ss; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
357 ss << "String \"" << strValue << "\" cannot be converted to Tool. Possible values are: LineMeasure CircleMeasure Crop Windowing Zoom Pan Move Rotate Resize Mask "; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
358 std::string msg = ss.str(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
359 throw std::runtime_error(msg); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
360 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
361 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
362 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
363 inline void _StoneDeserializeValue( |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
364 Tool& destValue, const Json::Value& jsonValue) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
365 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
366 FromString(destValue, jsonValue.asString()); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
367 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
368 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
369 inline Json::Value _StoneSerializeValue(const Tool& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
370 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
371 std::string strValue = ToString(value); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
372 return Json::Value(strValue); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
373 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
374 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
375 inline std::ostream& StoneDumpValue(std::ostream& out, const Tool& value, size_t indent = 0) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
376 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
377 if( value == Tool_LineMeasure) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
378 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
379 out << MakeIndent(indent) << "LineMeasure" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
380 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
381 if( value == Tool_CircleMeasure) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
382 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
383 out << MakeIndent(indent) << "CircleMeasure" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
384 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
385 if( value == Tool_Crop) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
386 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
387 out << MakeIndent(indent) << "Crop" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
388 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
389 if( value == Tool_Windowing) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
390 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
391 out << MakeIndent(indent) << "Windowing" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
392 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
393 if( value == Tool_Zoom) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
394 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
395 out << MakeIndent(indent) << "Zoom" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
396 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
397 if( value == Tool_Pan) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
398 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
399 out << MakeIndent(indent) << "Pan" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
400 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
401 if( value == Tool_Move) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
402 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
403 out << MakeIndent(indent) << "Move" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
404 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
405 if( value == Tool_Rotate) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
406 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
407 out << MakeIndent(indent) << "Rotate" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
408 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
409 if( value == Tool_Resize) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
410 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
411 out << MakeIndent(indent) << "Resize" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
412 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
413 if( value == Tool_Mask) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
414 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
415 out << MakeIndent(indent) << "Mask" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
416 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
417 return out; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
418 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
419 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
420 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
421 enum ActionType { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
422 ActionType_UndoCrop, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
423 ActionType_Rotate, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
424 ActionType_Invert, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
425 }; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
426 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
427 inline std::string ToString(const ActionType& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
428 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
429 if( value == ActionType_UndoCrop) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
430 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
431 return std::string("UndoCrop"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
432 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
433 if( value == ActionType_Rotate) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
434 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
435 return std::string("Rotate"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
436 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
437 if( value == ActionType_Invert) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
438 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
439 return std::string("Invert"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
440 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
441 std::stringstream ss; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
442 ss << "Value \"" << value << "\" cannot be converted to ActionType. Possible values are: " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
443 << " UndoCrop = " << static_cast<int64_t>(ActionType_UndoCrop) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
444 << " Rotate = " << static_cast<int64_t>(ActionType_Rotate) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
445 << " Invert = " << static_cast<int64_t>(ActionType_Invert) << ", " |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
446 << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
447 std::string msg = ss.str(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
448 throw std::runtime_error(msg); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
449 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
450 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
451 inline void FromString(ActionType& value, std::string strValue) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
452 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
453 if( strValue == std::string("UndoCrop") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
454 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
455 value = ActionType_UndoCrop; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
456 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
457 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
458 if( strValue == std::string("Rotate") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
459 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
460 value = ActionType_Rotate; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
461 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
462 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
463 if( strValue == std::string("Invert") ) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
464 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
465 value = ActionType_Invert; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
466 return; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
467 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
468 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
469 std::stringstream ss; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
470 ss << "String \"" << strValue << "\" cannot be converted to ActionType. Possible values are: UndoCrop Rotate Invert "; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
471 std::string msg = ss.str(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
472 throw std::runtime_error(msg); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
473 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
474 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
475 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
476 inline void _StoneDeserializeValue( |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
477 ActionType& destValue, const Json::Value& jsonValue) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
478 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
479 FromString(destValue, jsonValue.asString()); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
480 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
481 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
482 inline Json::Value _StoneSerializeValue(const ActionType& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
483 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
484 std::string strValue = ToString(value); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
485 return Json::Value(strValue); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
486 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
487 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
488 inline std::ostream& StoneDumpValue(std::ostream& out, const ActionType& value, size_t indent = 0) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
489 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
490 if( value == ActionType_UndoCrop) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
491 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
492 out << MakeIndent(indent) << "UndoCrop" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
493 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
494 if( value == ActionType_Rotate) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
495 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
496 out << MakeIndent(indent) << "Rotate" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
497 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
498 if( value == ActionType_Invert) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
499 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
500 out << MakeIndent(indent) << "Invert" << std::endl; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
501 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
502 return out; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
503 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
504 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
505 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
506 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
507 #ifdef _MSC_VER |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
508 #pragma region SelectTool |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
509 #endif //_MSC_VER |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
510 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
511 struct SelectTool |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
512 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
513 Tool tool; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
514 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
515 SelectTool(Tool tool = Tool()) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
516 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
517 this->tool = tool; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
518 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
519 }; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
520 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
521 inline void _StoneDeserializeValue(SelectTool& destValue, const Json::Value& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
522 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
523 _StoneDeserializeValue(destValue.tool, value["tool"]); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
524 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
525 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
526 inline Json::Value _StoneSerializeValue(const SelectTool& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
527 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
528 Json::Value result(Json::objectValue); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
529 result["tool"] = _StoneSerializeValue(value.tool); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
530 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
531 return result; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
532 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
533 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
534 inline std::ostream& StoneDumpValue(std::ostream& out, const SelectTool& value, size_t indent = 0) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
535 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
536 out << MakeIndent(indent) << "{\n"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
537 out << MakeIndent(indent) << "tool:\n"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
538 StoneDumpValue(out, value.tool,indent+2); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
539 out << "\n"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
540 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
541 out << MakeIndent(indent) << "}\n"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
542 return out; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
543 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
544 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
545 inline void StoneDeserialize(SelectTool& destValue, const Json::Value& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
546 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
547 StoneCheckSerializedValueType(value, "StoneSampleCommands.SelectTool"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
548 _StoneDeserializeValue(destValue, value["value"]); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
549 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
550 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
551 inline Json::Value StoneSerializeToJson(const SelectTool& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
552 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
553 Json::Value result(Json::objectValue); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
554 result["type"] = "StoneSampleCommands.SelectTool"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
555 result["value"] = _StoneSerializeValue(value); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
556 return result; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
557 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
558 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
559 inline std::string StoneSerialize(const SelectTool& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
560 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
561 Json::Value resultJson = StoneSerializeToJson(value); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
562 std::string resultStr = resultJson.toStyledString(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
563 return resultStr; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
564 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
565 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
566 #ifdef _MSC_VER |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
567 #pragma endregion SelectTool |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
568 #endif //_MSC_VER |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
569 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
570 #ifdef _MSC_VER |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
571 #pragma region Action |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
572 #endif //_MSC_VER |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
573 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
574 struct Action |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
575 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
576 ActionType type; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
577 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
578 Action(ActionType type = ActionType()) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
579 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
580 this->type = type; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
581 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
582 }; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
583 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
584 inline void _StoneDeserializeValue(Action& destValue, const Json::Value& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
585 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
586 _StoneDeserializeValue(destValue.type, value["type"]); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
587 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
588 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
589 inline Json::Value _StoneSerializeValue(const Action& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
590 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
591 Json::Value result(Json::objectValue); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
592 result["type"] = _StoneSerializeValue(value.type); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
593 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
594 return result; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
595 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
596 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
597 inline std::ostream& StoneDumpValue(std::ostream& out, const Action& value, size_t indent = 0) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
598 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
599 out << MakeIndent(indent) << "{\n"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
600 out << MakeIndent(indent) << "type:\n"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
601 StoneDumpValue(out, value.type,indent+2); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
602 out << "\n"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
603 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
604 out << MakeIndent(indent) << "}\n"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
605 return out; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
606 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
607 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
608 inline void StoneDeserialize(Action& destValue, const Json::Value& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
609 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
610 StoneCheckSerializedValueType(value, "StoneSampleCommands.Action"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
611 _StoneDeserializeValue(destValue, value["value"]); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
612 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
613 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
614 inline Json::Value StoneSerializeToJson(const Action& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
615 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
616 Json::Value result(Json::objectValue); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
617 result["type"] = "StoneSampleCommands.Action"; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
618 result["value"] = _StoneSerializeValue(value); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
619 return result; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
620 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
621 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
622 inline std::string StoneSerialize(const Action& value) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
623 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
624 Json::Value resultJson = StoneSerializeToJson(value); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
625 std::string resultStr = resultJson.toStyledString(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
626 return resultStr; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
627 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
628 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
629 #ifdef _MSC_VER |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
630 #pragma endregion Action |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
631 #endif //_MSC_VER |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
632 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
633 #ifdef _MSC_VER |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
634 #pragma region Dispatching code |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
635 #endif //_MSC_VER |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
636 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
637 class IHandler |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
638 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
639 public: |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
640 virtual bool Handle(const SelectTool& value) = 0; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
641 virtual bool Handle(const Action& value) = 0; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
642 }; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
643 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
644 /** Service function for StoneDispatchToHandler */ |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
645 inline bool StoneDispatchJsonToHandler( |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
646 const Json::Value& jsonValue, IHandler* handler) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
647 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
648 StoneCheckSerializedValueTypeGeneric(jsonValue); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
649 std::string type = jsonValue["type"].asString(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
650 if (type == "") |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
651 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
652 // this should never ever happen |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
653 throw std::runtime_error("Caught empty type while dispatching"); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
654 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
655 else if (type == "StoneSampleCommands.SelectTool") |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
656 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
657 SelectTool value; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
658 _StoneDeserializeValue(value, jsonValue["value"]); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
659 return handler->Handle(value); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
660 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
661 else if (type == "StoneSampleCommands.Action") |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
662 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
663 Action value; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
664 _StoneDeserializeValue(value, jsonValue["value"]); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
665 return handler->Handle(value); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
666 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
667 else |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
668 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
669 return false; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
670 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
671 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
672 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
673 /** Takes a serialized type and passes this to the handler */ |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
674 inline bool StoneDispatchToHandler(std::string strValue, IHandler* handler) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
675 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
676 Json::Value readValue; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
677 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
678 Json::CharReaderBuilder builder; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
679 Json::CharReader* reader = builder.newCharReader(); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
680 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
681 StoneSmartPtr<Json::CharReader> ptr(reader); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
682 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
683 std::string errors; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
684 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
685 bool ok = reader->parse( |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
686 strValue.c_str(), |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
687 strValue.c_str() + strValue.size(), |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
688 &readValue, |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
689 &errors |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
690 ); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
691 if (!ok) |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
692 { |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
693 std::stringstream ss; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
694 ss << "Jsoncpp parsing error: " << errors; |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
695 throw std::runtime_error(ss.str()); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
696 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
697 return StoneDispatchJsonToHandler(readValue, handler); |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
698 } |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
699 |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
700 #ifdef _MSC_VER |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
701 #pragma endregion Dispatching code |
4eccf698e52f
Fixed CRLF to LF in various files (found through grepping the source tree)
Benjamin Golinvaux <bgo@osimis.io>
parents:
535
diff
changeset
|
702 #endif //_MSC_VER |
527
b1377625e4ba
Removed ICommand and friends + fixed warnings + added missing header files in
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
703 } |