summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.h
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-25 17:45:10 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-25 17:45:10 +0000
commitdac1f42ef81ac1119430fd294a6b35b0b8cd6837 (patch)
treee3b972fc4bb56a3158e57adc70df6655f6a34dcf /protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.h
parent357ae09c7eba86e783583566816285750933beaa (diff)
- class KeyStream extracted to the separate module;
- xml attributes redesigned to produce efficient code; - many small improvements git-svn-id: http://svn.miranda-ng.org/main/trunk@11905 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.h')
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.h41
1 files changed, 39 insertions, 2 deletions
diff --git a/protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.h b/protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.h
index d810852314..0731d97ab1 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.h
+++ b/protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.h
@@ -14,6 +14,37 @@
using namespace std;
+struct XATTR
+{
+ __forceinline XATTR(const char *_name, const char *_value) :
+ name(_name), value(_value)
+ {}
+
+ __forceinline XATTR(const char *_name, const std::string &_value) :
+ name(_name), value(_value.c_str())
+ {}
+
+ __forceinline XATTR(const std::string &_name, const std::string &_value) :
+ name(_name.c_str()), value(_value.c_str())
+ {}
+
+ const char *name, *value;
+};
+
+struct XATTRI
+{
+ __forceinline XATTRI(const char *_name, int _value) :
+ name(_name), value(_value)
+ {}
+
+ __forceinline XATTRI(const std::string &_name, int _value) :
+ name(_name.c_str()), value(_value)
+ {}
+
+ const char *name;
+ int value;
+};
+
class ProtocolTreeNode {
public:
vector<unsigned char>* data;
@@ -21,8 +52,8 @@ public:
map<string, string> *attributes;
vector<ProtocolTreeNode*> *children;
- ProtocolTreeNode(const string& tag, map<string, string> *attributes, ProtocolTreeNode* child);
- ProtocolTreeNode(const string& tag, map<string, string> *attributes, vector<unsigned char>* data = NULL, vector<ProtocolTreeNode*> *children = NULL);
+ ProtocolTreeNode(const string& tag, ProtocolTreeNode* child);
+ ProtocolTreeNode(const string& tag, vector<unsigned char>* data = NULL, vector<ProtocolTreeNode*> *children = NULL);
string toString();
ProtocolTreeNode* getChild(const string& id);
ProtocolTreeNode* getChild(size_t id);
@@ -38,4 +69,10 @@ public:
virtual ~ProtocolTreeNode();
};
+ProtocolTreeNode& operator<<(ProtocolTreeNode&, const XATTR&);
+ProtocolTreeNode* operator<<(ProtocolTreeNode*, const XATTR&);
+
+ProtocolTreeNode& operator<<(ProtocolTreeNode&, const XATTRI&);
+ProtocolTreeNode* operator<<(ProtocolTreeNode*, const XATTRI&);
+
#endif /* PROTOCOLNODE_H_ */ \ No newline at end of file