|
|
|
|
23
|
switch (var.ValueType())
|
23
|
switch (var.ValueType())
|
24
|
{
|
24
|
{
|
25
|
case DKVariant::TypeUndefined:
|
25
|
case DKVariant::TypeUndefined:
|
26
|
- DKLog("%s %ls (Undefined)", ind, (const wchar_t*)name);
|
|
|
|
|
26
|
+ DKLog("%s \"%ls\" (Undefined)", ind, (const wchar_t*)name);
|
27
|
break;
|
27
|
break;
|
28
|
case DKVariant::TypeInteger:
|
28
|
case DKVariant::TypeInteger:
|
29
|
- DKLog("%s %ls (Integer) : %lld", ind, (const wchar_t*)name, var.Integer());
|
|
|
|
|
29
|
+ DKLog("%s \"%ls\" (Integer) : %lld", ind, (const wchar_t*)name, var.Integer());
|
30
|
break;
|
30
|
break;
|
31
|
case DKVariant::TypeFloat:
|
31
|
case DKVariant::TypeFloat:
|
32
|
- DKLog("%s %ls (Float) : %f", ind, (const wchar_t*)name, var.Float());
|
|
|
|
|
32
|
+ DKLog("%s \"%ls\" (Float) : %f", ind, (const wchar_t*)name, var.Float());
|
33
|
break;
|
33
|
break;
|
34
|
case DKVariant::TypeVector2:
|
34
|
case DKVariant::TypeVector2:
|
35
|
- DKLog("%s %ls (Vector2)", ind, (const wchar_t*)name);
|
|
|
|
|
35
|
+ DKLog("%s \"%ls\" (Vector2)", ind, (const wchar_t*)name);
|
36
|
break;
|
36
|
break;
|
37
|
case DKVariant::TypeVector3:
|
37
|
case DKVariant::TypeVector3:
|
38
|
- DKLog("%s %ls (Vector3)", ind, (const wchar_t*)name);
|
|
|
|
|
38
|
+ DKLog("%s \"%ls\" (Vector3)", ind, (const wchar_t*)name);
|
39
|
break;
|
39
|
break;
|
40
|
case DKVariant::TypeVector4:
|
40
|
case DKVariant::TypeVector4:
|
41
|
- DKLog("%s %ls (Vector4)", ind, (const wchar_t*)name);
|
|
|
|
|
41
|
+ DKLog("%s \"%ls\" (Vector4)", ind, (const wchar_t*)name);
|
42
|
break;
|
42
|
break;
|
43
|
case DKVariant::TypeMatrix2:
|
43
|
case DKVariant::TypeMatrix2:
|
44
|
- DKLog("%s %ls (Matrix2x2)", ind, (const wchar_t*)name);
|
|
|
|
|
44
|
+ DKLog("%s \"%ls\" (Matrix2x2)", ind, (const wchar_t*)name);
|
45
|
break;
|
45
|
break;
|
46
|
case DKVariant::TypeMatrix3:
|
46
|
case DKVariant::TypeMatrix3:
|
47
|
- DKLog("%s %ls (Matrix3x3)", ind, (const wchar_t*)name);
|
|
|
|
|
47
|
+ DKLog("%s \"%ls\" (Matrix3x3)", ind, (const wchar_t*)name);
|
48
|
break;
|
48
|
break;
|
49
|
case DKVariant::TypeMatrix4:
|
49
|
case DKVariant::TypeMatrix4:
|
50
|
- DKLog("%s %ls (Matrix4x4)", ind, (const wchar_t*)name);
|
|
|
|
|
50
|
+ DKLog("%s \"%ls\" (Matrix4x4)", ind, (const wchar_t*)name);
|
51
|
break;
|
51
|
break;
|
52
|
case DKVariant::TypeQuaternion:
|
52
|
case DKVariant::TypeQuaternion:
|
53
|
- DKLog("%s %ls (Quat)", ind, (const wchar_t*)name);
|
|
|
|
|
53
|
+ DKLog("%s \"%ls\" (Quat)", ind, (const wchar_t*)name);
|
54
|
break;
|
54
|
break;
|
55
|
case DKVariant::TypeRational:
|
55
|
case DKVariant::TypeRational:
|
56
|
- DKLog("%s %ls (Rational) %lld / %lld", ind, (const wchar_t*)name, var.Rational().Numerator(), var.Rational().Denominator());
|
|
|
|
|
56
|
+ DKLog("%s \"%ls\" (Rational) %lld / %lld", ind, (const wchar_t*)name, var.Rational().Numerator(), var.Rational().Denominator());
|
57
|
break;
|
57
|
break;
|
58
|
case DKVariant::TypeString:
|
58
|
case DKVariant::TypeString:
|
59
|
- DKLog("%s %ls (String) : %ls", ind, (const wchar_t*)name, (const wchar_t*)var.String());
|
|
|
|
|
59
|
+ DKLog("%s \"%ls\" (String) : %ls", ind, (const wchar_t*)name, (const wchar_t*)var.String());
|
60
|
break;
|
60
|
break;
|
61
|
case DKVariant::TypeDateTime:
|
61
|
case DKVariant::TypeDateTime:
|
62
|
- DKLog("%s %ls (DateTime)", ind, (const wchar_t*)name);
|
|
|
|
|
62
|
+ DKLog("%s \"%ls\" (DateTime)", ind, (const wchar_t*)name);
|
63
|
break;
|
63
|
break;
|
64
|
case DKVariant::TypeData:
|
64
|
case DKVariant::TypeData:
|
65
|
- DKLog("%s %ls (Data)", ind, (const wchar_t*)name);
|
|
|
|
|
65
|
+ DKLog("%s \"%ls\" (Data)", ind, (const wchar_t*)name);
|
66
|
break;
|
66
|
break;
|
67
|
case DKVariant::TypeStructData:
|
67
|
case DKVariant::TypeStructData:
|
68
|
- DKLog("%s %ls (StructData)", ind, (const wchar_t*)name);
|
|
|
|
|
68
|
+ DKLog("%s \"%ls\" (StructData)", ind, (const wchar_t*)name);
|
69
|
break;
|
69
|
break;
|
70
|
case DKVariant::TypeArray:
|
70
|
case DKVariant::TypeArray:
|
71
|
- DKLog("%s %ls (Array)", ind, (const wchar_t*)name);
|
|
|
|
|
71
|
+ DKLog("%s \"%ls\" (Array)", ind, (const wchar_t*)name);
|
72
|
for (int i = 0; i < var.Array().Count(); ++i)
|
72
|
for (int i = 0; i < var.Array().Count(); ++i)
|
73
|
{
|
73
|
{
|
74
|
const DKVariant& sub = var.Array().Value(i);
|
74
|
const DKVariant& sub = var.Array().Value(i);
|
|
|
|
|
76
|
}
|
76
|
}
|
77
|
break;
|
77
|
break;
|
78
|
case DKVariant::TypePairs:
|
78
|
case DKVariant::TypePairs:
|
79
|
- DKLog("%s %ls (Pairs)", ind, (const wchar_t*)name);
|
|
|
|
|
79
|
+ DKLog("%s \"%ls\" (Pairs)", ind, (const wchar_t*)name);
|
80
|
var.Pairs().EnumerateForward([indent](const DKVariant::VPairs::Pair& pair)
|
80
|
var.Pairs().EnumerateForward([indent](const DKVariant::VPairs::Pair& pair)
|
81
|
{
|
81
|
{
|
82
|
PrintVariant(pair.key, pair.value, indent+4);
|
82
|
PrintVariant(pair.key, pair.value, indent+4);
|
|
|
|
|
103
|
|
103
|
|
104
|
DKVariant::VPairs& root = prop.Pairs();
|
104
|
DKVariant::VPairs& root = prop.Pairs();
|
105
|
DKVariant::VPairs& sub1 = root.Value("Sub1").Pairs();
|
105
|
DKVariant::VPairs& sub1 = root.Value("Sub1").Pairs();
|
106
|
-
|
|
|
|
|
106
|
+ DKVariant::VPairs& sub1ss1 = sub1.Value("SS1").Pairs();
|
|
|
107
|
+ DKVariant::VPairs& sub1ss2 = sub1.Value("SS2").Pairs();
|
|
|
108
|
+ DKVariant::VPairs& sub1ss3 = sub1.Value("SS3").Pairs();
|
107
|
|
109
|
|
108
|
DKVariant::VPairs& sub2 = root.Value("Sub2").Pairs();
|
110
|
DKVariant::VPairs& sub2 = root.Value("Sub2").Pairs();
|
|
|
111
|
+ DKVariant::VPairs& sub2ss1 = sub2.Value("SS1").Pairs();
|
|
|
112
|
+ DKVariant::VPairs& sub2ss2 = sub2.Value("SS2").Pairs();
|
|
|
113
|
+ DKVariant::VPairs& sub2ss2hid = sub2ss2.Value("").Pairs();
|
|
|
114
|
+ sub2ss2hid.Value("VV2").String() = "hidden";
|
|
|
115
|
+
|
|
|
116
|
+ sub2.Value("SS2.VV2").String() = "Better";
|
|
|
117
|
+
|
|
|
118
|
+ sub2ss2.Value("VV1").Integer() = 0;
|
|
|
119
|
+ sub2ss2.Value("VV2").String() = "Good";
|
|
|
120
|
+
|
|
|
121
|
+ DKVariant::VPairs& sub2ss3 = sub2.Value("SS3").Pairs();
|
|
|
122
|
+
|
109
|
DKVariant::VInteger& sub3 = root.Value("Sub3").Integer();
|
123
|
DKVariant::VInteger& sub3 = root.Value("Sub3").Integer();
|
|
|
124
|
+ root.Value("Sub2.SS2.VV2.KK").String() = "Bad1";
|
|
|
125
|
+ root.Value("Sub2.SS2.VV2.").String() = "Bad2";
|
|
|
126
|
+ root.Value("Sub2.SS2.VV2").String() = "Best";
|
110
|
|
127
|
|
111
|
PrintVariant("ROOT", prop);
|
128
|
PrintVariant("ROOT", prop);
|
|
|
129
|
+ DKLog("-------------------");
|
|
|
130
|
+ DKString findKey = "Sub2.SS2.VV2";
|
|
|
131
|
+ bool b = prop.FindObjectAtKeyPath(findKey, DKFunction([&](DKVariant& var)
|
|
|
132
|
+ {
|
|
|
133
|
+ PrintVariant(DKString::Format("(%ls)", (const wchar_t*)findKey), var);
|
|
|
134
|
+ return false;
|
|
|
135
|
+ }));
|
|
|
136
|
+ DKLog("FindObjectAtKeyPath result: %d", (int)b);
|
112
|
|
137
|
|
113
|
|
138
|
|
114
|
return 0;
|
139
|
return 0;
|