Advertisement
magik6000

Untitled

Feb 4th, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. struct token
  2. {
  3. int id;
  4. string s;
  5. token(string st, int i);
  6. };
  7.  
  8. struct _chsetrule
  9. {
  10. string _from;
  11. string _to;
  12. };
  13.  
  14. class superstring
  15. {
  16. private:
  17.  
  18. vector<token>tokens;
  19. bool rae;
  20.  
  21. protected:
  22. bool lck;
  23. unsigned int lpos;
  24.  
  25. public:
  26.  
  27. unsigned int pos;/** Position */
  28. string str;/** Container string, DO NOT OVERUSE THIS, the type MAY CHANGE in future API versions */
  29.  
  30.  
  31. /** Core functions*/
  32. ~superstring();
  33. superstring();
  34.  
  35. superstring& lock();
  36. superstring& lock(unsigned int lp);
  37. superstring& unlock();
  38.  
  39. bool atbegin();
  40. bool atend();
  41.  
  42. size_t length();
  43. size_t size();
  44.  
  45. void clear();
  46. const char* c_str();
  47.  
  48. superstring& go_begin();
  49. superstring& go_end();
  50. superstring& go_begin(int p);
  51. superstring& go_end(int p);
  52. superstring& go_pos(int p);
  53.  
  54. char& operator[](unsigned int i);
  55.  
  56.  
  57. /** C++ string functions*/
  58. superstring(string s);
  59. void set(string s);
  60. void operator()(string s);
  61. superstring& operator+=(string in);
  62.  
  63. string skip(string stb);
  64. string tochar(string fend);
  65. bool contain(string stb);
  66. bool contain_not(string stb);
  67. bool contain_only(string stb);
  68. string to(string fend);
  69. string back_to(string fend);
  70. string from(string start);
  71. unsigned int find(string str);
  72.  
  73. int check(string sch);
  74. string get(unsigned int n);
  75. string get_begin(unsigned int n);
  76. string get_end(unsigned int n);
  77.  
  78. superstring& change(string from, string to);
  79. superstring& remove(string from, string to);
  80. superstring& remove(string s);
  81.  
  82. static int int_from_str(string in);
  83.  
  84. /** SuperString functions*/
  85. void set(superstring s);
  86. void operator()(superstring s);
  87. superstring operator+=(superstring in);
  88.  
  89. superstring skip(superstring stb);
  90. superstring tochar(superstring fend);
  91. bool contain(superstring stb);
  92. bool contain_not(superstring stb);
  93. bool contain_only(superstring stb);
  94. superstring to(superstring fend);
  95. superstring back_to(superstring fend);
  96. superstring from(superstring start);
  97.  
  98. /** Integer functions*/
  99. void set(int s);
  100. void operator()(int s);
  101. superstring operator*=(unsigned int rc);
  102.  
  103. static string str_from_int(int in);
  104. static superstring sst_from_int(int in);
  105.  
  106. string from(unsigned int sp);
  107. string to(unsigned int ep);
  108.  
  109. superstring& remove(unsigned int from, unsigned int to);
  110.  
  111. /** 64bit integer functions */
  112. static string str_from_int64(int64_t in);
  113. static superstring sst_from_int64(int64_t in);
  114. static int64_t int64_from_sst(superstring in);
  115. static int64_t int64_from_str(string in);
  116.  
  117. /** Size functions */
  118. static string str_from_size(int64_t in);
  119. static superstring sst_from_size(int64_t in);
  120.  
  121. /** Double precission functions */
  122. static string str_from_double(double in);
  123. static superstring sst_from_double(double in);
  124.  
  125. /** Token functions*/
  126. superstring& add_token(token t);
  127. void clear_tokens();
  128. token tok();
  129. token tok(string &opt);
  130. size_t num_tokens();
  131.  
  132.  
  133. /** Character functions*/
  134. int count(const char c);
  135.  
  136.  
  137. /** File functions*/
  138. static string file(string fn);
  139. void set_file(string fn);
  140. void append_file(string fn);
  141.  
  142. static int file(string fn, string content);
  143. static int str_to_file(string fn, string content);
  144. static int sst_to_file(string fn, superstring content);
  145. static int append_str_file(string fn, string append);
  146. static int append_sst_file(string fn, superstring append);
  147.  
  148. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement