xref: /haiku/headers/private/mail/NodeMessage.h (revision 24159a0c7d6d6dcba9f2a0c1a7c08d2c8167f21b)
1 #ifndef ZOIDBERG_GARGOYLE_NODE_MESSAGE_H
2 #define ZOIDBERG_GARGOYLE_NODE_MESSAGE_H
3 /* NodeMessage - "streaming" interface and support functions for BNodes
4 **
5 ** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
6 */
7 
8 /*
9    These functions gives a nice BMessage interface to node attributes,
10    by letting you transfer attributes to and from BMessages.  It makes
11    it so you can use all the convenient Find...() and Add...() functions
12    provided by BMessage for attributes too.  You use it as follows:
13 
14    BMessage m;
15    BNode n(path);
16    if (reading) { n>>m; printf("woohoo=%s\n",m.FindString("woohoo")) }
17    else { m.AddString("woohoo","it's howdy doody time"); n<<m; }
18 
19    If there is more than one data item with a given name, the first
20    item is the one writen to the node.
21 */
22 
23 #include <Node.h>
24 #include <Message.h>
25 
26 #if defined(HAIKU_TARGET_PLATFORM_DANO) || defined(HAIKU_TARGET_PLATFORM_HAIKU)
27 #define _IMPEXP_MAIL
28 #endif
29 
30 _IMPEXP_MAIL BNode& operator<<(BNode& n, const BMessage& m);
31 _IMPEXP_MAIL BNode& operator>>(BNode& n, BMessage& m);
32 inline const BMessage& operator>>(const BMessage& m, BNode& n){n<<m;return m;}
33 inline       BMessage& operator<<(      BMessage& m, BNode& n){n>>m;return m;}
34 
35 #endif	/* ZOIDBERG_GARGOYLE_NODE_MESSAGE_H */
36