File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -273,6 +273,16 @@ Json::Value obj_value(Json::objectValue); // {}
273
273
double asDouble () const ;
274
274
bool asBool () const ;
275
275
276
+ operator const char *() const ;
277
+ operator std::string () const ;
278
+ operator Int () const ;
279
+ operator UInt () const ;
280
+ operator Int64 () const ;
281
+ operator UInt64 () const ;
282
+ operator float () const ;
283
+ operator double () const ;
284
+ operator bool () const ;
285
+
276
286
bool isNull () const ;
277
287
bool isBool () const ;
278
288
bool isInt () const ;
Original file line number Diff line number Diff line change @@ -795,6 +795,42 @@ bool Value::asBool() const {
795
795
JSON_FAIL_MESSAGE (" Value is not convertible to bool." );
796
796
}
797
797
798
+ Value::operator const char *() const {
799
+ return Value::asCString ();
800
+ }
801
+
802
+ Value::operator std::string () const {
803
+ return Value::asString ();
804
+ }
805
+
806
+ Value::operator Int () const {
807
+ return Value::asInt ();
808
+ }
809
+
810
+ Value::operator UInt () const {
811
+ return Value::asUInt ();
812
+ }
813
+
814
+ Value::operator Int64 () const {
815
+ return Value::asInt64 ();
816
+ }
817
+
818
+ Value::operator UInt64 () const {
819
+ return Value::asUInt64 ();
820
+ }
821
+
822
+ Value::operator float () const {
823
+ return Value::asFloat ();
824
+ }
825
+
826
+ Value::operator double () const {
827
+ return Value::asDouble ();
828
+ }
829
+
830
+ Value::operator bool () const {
831
+ return Value::asBool ();
832
+ }
833
+
798
834
bool Value::isConvertibleTo (ValueType other) const {
799
835
switch (other) {
800
836
case nullValue:
You can’t perform that action at this time.
0 commit comments