curseOutput.hh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. class JSonElement;
  3. template<class T> class Optional;
  4. class CurseOutput
  5. {
  6. public:
  7. CurseOutput(JSonElement *rootData);
  8. virtual ~CurseOutput();
  9. void run();
  10. private:
  11. typedef Optional<std::pair<Optional<const std::string>, const JSonElement *> > t_nextKey;
  12. protected:
  13. void init();
  14. void shutdown();
  15. void redraw();
  16. void redraw(std::pair<int, int> &, const std::pair<int, int>&, const JSonElement *);
  17. bool readInput();
  18. void getScreenSize(std::pair<int, int> &);
  19. static CurseOutput::t_nextKey findNext(const JSonElement *);
  20. void write(const int &x, const int &y, JSonElement *item);
  21. void write(const int &x, const int &y, const std::string &item);
  22. void writeKey(const std::string &key, std::pair<int, int> &cursor);
  23. unsigned int offset_x;
  24. unsigned int offset_y;
  25. const JSonElement *data;
  26. std::pair<std::pair<unsigned int, unsigned int>, const JSonElement *> topleft;
  27. const unsigned int indentLevel;
  28. };