Browse Source

add allowAdditionalAttributes to Json ObjectValidationBuilder

Kolja Strohm 1 year ago
parent
commit
1a6938235e
6 changed files with 94 additions and 82 deletions
  1. 22 22
      DX12PixelShader.h
  2. 17 17
      DX12VertexShader.h
  3. 11 5
      JSON.cpp
  4. 6 0
      JSON.h
  5. 23 23
      UIPixelShader.h
  6. 15 15
      UIVertexShader.h

+ 22 - 22
DX12PixelShader.h

@@ -92,10 +92,10 @@ ret
 
 const BYTE DX12PixelShaderBytes[] =
 {
-     68,  88,  66,  67, 130, 118, 
-     55, 198, 119, 198,  66,  41, 
-    214, 197,  90,  55,  12,  26, 
-     41, 189,   1,   0,   0,   0, 
+     68,  88,  66,  67,  51,  95, 
+    152,   5,  67,  55, 107,  35, 
+     66, 116, 138,  54,  37, 239, 
+    105,  45,   1,   0,   0,   0, 
     184,  91,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
      36,   2,   0,   0, 188,   2, 
@@ -763,11 +763,11 @@ const BYTE DX12PixelShaderBytes[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0, 148,  46, 
-     49,   1, 117, 255, 241,  99, 
-      1,   0,   0,   0,  86,  57, 
-    173, 209,  65,  69, 253,  66, 
-    164, 223,  93,  14, 137, 186, 
-     22,  14,   0,   0,   0,   0, 
+     49,   1,  96, 170, 198, 100, 
+      1,   0,   0,   0, 251, 146, 
+     17, 144, 143, 231, 245,  73, 
+    151,  36,  52,  46, 175,   0, 
+     39, 197,   0,   0,   0,   0, 
       0,   0,   0,   0,   1,   0, 
       0,   0,   1,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -938,10 +938,10 @@ const BYTE DX12PixelShaderBytes[] =
       3,   0, 242,  56,   1,   0, 
      43, 236,   3,   0,  28,  19, 
       2,   0,  65,  36,   1,   0, 
-    236, 179,   1,   0, 183, 203, 
-      0,   0, 125,  10,   2,   0, 
-    125, 181,   2,   0, 245,  69, 
-      1,   0, 193,  33,   3,   0, 
+    236, 179,   1,   0,  14,  16, 
+      2,   0, 125,  10,   2,   0, 
+    125, 181,   2,   0,  84, 254, 
+      3,   0, 193,  33,   3,   0, 
      65, 185,   2,   0, 140, 239, 
       1,   0, 246,  49,   0,   0, 
     213, 255,   0,   0,  46, 248, 
@@ -1788,7 +1788,7 @@ const BYTE DX12PixelShaderBytes[] =
     117, 114, 101,  50,  68,  32, 
     115, 104,  97, 100,  27, 226, 
      48,   1, 128,   0,   0,   0, 
-    239, 173, 245,  71,  80,  68, 
+    218, 234, 165, 201,  18, 195, 
     217,   1,   1,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -2348,14 +2348,14 @@ const BYTE DX12PixelShaderBytes[] =
       0,   0,  23,   0,   1,   0, 
       5,  16,   0,   0,  14,   0, 
      23,  21,   0,  16,   0,   0, 
-      3,   2, 112,  32,   0,   0, 
+      3,   2,  16,  78,   0,   0, 
     242, 241,  10,   0,  24,  21, 
       8,  16,   0,   0,   1,   0, 
       1,   0,  10,   0,  24,  21, 
       9,  16,   0,   0,   1,   0, 
       0,   2,  14,   0,  23,  21, 
       0,   0,   0,   0,  10,   2, 
-    112,  32,   0,   0, 242, 241, 
+     16,  78,   0,   0, 242, 241, 
      10,   0,  24,  21,  11,  16, 
       0,   0,   1,   0,   1,   0, 
      10,   0,  24,  21,  12,  16, 
@@ -3408,11 +3408,11 @@ const BYTE DX12PixelShaderBytes[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
-    148,  46,  49,   1, 117, 255, 
-    241,  99,   1,   0,   0,   0, 
-     86,  57, 173, 209,  65,  69, 
-    253,  66, 164, 223,  93,  14, 
-    137, 186,  22,  14, 128,   0, 
+    148,  46,  49,   1,  96, 170, 
+    198, 100,   1,   0,   0,   0, 
+    251, 146,  17, 144, 143, 231, 
+    245,  73, 151,  36,  52,  46, 
+    175,   0,  39, 197, 128,   0, 
       0,   0,  47,  76, 105, 110, 
     107,  73, 110, 102, 111,   0, 
      47, 110,  97, 109, 101, 115, 
@@ -3512,7 +3512,7 @@ const BYTE DX12PixelShaderBytes[] =
       0,   0,   2,   0,   9,   0, 
     220,   4,   0,   0,   0,   0, 
       0,   0, 156,   1,   0,   0, 
-      1,   0,  97, 180,   0,   0, 
+      1,   0,  31,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0, 109,  97, 
     105, 110,   0, 110, 111, 110, 

+ 17 - 17
DX12VertexShader.h

@@ -131,10 +131,10 @@ ret
 
 const BYTE DX12VertexShaderBytes[] =
 {
-     68,  88,  66,  67, 163,  95, 
-     37, 125, 222,   0,  51, 204, 
-     22, 173, 114, 162,  38,   6, 
-     78, 102,   1,   0,   0,   0, 
+     68,  88,  66,  67,  30,  14, 
+    143, 226, 195, 107,   0,  81, 
+    169,  33, 159, 215,  74, 124, 
+    237, 213,   1,   0,   0,   0, 
     144,  78,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
     124,   2,   0,   0,  52,   3, 
@@ -923,11 +923,11 @@ const BYTE DX12VertexShaderBytes[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
-    148,  46,  49,   1, 118, 255, 
-    241,  99,   1,   0,   0,   0, 
-     24,   9, 205,  58,  88,  67, 
-    175,  68, 179, 245, 225, 110, 
-    187, 251, 255, 130,   0,   0, 
+    148,  46,  49,   1,  96, 170, 
+    198, 100,   1,   0,   0,   0, 
+     88,  35,  73,  54, 115, 177, 
+    140,  74, 166, 184,  98, 189, 
+    173, 222,  79, 141,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       1,   0,   0,   0,   1,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -1103,7 +1103,7 @@ const BYTE DX12VertexShaderBytes[] =
       0,   0, 103, 159,   1,   0, 
     179, 120,   1,   0, 238,  97, 
       2,   0,  90,  28,   0,   0, 
-     19, 100,   0,   0,  53, 174, 
+     82,  67,   2,   0,  53, 174, 
       3,   0, 206,  21,   0,   0, 
     193, 205,   3,   0, 207, 193, 
       1,   0,  62,   3,   3,   0, 
@@ -1607,7 +1607,7 @@ const BYTE DX12VertexShaderBytes[] =
      97, 109, 101, 114,  97,  13, 
      10, 115, 116, 114,  27, 226, 
      48,   1, 128,   0,   0,   0, 
-    241, 190,  10,  72,  80,  68, 
+    231,  61, 192, 201,  18, 195, 
     217,   1,   1,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -2125,7 +2125,7 @@ const BYTE DX12VertexShaderBytes[] =
      24,  21,  12,  16,   0,   0, 
       1,   0,   1,   0,  14,   0, 
      23,  21,  13,  16,   0,   0, 
-     36,   2,   0,  80,   0,   0, 
+     36,   2,   0, 194,   0,   0, 
     242, 241,  10,   0,  24,  21, 
      14,  16,   0,   0,   1,   0, 
       0,   2,  18,   0,  22,  21, 
@@ -3057,10 +3057,10 @@ const BYTE DX12VertexShaderBytes[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    118, 255, 241,  99,   1,   0, 
-      0,   0,  24,   9, 205,  58, 
-     88,  67, 175,  68, 179, 245, 
-    225, 110, 187, 251, 255, 130, 
+     96, 170, 198, 100,   1,   0, 
+      0,   0,  88,  35,  73,  54, 
+    115, 177, 140,  74, 166, 184, 
+     98, 189, 173, 222,  79, 141, 
     129,   0,   0,   0,  47,  76, 
     105, 110, 107,  73, 110, 102, 
     111,   0,  47, 110,  97, 109, 
@@ -3160,7 +3160,7 @@ const BYTE DX12VertexShaderBytes[] =
       0,   0,   0,   0,   2,   0, 
       9,   0, 156,   5,   0,   0, 
       0,   0,   0,   0, 236,   2, 
-      0,   0,   1,   0, 207,  79, 
+      0,   0,   1,   0, 178, 193, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
     109,  97, 105, 110,   0, 110, 

+ 11 - 5
JSON.cpp

@@ -1434,11 +1434,17 @@ JSONValidationResult* JSONValidator::validate(
                 if (!zConstraints->selectChildsByAttribute("name", i.val())
                          .exists())
                 {
-                    return new JSONTypeMissmatch(path,
-                        dynamic_cast<JSONValue*>(zValue->getThis()),
-                        dynamic_cast<XML::Element*>(zConstraints->getThis()),
-                        new JSONUnknownValue(
-                            p, zValue->asObject()->getValue(i.val())));
+                    if (!zConstraints
+                             ->getAttributeValue("allowAdditionalAttributes")
+                             .istGleich("true"))
+                    {
+                        return new JSONTypeMissmatch(path,
+                            dynamic_cast<JSONValue*>(zValue->getThis()),
+                            dynamic_cast<XML::Element*>(
+                                zConstraints->getThis()),
+                            new JSONUnknownValue(
+                                p, zValue->asObject()->getValue(i.val())));
+                    }
                 }
                 else
                 {

+ 6 - 0
JSON.h

@@ -876,6 +876,12 @@ namespace Framework
                     return this;
                 }
 
+                ObjectValidationBuilder<T>* allowAdditionalAttriutes()
+                {
+					element.setAttribute("allowAdditionalAttributes", "true");
+					return this;
+				}
+
                 T* finishObject()
                 {
                     T* result = builder(element);

+ 23 - 23
UIPixelShader.h

@@ -352,10 +352,10 @@ ret
 
 const BYTE UIPixelShader[] =
 {
-     68,  88,  66,  67, 220, 134, 
-     55, 178,  53,  80, 233, 131, 
-    255, 210, 210,  14,  97,  27, 
-    236, 255,   1,   0,   0,   0, 
+     68,  88,  66,  67,  46, 128, 
+    132, 163, 166,  21, 104, 179, 
+    114, 209, 243,  53, 251,  42, 
+     93,  93,   1,   0,   0,   0, 
      12, 134,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
     140,   6,   0,   0,  28,   7, 
@@ -1805,11 +1805,11 @@ const BYTE UIPixelShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0, 148,  46, 
-     49,   1, 118, 255, 241,  99, 
-      1,   0,   0,   0,  83,   4, 
-    177,  16, 146, 233, 135,  71, 
-    169,  45,  76,   7,  84, 158, 
-     28, 204,   0,   0,   0,   0, 
+     49,   1,  96, 170, 198, 100, 
+      1,   0,   0,   0, 131, 179, 
+     54,  82,  41,  53, 160,  69, 
+    185, 214, 193,   7, 157,  19, 
+    136, 134,   0,   0,   0,   0, 
       0,   0,   0,   0,   1,   0, 
       0,   0,   1,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -1980,10 +1980,10 @@ const BYTE UIPixelShader[] =
       3,   0, 242,  56,   1,   0, 
      43, 236,   3,   0,  28,  19, 
       2,   0,  65,  36,   1,   0, 
-    236, 179,   1,   0, 183, 203, 
-      0,   0, 125,  10,   2,   0, 
-    125, 181,   2,   0, 245,  69, 
-      1,   0, 193,  33,   3,   0, 
+    236, 179,   1,   0,  14,  16, 
+      2,   0, 125,  10,   2,   0, 
+    125, 181,   2,   0,  84, 254, 
+      3,   0, 193,  33,   3,   0, 
      65, 185,   2,   0,   9, 241, 
       2,   0, 146, 230,   3,   0, 
     125, 218,   1,   0, 118,  19, 
@@ -3000,8 +3000,8 @@ const BYTE UIPixelShader[] =
      84, 101, 120, 116, 117, 114, 
     101,  50,  68,  32, 115, 104, 
      97, 100,  27, 226,  48,   1, 
-    128,   0,   0,   0, 153, 100, 
-     27,  72,  80,  68, 217,   1, 
+    128,   0,   0,   0, 152, 100, 
+    211, 201,  18, 195, 217,   1, 
       1,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -4243,14 +4243,14 @@ const BYTE UIPixelShader[] =
       6,  16,   0,   0,  23,   0, 
       1,   0,   5,  16,   0,   0, 
      14,   0,  23,  21,   0,  16, 
-      0,   0,   3,   2, 112,  32, 
+      0,   0,   3,   2,  16,  78, 
       0,   0, 242, 241,  10,   0, 
      24,  21,   8,  16,   0,   0, 
       1,   0,   1,   0,  10,   0, 
      24,  21,   9,  16,   0,   0, 
       1,   0,   0,   2,  14,   0, 
      23,  21,   0,   0,   0,   0, 
-     10,   2, 112,  32,   0,   0, 
+     10,   2,  16,  78,   0,   0, 
     242, 241,  10,   0,  24,  21, 
      11,  16,   0,   0,   1,   0, 
       1,   0,  10,   0,  24,  21, 
@@ -5474,11 +5474,11 @@ const BYTE UIPixelShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
-    148,  46,  49,   1, 118, 255, 
-    241,  99,   1,   0,   0,   0, 
-     83,   4, 177,  16, 146, 233, 
-    135,  71, 169,  45,  76,   7, 
-     84, 158,  28, 204, 128,   0, 
+    148,  46,  49,   1,  96, 170, 
+    198, 100,   1,   0,   0,   0, 
+    131, 179,  54,  82,  41,  53, 
+    160,  69, 185, 214, 193,   7, 
+    157,  19, 136, 134, 128,   0, 
       0,   0,  47,  76, 105, 110, 
     107,  73, 110, 102, 111,   0, 
      47, 110,  97, 109, 101, 115, 
@@ -5578,7 +5578,7 @@ const BYTE UIPixelShader[] =
       0,   0,   2,   0,   9,   0, 
     204,   8,   0,   0,   0,   0, 
       0,   0, 164,  14,   0,   0, 
-      1,   0,  67, 188,   0,   0, 
+      1,   0,  34, 153,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,  84, 101, 
     120, 116, 117, 114, 101,  80, 

+ 15 - 15
UIVertexShader.h

@@ -121,10 +121,10 @@ ret
 
 const BYTE UIVertexShader[] =
 {
-     68,  88,  66,  67,  56,  85, 
-    129, 129,  11, 106, 183, 228, 
-     90,  58,  77,  58, 147, 252, 
-    145, 183,   1,   0,   0,   0, 
+     68,  88,  66,  67, 137, 173, 
+    202, 229, 166,  96,  45,  23, 
+    211, 226,  69,   3, 128, 104, 
+    192, 102,   1,   0,   0,   0, 
     204,  77,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
      20,   2,   0,   0, 204,   2, 
@@ -881,10 +881,10 @@ const BYTE UIVertexShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    118, 255, 241,  99,   1,   0, 
-      0,   0, 167, 125, 163,  74, 
-    170, 132, 110,  66, 174,  43, 
-    125,  97, 210,   9, 194, 206, 
+     96, 170, 198, 100,   1,   0, 
+      0,   0, 195,  76, 182, 152, 
+    178, 142,   5,  70, 190, 191, 
+     55, 136, 149,  13,   5,  81, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   1,   0,   0,   0, 
       1,   0,   0,   0,   0,   0, 
@@ -1564,8 +1564,8 @@ const BYTE UIVertexShader[] =
      13,  10,  47,  47,  32,  84, 
      89,  80,  69,  68,  69,  70, 
      27, 226,  48,   1, 128,   0, 
-      0,   0, 184, 225,  52,  72, 
-     80,  68, 217,   1,   1,   0, 
+      0,   0, 230, 198, 239, 201, 
+     18, 195, 217,   1,   1,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -2929,10 +2929,10 @@ const BYTE UIVertexShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    118, 255, 241,  99,   1,   0, 
-      0,   0, 167, 125, 163,  74, 
-    170, 132, 110,  66, 174,  43, 
-    125,  97, 210,   9, 194, 206, 
+     96, 170, 198, 100,   1,   0, 
+      0,   0, 195,  76, 182, 152, 
+    178, 142,   5,  70, 190, 191, 
+     55, 136, 149,  13,   5,  81, 
     129,   0,   0,   0,  47,  76, 
     105, 110, 107,  73, 110, 102, 
     111,   0,  47, 110,  97, 109, 
@@ -3032,7 +3032,7 @@ const BYTE UIVertexShader[] =
       0,   0,   0,   0,   2,   0, 
       9,   0, 104,   5,   0,   0, 
       0,   0,   0,   0, 236,   2, 
-      0,   0,   1,   0,  21, 115, 
+      0,   0,   1,   0, 250,  92, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
      84, 101, 120, 116, 117, 114,