hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
String.h
Go to the documentation of this file.
1 #ifndef STRING_H
2 #define STRING_H
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <string.h>
6 #include <sys/types.h>
7 #include <ctype.h>
8 #include <List.h>
9 #include <iostream>
10 #include <stdarg.h>
11 #include <stdlib.h>
12 #include <limits.h>
13 #include <new>
14 class String
15 {
16 public:
17  String();
18  String(const char *src);
19  String(const char *src, unsigned int len);
20  String(const String & str);
21  ~String();
22  String & operator+=(String & str);
23  String operator+(String & b);
24  void fromInt(int x);
25  void fromInt64(long long x);
26  void fromUInt(unsigned int x);
27  void fromUInt64(unsigned long long x);
28  String & operator=(const char *str);
30  bool operator==(String & str);
31  bool operator!=(String & str);
32  bool operator>(String & str);
33  bool operator<(String & str);
34  char &operator[] (unsigned int index);
35  void addSlashes();
36  void replace(const char *search, const char *replace, unsigned int limit = 0);
37  int fastReplace(const char *search, const char *replace, unsigned int limit = 0);
38  int strPos(const char *search, unsigned int offset = 0);
39  int fastStrPos(const char *search, unsigned int offset = 0);
40  static int fastStrPos(const unsigned char *haystack, int hLen, const unsigned char *needle, int nLen, unsigned int offset = 0);
41  void urlEncode();
42  void urlDecode();
43  void jsonEncode();
44  unsigned int length();
45  String & subStr(unsigned int pos, unsigned int len);
46  const char *c_str();
47  String **split(const char *pattern);
48  void implode(unsigned int count, const char *glue, ...);
49  void implode(const char *glue, char **str);
50  friend std::ostream & operator<<(std::ostream & out, String & str);
51  bool wildcmp(char *wild);
52  bool wildcmp(String &pattern);
53  static unsigned int jsonEncode(const char *src, unsigned int len, char **dst);
54 private:
55  char *data;
56  unsigned int len;
57  int fastStrPos(const char *data, const char *search);
58 };
59 #endif