Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <iostream>
  3. #include <memory>
  4. #include <string>
  5.  
  6. enum type_t
  7. {
  8.   UNDEFINED,
  9.   WORD,
  10.   NUMBER,
  11.   PUNCTUATION,
  12.   COMMA,
  13.   DASH
  14. };
  15.  
  16. #define pList buffer *
  17.  
  18. struct buffer
  19. {
  20.   buffer() :
  21.     t(UNDEFINED), str("") {};
  22.   type_t t;
  23.   std::string str;
  24.   pList next;
  25. };
  26.  
  27. class parser
  28. {
  29. public:
  30.   parser(int rWidth);
  31.   ~parser();
  32.   void parse();
  33.  
  34. private:
  35.   void print();
  36.   void save(pList & iter, int begin, int end, type_t t);
  37.  
  38.   int width_;
  39.   char arr_[25]; //buffer for 1 word
  40.   pList head_; //buffer for 4 words
  41.   int elems_;
  42.   int sumSize_;
  43.   bool first_;
  44.   bool writed_;
  45. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement