From dac1f42ef81ac1119430fd294a6b35b0b8cd6837 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 25 Jan 2015 17:45:10 +0000 Subject: - 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 --- .../WhatsApp/src/WhatsAPI++/ProtocolTreeNode.h | 41 ++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.h') 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* data; @@ -21,8 +52,8 @@ public: map *attributes; vector *children; - ProtocolTreeNode(const string& tag, map *attributes, ProtocolTreeNode* child); - ProtocolTreeNode(const string& tag, map *attributes, vector* data = NULL, vector *children = NULL); + ProtocolTreeNode(const string& tag, ProtocolTreeNode* child); + ProtocolTreeNode(const string& tag, vector* data = NULL, vector *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 -- cgit v1.2.3