Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1. #include "container.h"
  2.  
  3. #include "array.h"
  4.  
  5. #include "Engine.h"
  6.  
  7. #define hardDebug
  8.  
  9. #ifdef hardDebug
  10. #include "debug.h"
  11. void printElem(container* elem, int indent)
  12. {
  13.     for (int i =0; i<indent ;i++)
  14.     {
  15.         LOG ("    ");
  16.     }
  17.     switch ( elem->getType() )
  18.     {
  19.     case container::tObject :
  20.     case container::tArray :
  21.     {
  22.         LOG( "["<<elem<<"]"<<EL);
  23.         for (int i =0; i<indent ;i++)
  24.         {
  25.             LOG ("    ");
  26.         }
  27.         LOG("[" << EL);
  28.         std::vector<container*> e = elem->getArray();
  29.         for (auto i : (e) )
  30.         {
  31.             printElem(i, indent+1);
  32.         }
  33.         for (int i =0; i<indent ;i++)
  34.         {
  35.             LOG ("    ");
  36.         }
  37.         LOG( "]"<< EL );
  38.     }
  39.     break;
  40.     case container::tNULL :
  41.         LOG( ("NULL element") << EL );
  42.     break;
  43.     default:
  44.     {
  45.         std::string kek = elem->getString();
  46.         LOG( (kek) << EL );
  47.     }
  48.     break;
  49.     }
  50. }
  51. #endif // hardDebug
  52.  
  53. int main(int argc, char* argv[])
  54. {
  55.     container JSON;
  56.     JSON.parseJSONfile("menu.json");
  57.  
  58. #ifdef hardDebug
  59.     LOG("Printing JSON that had been just readed : "<< EL);
  60.     printElem(&JSON, 1);
  61. #endif // hardDebug
  62.  
  63.     return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement