linearHistory.hh 776 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * linearHistory.hh for jsonstroller
  3. *
  4. * Author: isundil <isundill@gmail.com>
  5. **/
  6. #pragma once
  7. #include "config.h"
  8. #include "wrappedBuffer.hpp"
  9. class LinearHistory: public WrappedBuffer<char, ERROR_HISTORY_LEN>
  10. {
  11. public:
  12. LinearHistory();
  13. ~LinearHistory();
  14. /**
  15. * Get line number
  16. **/
  17. unsigned int currentLine() const;
  18. /**
  19. * Insert char(s)
  20. * If new-line found, reinitialize and increment line
  21. **/
  22. void put(char item);
  23. void put(char item[], unsigned int count);
  24. private:
  25. /**
  26. * True if new line found, and should reset at new put
  27. **/
  28. bool willReset;
  29. /**
  30. * Current line
  31. **/
  32. unsigned int line;
  33. };