diff options
Diffstat (limited to 'MySpace/NetMessage.h')
-rw-r--r-- | MySpace/NetMessage.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/MySpace/NetMessage.h b/MySpace/NetMessage.h index 4989f55..fb4e73b 100644 --- a/MySpace/NetMessage.h +++ b/MySpace/NetMessage.h @@ -12,9 +12,41 @@ public: const bool operator<(const NMString &other) const;
const bool operator==(const NMString &other) const;
+ const bool operator==(const char *str) const;
NMString &operator=(const NMString &other);
char *text;
+ int len;
+};
+
+class StringList: public LinkedList<NMString> {
+public:
+ StringList(char *sep = "|");
+ virtual ~StringList();
+
+ int parse(char *data, int size);
+
+ bool get_string(int index, char *buff, int buffsize);
+ int get_int(int index);
+
+ void add_string(char *buff);
+ void add_int(int i);
+
+ int make_body(char *buff, int size, bool sep_at_start = false);
+protected:
+ virtual char *escape(char *val);
+ virtual char *unescape_inplace(char *val);
+
+ char* seperators;
+};
+
+class PipedStringList: public StringList {
+public:
+ PipedStringList();
+ virtual ~PipedStringList();
+protected:
+ char *escape(char *val);
+ char *unescape_inplace(char *val);
};
class KeyValue: public Pair<NMString, NMString> {
@@ -41,6 +73,9 @@ public: void add_int(char *key, int i);
int make_body(char *buff, int size);
+
+ static char *escape(char *val);
+ static char *unescape_inplace(char *val);
};
class NetMessage: public Map<NMString, NMString> {
@@ -54,6 +89,7 @@ public: int get_int(char *key);
bool get_data(char *key, char *buff, int *size);
Dictionary get_dict(char *key);
+ PipedStringList get_list(char *key);
static char *unescape_inplace(char *val);
};
@@ -68,6 +104,7 @@ public: void add_string(char *key, char *buff);
bool add_data(char *key, char *buff, int size);
void add_dict(char *key, Dictionary &d);
+ void add_list(char *key, PipedStringList &list);
static char *escape(char *val);
};
|