Updated all cpp files to new format
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / builder / json-parser-state.cpp
index 40ec632..3262a81 100644 (file)
 #include <dali-toolkit/internal/builder/json-parser-state.h>
 
 // EXTERNAL INCLUDES
 #include <dali-toolkit/internal/builder/json-parser-state.h>
 
 // EXTERNAL INCLUDES
-#include <string>
 #include <algorithm>
 #include <algorithm>
+#include <string>
 
 namespace Dali
 {
 
 namespace Dali
 {
-
 namespace Toolkit
 {
 namespace Toolkit
 {
-
 namespace Internal
 {
 namespace Internal
 {
-
 namespace
 {
 namespace
 {
-
 // true if character represent a digit
 inline bool IsDigit(char c)
 {
 // true if character represent a digit
 inline bool IsDigit(char c)
 {
@@ -41,30 +37,30 @@ inline bool IsDigit(char c)
 }
 
 // convert string to integer
 }
 
 // convert string to integer
-bool StringToInteger(const char *first, const char *last, int& out)
+bool StringToInteger(const char* first, const char* last, int& out)
 {
   int sign = 1;
 {
   int sign = 1;
-  if (first != last)
+  if(first != last)
   {
   {
-    if (*first == '-')
+    if(*first == '-')
     {
       sign = -1;
       ++first;
     }
     {
       sign = -1;
       ++first;
     }
-    else if (*first == '+')
+    else if(*first == '+')
     {
       ++first;
     }
   }
 
   // json error for int starting with zero
     {
       ++first;
     }
   }
 
   // json error for int starting with zero
-  if( 0 == (*first - '0') && (first+1 != last))
+  if(0 == (*first - '0') && (first + 1 != last))
   {
     return false;
   }
 
   int result = 0;
   {
     return false;
   }
 
   int result = 0;
-  for (; first != last && IsDigit(*first); ++first)
+  for(; first != last && IsDigit(*first); ++first)
   {
     result = 10 * result + (*first - '0');
   }
   {
     result = 10 * result + (*first - '0');
   }
@@ -81,21 +77,21 @@ bool StringToInteger(const char *first, const char *last, int& out)
 }
 
 // convert hexadecimal string to unsigned integer
 }
 
 // convert hexadecimal string to unsigned integer
-bool HexStringToUnsignedInteger(const char *first, const char *last, unsigned int& out)
+bool HexStringToUnsignedInteger(const char* first, const char* last, unsigned int& out)
 {
   unsigned int result = 0;
 {
   unsigned int result = 0;
-  for (; first != last; ++first)
+  for(; first != last; ++first)
   {
     int digit;
   {
     int digit;
-    if (IsDigit(*first))
+    if(IsDigit(*first))
     {
       digit = *first - '0';
     }
     {
       digit = *first - '0';
     }
-    else if (*first >= 'a' && *first <= 'f')
+    else if(*first >= 'a' && *first <= 'f')
     {
       digit = *first - 'a' + 10;
     }
     {
       digit = *first - 'a' + 10;
     }
-    else if (*first >= 'A' && *first <= 'F')
+    else if(*first >= 'A' && *first <= 'F')
     {
       digit = *first - 'A' + 10;
     }
     {
       digit = *first - 'A' + 10;
     }
@@ -122,14 +118,14 @@ bool StringToFloat(const char* first, const char* last, float& out)
 {
   // sign
   float sign = 1;
 {
   // sign
   float sign = 1;
-  if (first != last)
+  if(first != last)
   {
   {
-    if (*first == '-')
+    if(*first == '-')
     {
       sign = -1;
       ++first;
     }
     {
       sign = -1;
       ++first;
     }
-    else if (*first == '+')
+    else if(*first == '+')
     {
       ++first;
     }
     {
       ++first;
     }
@@ -137,18 +133,18 @@ bool StringToFloat(const char* first, const char* last, float& out)
 
   // integer part
   float result = 0;
 
   // integer part
   float result = 0;
-  for (; first != last && IsDigit(*first); ++first)
+  for(; first != last && IsDigit(*first); ++first)
   {
     result = 10 * result + (*first - '0');
   }
 
   // fraction part
   {
     result = 10 * result + (*first - '0');
   }
 
   // fraction part
-  if (first != last && *first == '.')
+  if(first != last && *first == '.')
   {
     ++first;
 
     float inv_base = 0.1f;
   {
     ++first;
 
     float inv_base = 0.1f;
-    for (; first != last && IsDigit(*first); ++first)
+    for(; first != last && IsDigit(*first); ++first)
     {
       result += (*first - '0') * inv_base;
       inv_base *= 0.1f;
     {
       result += (*first - '0') * inv_base;
       inv_base *= 0.1f;
@@ -160,17 +156,17 @@ bool StringToFloat(const char* first, const char* last, float& out)
 
   // exponent
   bool exponent_negative = false;
 
   // exponent
   bool exponent_negative = false;
-  int exponent = 0;
-  if (first != last && (*first == 'e' || *first == 'E'))
+  int  exponent          = 0;
+  if(first != last && (*first == 'e' || *first == 'E'))
   {
     ++first;
 
   {
     ++first;
 
-    if (*first == '-')
+    if(*first == '-')
     {
       exponent_negative = true;
       ++first;
     }
     {
       exponent_negative = true;
       ++first;
     }
-    else if (*first == '+')
+    else if(*first == '+')
     {
       ++first;
     }
     {
       ++first;
     }
@@ -180,21 +176,21 @@ bool StringToFloat(const char* first, const char* last, float& out)
       return false;
     }
 
       return false;
     }
 
-    for (; first != last && IsDigit(*first); ++first)
+    for(; first != last && IsDigit(*first); ++first)
     {
       exponent = 10 * exponent + (*first - '0');
     }
   }
 
     {
       exponent = 10 * exponent + (*first - '0');
     }
   }
 
-  if (exponent)
+  if(exponent)
   {
     float power_of_ten = 10;
   {
     float power_of_ten = 10;
-    for (; exponent > 1; exponent--)
+    for(; exponent > 1; exponent--)
     {
       power_of_ten *= 10;
     }
 
     {
       power_of_ten *= 10;
     }
 
-    if (exponent_negative)
+    if(exponent_negative)
     {
       result /= power_of_ten;
     }
     {
       result /= power_of_ten;
     }
@@ -216,11 +212,10 @@ bool StringToFloat(const char* first, const char* last, float& out)
   }
 }
 
   }
 }
 
-
 bool IsNumber(char c)
 {
   bool ret = false;
 bool IsNumber(char c)
 {
   bool ret = false;
-  switch( c )
+  switch(c)
   {
     case '0':
     case '1':
   {
     case '0':
     case '1':
@@ -244,14 +239,19 @@ bool IsNumber(char c)
   return ret;
 }
 
   return ret;
 }
 
-} // anon namespace
-
+} // namespace
 
 JsonParserState::JsonParserState(TreeNode* _root)
 
 JsonParserState::JsonParserState(TreeNode* _root)
-  : mRoot(_root), mCurrent(_root),
-    mErrorDescription(nullptr), mErrorNewLine(0), mErrorColumn(0), mErrorPosition(0),
-    mNumberOfParsedChars(0), mNumberOfCreatedNodes(0), mFirstParse(false),
-    mState(STATE_START)
+: mRoot(_root),
+  mCurrent(_root),
+  mErrorDescription(nullptr),
+  mErrorNewLine(0),
+  mErrorColumn(0),
+  mErrorPosition(0),
+  mNumberOfParsedChars(0),
+  mNumberOfCreatedNodes(0),
+  mFirstParse(false),
+  mState(STATE_START)
 {
   if(_root == nullptr)
   {
 {
   if(_root == nullptr)
   {
@@ -281,7 +281,6 @@ TreeNode* JsonParserState::CreateNewNode(const char* name, TreeNode::NodeType ty
   ++mNumberOfCreatedNodes;
 
   return node;
   ++mNumberOfCreatedNodes;
 
   return node;
-
 }
 
 TreeNode* JsonParserState::NewNode(const char* name, TreeNode::NodeType type)
 }
 
 TreeNode* JsonParserState::NewNode(const char* name, TreeNode::NodeType type)
@@ -299,7 +298,7 @@ TreeNode* JsonParserState::NewNode(const char* name, TreeNode::NodeType type)
     if(name)
     {
       const TreeNode* found = mCurrent.GetChild(name);
     if(name)
     {
       const TreeNode* found = mCurrent.GetChild(name);
-      if( nullptr != found )
+      if(nullptr != found)
       {
         node = const_cast<TreeNode*>(found);
       }
       {
         node = const_cast<TreeNode*>(found);
       }
@@ -307,7 +306,7 @@ TreeNode* JsonParserState::NewNode(const char* name, TreeNode::NodeType type)
     else
     {
       // if root node
     else
     {
       // if root node
-      if( mCurrent.GetParent() == nullptr )
+      if(mCurrent.GetParent() == nullptr)
       {
         node = mRoot;
       }
       {
         node = mRoot;
       }
@@ -356,7 +355,7 @@ bool JsonParserState::ParseWhiteSpace()
   bool c_comment   = false;
   bool cpp_comment = false;
 
   bool c_comment   = false;
   bool cpp_comment = false;
 
-  if( mIter == mEnd )
+  if(mIter == mEnd)
   {
     return true;
   }
   {
     return true;
   }
@@ -372,7 +371,7 @@ bool JsonParserState::ParseWhiteSpace()
       NewLine();
     }
 
       NewLine();
     }
 
-    if( AtLeast(2) )
+    if(AtLeast(2))
     {
       nextChar = mIter[1];
     }
     {
       nextChar = mIter[1];
     }
@@ -381,43 +380,43 @@ bool JsonParserState::ParseWhiteSpace()
       nextChar = 0;
     }
 
       nextChar = 0;
     }
 
-    if( cpp_comment )
+    if(cpp_comment)
     {
     {
-      if( '\n' == c )
+      if('\n' == c)
       {
         cpp_comment = false;
         Advance(1);
         continue; // rather than carry on as comments may be back to back
       }
     }
       {
         cpp_comment = false;
         Advance(1);
         continue; // rather than carry on as comments may be back to back
       }
     }
-    else if( !c_comment && (c == '/' && nextChar == '/') )
+    else if(!c_comment && (c == '/' && nextChar == '/'))
     {
       cpp_comment = true;
     }
 
     {
       cpp_comment = true;
     }
 
-    if( c_comment )
+    if(c_comment)
     {
     {
-      if( c == '*' && nextChar == '/' )
+      if(c == '*' && nextChar == '/')
       {
         c_comment = false;
         Advance(2);
         continue;
       }
     }
       {
         c_comment = false;
         Advance(2);
         continue;
       }
     }
-    else if( !cpp_comment && (c == '/' && nextChar == '*') )
+    else if(!cpp_comment && (c == '/' && nextChar == '*'))
     {
       c_comment = true;
     }
 
     {
       c_comment = true;
     }
 
-    if( ! (c_comment || cpp_comment) )
+    if(!(c_comment || cpp_comment))
     {
     {
-      if( ! (c == '\x20' || c == '\x9' || c == '\xD' || c == '\xA' ) )
+      if(!(c == '\x20' || c == '\x9' || c == '\xD' || c == '\xA'))
       {
         break;
       }
     }
 
       {
         break;
       }
     }
 
-    if( AdvanceEnded(1) )
+    if(AdvanceEnded(1))
     {
       break;
     }
     {
       break;
     }
@@ -429,9 +428,9 @@ bool JsonParserState::ParseWhiteSpace()
 
 bool JsonParserState::ParseSymbol(const std::string& symbol)
 {
 
 bool JsonParserState::ParseSymbol(const std::string& symbol)
 {
-  if( AtLeast( symbol.size() ) )
+  if(AtLeast(symbol.size()))
   {
   {
-    for(int i = 0; i < static_cast<int>( symbol.size() ); ++i)
+    for(int i = 0; i < static_cast<int>(symbol.size()); ++i)
     {
       if(*mIter != symbol[i])
       {
     {
       if(*mIter != symbol[i])
       {
@@ -449,7 +448,7 @@ bool JsonParserState::ParseSymbol(const std::string& symbol)
 
 bool JsonParserState::ParseTrue()
 {
 
 bool JsonParserState::ParseTrue()
 {
-  if( ParseSymbol("true") )
+  if(ParseSymbol("true"))
   {
     mCurrent.SetInteger(1);
     mCurrent.SetType(TreeNode::BOOLEAN);
   {
     mCurrent.SetInteger(1);
     mCurrent.SetType(TreeNode::BOOLEAN);
@@ -463,7 +462,7 @@ bool JsonParserState::ParseTrue()
 
 bool JsonParserState::ParseFalse()
 {
 
 bool JsonParserState::ParseFalse()
 {
-  if( ParseSymbol("false") )
+  if(ParseSymbol("false"))
   {
     mCurrent.SetInteger(0);
     mCurrent.SetType(TreeNode::BOOLEAN);
   {
     mCurrent.SetInteger(0);
     mCurrent.SetType(TreeNode::BOOLEAN);
@@ -477,7 +476,7 @@ bool JsonParserState::ParseFalse()
 
 bool JsonParserState::ParseNULL()
 {
 
 bool JsonParserState::ParseNULL()
 {
-  if( ParseSymbol("null") )
+  if(ParseSymbol("null"))
   {
     mCurrent.SetType(TreeNode::IS_NULL);
     return true;
   {
     mCurrent.SetType(TreeNode::IS_NULL);
     return true;
@@ -490,30 +489,30 @@ bool JsonParserState::ParseNULL()
 
 bool JsonParserState::ParseNumber()
 {
 
 bool JsonParserState::ParseNumber()
 {
-  mCurrent.SetType( TreeNode::INTEGER );
+  mCurrent.SetType(TreeNode::INTEGER);
 
   VectorCharIter first = mIter;
 
   VectorCharIter first = mIter;
-  char c = Char();
+  char           c     = Char();
 
 
-  if( !(c == '-' || IsNumber(c) ) )
+  if(!(c == '-' || IsNumber(c)))
   {
     return Error("Number must start with '-' or 0-9");
   }
 
   {
     return Error("Number must start with '-' or 0-9");
   }
 
-  while ( IsNumber(c) || c == '.' || c == 'e' || c == 'E' || c == '+' || c == '-' )
+  while(IsNumber(c) || c == '.' || c == 'e' || c == 'E' || c == '+' || c == '-')
   {
   {
-    if (c == '.' || c == 'e' || c == 'E')
+    if(c == '.' || c == 'e' || c == 'E')
     {
     {
-      mCurrent.SetType( TreeNode::FLOAT );
+      mCurrent.SetType(TreeNode::FLOAT);
     }
     Advance(1);
     c = Char();
   }
 
     }
     Advance(1);
     c = Char();
   }
 
-  if( mCurrent.GetType() == TreeNode::INTEGER )
+  if(mCurrent.GetType() == TreeNode::INTEGER)
   {
     int i = 0;
   {
     int i = 0;
-    if( StringToInteger(&(*first), &(*mIter), i ) )
+    if(StringToInteger(&(*first), &(*mIter), i))
     {
       mCurrent.SetInteger(i);
     }
     {
       mCurrent.SetInteger(i);
     }
@@ -526,7 +525,7 @@ bool JsonParserState::ParseNumber()
   if(mCurrent.GetType() == TreeNode::FLOAT)
   {
     float f = 0.f;
   if(mCurrent.GetType() == TreeNode::FLOAT)
   {
     float f = 0.f;
-    if( StringToFloat(&(*first), &(*mIter), f) )
+    if(StringToFloat(&(*first), &(*mIter), f))
     {
       mCurrent.SetFloat(f);
     }
     {
       mCurrent.SetFloat(f);
     }
@@ -536,25 +535,25 @@ bool JsonParserState::ParseNumber()
     }
   }
 
     }
   }
 
-  return (mCurrent.GetType() == TreeNode::INTEGER)  || (mCurrent.GetType() == TreeNode::FLOAT);
+  return (mCurrent.GetType() == TreeNode::INTEGER) || (mCurrent.GetType() == TreeNode::FLOAT);
 }
 
 char* JsonParserState::EncodeString()
 {
 }
 
 char* JsonParserState::EncodeString()
 {
-  int substitution = 0;
-  VectorCharIter first = mIter;
-  VectorCharIter last  = mIter;
+  int            substitution = 0;
+  VectorCharIter first        = mIter;
+  VectorCharIter last         = mIter;
 
 
-  while (*mIter)
+  while(*mIter)
   {
   {
-    if (static_cast<unsigned char>(*mIter) < '\x20')
+    if(static_cast<unsigned char>(*mIter) < '\x20')
     {
     {
-      static_cast<void>( Error("Control characters not allowed in strings") );
+      static_cast<void>(Error("Control characters not allowed in strings"));
       return nullptr;
     }
       return nullptr;
     }
-    else if (*mIter == '\\' && AtLeast(2))
+    else if(*mIter == '\\' && AtLeast(2))
     {
     {
-      switch (*(mIter+1))
+      switch(*(mIter + 1))
       {
         case '"':
         {
       {
         case '"':
         {
@@ -599,31 +598,31 @@ char* JsonParserState::EncodeString()
         case 'u':
         {
           unsigned int codepoint;
         case 'u':
         {
           unsigned int codepoint;
-          if( !AtLeast(6) )
+          if(!AtLeast(6))
           {
           {
-            static_cast<void>( Error("Bad unicode codepoint; not enough characters") );
+            static_cast<void>(Error("Bad unicode codepoint; not enough characters"));
             return nullptr;
           }
             return nullptr;
           }
-          if ( !HexStringToUnsignedInteger(&(*(mIter + 2)), &(*(mIter + 6)), codepoint) )
+          if(!HexStringToUnsignedInteger(&(*(mIter + 2)), &(*(mIter + 6)), codepoint))
           {
           {
-            static_cast<void>( Error("Bad unicode codepoint") );
+            static_cast<void>(Error("Bad unicode codepoint"));
             return nullptr;
           }
 
             return nullptr;
           }
 
-          if (codepoint <= 0x7F)
+          if(codepoint <= 0x7F)
           {
             *last = (char)codepoint;
           }
           {
             *last = (char)codepoint;
           }
-          else if (codepoint <= 0x7FF)
+          else if(codepoint <= 0x7FF)
           {
             *last++ = (char)(0xC0 | (codepoint >> 6));
           {
             *last++ = (char)(0xC0 | (codepoint >> 6));
-            *last = (char)(0x80 | (codepoint & 0x3F));
+            *last   = (char)(0x80 | (codepoint & 0x3F));
           }
           }
-          else if (codepoint <= 0xFFFF)
+          else if(codepoint <= 0xFFFF)
           {
             *last++ = (char)(0xE0 | (codepoint >> 12));
             *last++ = (char)(0x80 | ((codepoint >> 6) & 0x3F));
           {
             *last++ = (char)(0xE0 | (codepoint >> 12));
             *last++ = (char)(0x80 | ((codepoint >> 6) & 0x3F));
-            *last = (char)(0x80 | (codepoint & 0x3F));
+            *last   = (char)(0x80 | (codepoint & 0x3F));
           }
 
           Advance(4);
           }
 
           Advance(4);
@@ -632,7 +631,7 @@ char* JsonParserState::EncodeString()
 
         default:
         {
 
         default:
         {
-          static_cast<void>( Error("Unrecognized escape sequence") );
+          static_cast<void>(Error("Unrecognized escape sequence"));
           return nullptr;
         }
       }
           return nullptr;
         }
       }
@@ -640,7 +639,7 @@ char* JsonParserState::EncodeString()
       ++last;
       Advance(2);
     }
       ++last;
       Advance(2);
     }
-    else if (*mIter == '{')
+    else if(*mIter == '{')
     {
       if((0 == substitution) && (*last != '\\'))
       {
     {
       if((0 == substitution) && (*last != '\\'))
       {
@@ -649,7 +648,7 @@ char* JsonParserState::EncodeString()
       *last++ = *mIter;
       Advance(1);
     }
       *last++ = *mIter;
       Advance(1);
     }
-    else if (*mIter == '}')
+    else if(*mIter == '}')
     {
       if(substitution)
       {
     {
       if(substitution)
       {
@@ -658,7 +657,7 @@ char* JsonParserState::EncodeString()
       *last++ = *mIter;
       Advance(1);
     }
       *last++ = *mIter;
       Advance(1);
     }
-    else if (*mIter == '"')
+    else if(*mIter == '"')
     {
       *last = 0;
       Advance(1);
     {
       *last = 0;
       Advance(1);
@@ -673,9 +672,9 @@ char* JsonParserState::EncodeString()
   } // while(*mIter)
 
   mNumberOfParsedChars += last - first;
   } // while(*mIter)
 
   mNumberOfParsedChars += last - first;
-  mNumberOfParsedChars += 1 ; // null terminator
+  mNumberOfParsedChars += 1; // null terminator
 
 
-  mCurrent.SetSubstitution( substitution > 1 );
+  mCurrent.SetSubstitution(substitution > 1);
 
   // return true;
   return &(*first);
 
   // return true;
   return &(*first);
@@ -684,12 +683,12 @@ char* JsonParserState::EncodeString()
 
 bool JsonParserState::HandleStartState(const char* name, const char currentChar)
 {
 
 bool JsonParserState::HandleStartState(const char* name, const char currentChar)
 {
-  if( '{' == currentChar )
+  if('{' == currentChar)
   {
     NewNode(name, TreeNode::OBJECT);
     mState = STATE_OBJECT;
   }
   {
     NewNode(name, TreeNode::OBJECT);
     mState = STATE_OBJECT;
   }
-  else if( '[' == currentChar )
+  else if('[' == currentChar)
   {
     NewNode(name, TreeNode::ARRAY);
     mState = STATE_VALUE;
   {
     NewNode(name, TreeNode::ARRAY);
     mState = STATE_VALUE;
@@ -705,20 +704,20 @@ bool JsonParserState::HandleStartState(const char* name, const char currentChar)
 
 bool JsonParserState::HandleObjectState(const char currentChar, const char lastCharacter)
 {
 
 bool JsonParserState::HandleObjectState(const char currentChar, const char lastCharacter)
 {
-  if( '}' == currentChar )
+  if('}' == currentChar)
   {
     if(',' == lastCharacter)
     {
       return Error("Unexpected comma");
     }
 
   {
     if(',' == lastCharacter)
     {
       return Error("Unexpected comma");
     }
 
-    if( !UpToParent() )
+    if(!UpToParent())
     {
       return false;
     }
     mState = STATE_VALUE;
   }
     {
       return false;
     }
     mState = STATE_VALUE;
   }
-  else if ( '"' == currentChar )
+  else if('"' == currentChar)
   {
     mState = STATE_KEY;
   }
   {
     mState = STATE_KEY;
   }
@@ -734,19 +733,19 @@ bool JsonParserState::HandleObjectState(const char currentChar, const char lastC
 bool JsonParserState::HandleKeyState(char*& name)
 {
   name = EncodeString();
 bool JsonParserState::HandleKeyState(char*& name)
 {
   name = EncodeString();
-  if( nullptr == name )
+  if(nullptr == name)
   {
     return false;
   }
   {
     return false;
   }
-  if( !ParseWhiteSpace() )
+  if(!ParseWhiteSpace())
   {
     return false;
   }
   {
     return false;
   }
-  if( ':' != Char())
+  if(':' != Char())
   {
     return Error("Expected ':'");
   }
   {
     return Error("Expected ':'");
   }
-  if( !ParseWhiteSpace() )
+  if(!ParseWhiteSpace())
   {
     return false;
   }
   {
     return false;
   }
@@ -760,7 +759,7 @@ bool JsonParserState::HandleCharacterQuote(char*& name)
 {
   Advance(1);
   NewNode(name, TreeNode::STRING);
 {
   Advance(1);
   NewNode(name, TreeNode::STRING);
-  if( char* value = EncodeString() )
+  if(char* value = EncodeString())
   {
     mCurrent.SetString(value);
   }
   {
     mCurrent.SetString(value);
   }
@@ -768,7 +767,7 @@ bool JsonParserState::HandleCharacterQuote(char*& name)
   {
     return false;
   }
   {
     return false;
   }
-  if( !UpToParent() )
+  if(!UpToParent())
   {
     return false;
   }
   {
     return false;
   }
@@ -779,11 +778,11 @@ bool JsonParserState::HandleCharacterQuote(char*& name)
 bool JsonParserState::HandleCharacterNumberOrHyphen(const char* name)
 {
   NewNode(name, TreeNode::IS_NULL);
 bool JsonParserState::HandleCharacterNumberOrHyphen(const char* name)
 {
   NewNode(name, TreeNode::IS_NULL);
-  if( !ParseNumber() )
+  if(!ParseNumber())
   {
     return false;
   }
   {
     return false;
   }
-  if( !UpToParent() )
+  if(!UpToParent())
   {
     return false;
   }
   {
     return false;
   }
@@ -795,43 +794,43 @@ bool JsonParserState::HandleValueState(char*& name, const char currentChar, cons
 {
   bool handled = true;
 
 {
   bool handled = true;
 
-  if( '"' == currentChar )
+  if('"' == currentChar)
   {
     handled = HandleCharacterQuote(name);
   }
   {
     handled = HandleCharacterQuote(name);
   }
-  else if( IsNumber(currentChar) || currentChar == '-' )
+  else if(IsNumber(currentChar) || currentChar == '-')
   {
     handled = HandleCharacterNumberOrHyphen(name);
   }
   {
     handled = HandleCharacterNumberOrHyphen(name);
   }
-  else if( '{' == currentChar )
+  else if('{' == currentChar)
   {
     handled = HandleCharacterBracesStart(name, lastCharacter);
   }
   {
     handled = HandleCharacterBracesStart(name, lastCharacter);
   }
-  else if( '}' == currentChar )
+  else if('}' == currentChar)
   {
     handled = HandleCharacterBracesEnd(lastCharacter);
   }
   {
     handled = HandleCharacterBracesEnd(lastCharacter);
   }
-  else if( '[' == currentChar )
+  else if('[' == currentChar)
   {
     handled = HandleCharacterSquareBracketStart(name);
   }
   {
     handled = HandleCharacterSquareBracketStart(name);
   }
-  else if( ']' == currentChar )
+  else if(']' == currentChar)
   {
     handled = HandleCharacterSquareBracketEnd(lastCharacter);
   }
   {
     handled = HandleCharacterSquareBracketEnd(lastCharacter);
   }
-  else if( 't' == currentChar )
+  else if('t' == currentChar)
   {
     handled = HandleCharacterLowercaseT(name);
   }
   {
     handled = HandleCharacterLowercaseT(name);
   }
-  else if( 'n' == currentChar )
+  else if('n' == currentChar)
   {
     handled = HandleCharacterLowercaseN(name);
   }
   {
     handled = HandleCharacterLowercaseN(name);
   }
-  else if( 'f' == currentChar)
+  else if('f' == currentChar)
   {
     handled = HandleCharacterLowercaseF(name);
   }
   {
     handled = HandleCharacterLowercaseF(name);
   }
-  else if( ',' == currentChar )
+  else if(',' == currentChar)
   {
     handled = HandleCharacterComma(name);
   }
   {
     handled = HandleCharacterComma(name);
   }
@@ -852,7 +851,7 @@ bool JsonParserState::ParseJson(VectorChar& source)
 {
   Reset();
 
 {
   Reset();
 
-  if( 0 == source.size() )
+  if(0 == source.size())
   {
     return Error("Empty source buffer to parse");
   }
   {
     return Error("Empty source buffer to parse");
   }
@@ -860,11 +859,11 @@ bool JsonParserState::ParseJson(VectorChar& source)
   mIter = source.begin();
   mEnd  = source.end();
 
   mIter = source.begin();
   mEnd  = source.end();
 
-  char* name = nullptr;
-  char currentChar   = 0;
-  char lastCharacter = 0;
+  char* name          = nullptr;
+  char  currentChar   = 0;
+  char  lastCharacter = 0;
 
 
-  if( !ParseWhiteSpace() )
+  if(!ParseWhiteSpace())
   {
     return false;
   }
   {
     return false;
   }
@@ -872,9 +871,9 @@ bool JsonParserState::ParseJson(VectorChar& source)
   while(mIter != mEnd)
   {
     lastCharacter = currentChar;
   while(mIter != mEnd)
   {
     lastCharacter = currentChar;
-    currentChar = Char();
+    currentChar   = Char();
 
 
-    switch( mState )
+    switch(mState)
     {
       case STATE_START:
       {
     {
       case STATE_START:
       {
@@ -918,7 +917,7 @@ bool JsonParserState::ParseJson(VectorChar& source)
   } // while(1)
 
   //
   } // while(1)
 
   //
-  if( mState != STATE_END )
+  if(mState != STATE_END)
   {
     return Error("Unexpected termination character");
   }
   {
     return Error("Unexpected termination character");
   }
@@ -933,15 +932,15 @@ void JsonParserState::Reset()
 {
   mCurrent = TreeNodeManipulator(mRoot);
 
 {
   mCurrent = TreeNodeManipulator(mRoot);
 
-  mErrorDescription   = nullptr;
-  mErrorNewLine       = 0;
-  mErrorColumn        = 0;
-  mErrorPosition      = 0;
+  mErrorDescription = nullptr;
+  mErrorNewLine     = 0;
+  mErrorColumn      = 0;
+  mErrorPosition    = 0;
 }
 
 bool JsonParserState::HandleCharacterBracesStart(const char* name, const char lastCharacter)
 {
 }
 
 bool JsonParserState::HandleCharacterBracesStart(const char* name, const char lastCharacter)
 {
-  if( '}' == lastCharacter )
+  if('}' == lastCharacter)
   {
     return Error("Expected a comma");
   }
   {
     return Error("Expected a comma");
   }
@@ -972,7 +971,7 @@ bool JsonParserState::HandleCharacterBracesEnd(const char lastCharacter)
   }
   else
   {
   }
   else
   {
-    if( !UpToParent() )
+    if(!UpToParent())
     {
       return false;
     }
     {
       return false;
     }
@@ -1007,7 +1006,7 @@ bool JsonParserState::HandleCharacterSquareBracketEnd(const char lastCharacter)
   }
   else
   {
   }
   else
   {
-    if( !UpToParent() )
+    if(!UpToParent())
     {
       return false;
     }
     {
       return false;
     }
@@ -1019,11 +1018,11 @@ bool JsonParserState::HandleCharacterSquareBracketEnd(const char lastCharacter)
 bool JsonParserState::HandleCharacterLowercaseT(const char* name)
 {
   NewNode(name, TreeNode::BOOLEAN);
 bool JsonParserState::HandleCharacterLowercaseT(const char* name)
 {
   NewNode(name, TreeNode::BOOLEAN);
-  if( !ParseTrue() )
+  if(!ParseTrue())
   {
     return false;
   }
   {
     return false;
   }
-  if( !UpToParent() )
+  if(!UpToParent())
   {
     return false;
   }
   {
     return false;
   }
@@ -1034,11 +1033,11 @@ bool JsonParserState::HandleCharacterLowercaseT(const char* name)
 bool JsonParserState::HandleCharacterLowercaseN(const char* name)
 {
   NewNode(name, TreeNode::IS_NULL);
 bool JsonParserState::HandleCharacterLowercaseN(const char* name)
 {
   NewNode(name, TreeNode::IS_NULL);
-  if( !ParseNULL() )
+  if(!ParseNULL())
   {
     return false;
   }
   {
     return false;
   }
-  if( !UpToParent() )
+  if(!UpToParent())
   {
     return false;
   }
   {
     return false;
   }
@@ -1049,11 +1048,11 @@ bool JsonParserState::HandleCharacterLowercaseN(const char* name)
 bool JsonParserState::HandleCharacterLowercaseF(const char* name)
 {
   NewNode(name, TreeNode::BOOLEAN);
 bool JsonParserState::HandleCharacterLowercaseF(const char* name)
 {
   NewNode(name, TreeNode::BOOLEAN);
-  if( !ParseFalse() )
+  if(!ParseFalse())
   {
     return false;
   }
   {
     return false;
   }
-  if( !UpToParent() )
+  if(!UpToParent())
   {
     return false;
   }
   {
     return false;
   }
@@ -1063,7 +1062,7 @@ bool JsonParserState::HandleCharacterLowercaseF(const char* name)
 
 bool JsonParserState::HandleCharacterComma(const char* name)
 {
 
 bool JsonParserState::HandleCharacterComma(const char* name)
 {
-  if( 0 == mCurrent.Size() )
+  if(0 == mCurrent.Size())
   {
     return Error("Missing Value");
   }
   {
     return Error("Missing Value");
   }