curseOutput.hh 1.1 KB

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