Code

empty messages are passed onto all listeners in pedro, gui ignores such messages
[inkscape.git] / src / jabber_whiteboard / message-utilities.h
1 /**
2  * Whiteboard session manager
3  * Message generation utilities
4  * 
5  * Authors:
6  * David Yip <yipdw@rose-hulman.edu>
7  * Jonas Collaros, Stephen Montgomery
8  *
9  * Copyright (c) 2004-2005 Authors
10  *
11  * Released under GNU GPL, read the file 'COPYING' for more information
12  */
14 #ifndef __WHITEBOARD_MESSAGE_UTILITIES_H__
15 #define __WHITEBOARD_MESSAGE_UTILITIES_H__
17 #include <glibmm.h>
18 #include "xml/repr.h"
20 #include "xml/node.h"
21 #include "jabber_whiteboard/defines.h"
23 using Glib::ustring;
25 namespace Inkscape {
27 namespace Util {
29 template< typename T >
30 class ptr_shared;
32 }
34 namespace Whiteboard {
36 struct Node {
37         ustring tag;
38         ustring data;
39         ustring::size_type next_pos;
40 };
42 class XMLNodeTracker;
44 class MessageUtilities {
45 public:
46     // Message generation utilities
47     static void newObjectMessage(Glib::ustring &msgbuf, 
48                            KeyNodeTable& newnodesbuf, 
49                            NewChildObjectMessageList& childmsgbuf, 
50                            XMLNodeTracker* xmt,
51                            Inkscape::XML::Node const* node, 
52                            bool only_collect_nodes = false,
53                            bool collect_children = true); 
54     static void objectChangeMessage(Glib::ustring &msgbuf, 
55                            XMLNodeTracker* xmt,
56                            const Glib::ustring &id, 
57                            gchar const* key,
58                            gchar const* oldval, 
59                            gchar const* newval,
60                            bool is_interactive);
61     static void objectDeleteMessage(Glib::ustring &msgbuf,
62                            XMLNodeTracker* xmt, 
63                            Inkscape::XML::Node const& parent,
64                            Inkscape::XML::Node const& child,
65                            Inkscape::XML::Node const* prev);
66     static void contentChangeMessage(Glib::ustring &msgbuf,
67                            const Glib::ustring &nodeid,
68                            Util::ptr_shared<char> old_value,
69                            Util::ptr_shared<char> new_value);
70     static void childOrderChangeMessage(Glib::ustring &msgbuf,
71                            const Glib::ustring &childid,
72                            const Glib::ustring &oldprevid,
73                            const Glib::ustring &newprevid);
75     // Message parsing utilities
76     static bool getFirstMessageTag(struct Node& buf,
77                           const Glib::ustring &msg);
78     static bool findTag(struct Node& buf, 
79                           const Glib::ustring &msg);
81     // Message tag generation utilities
82     static Glib::ustring makeTagWithContent(const Glib::ustring &tagname,
83                                             const Glib::ustring &content);
85 private:
86     // noncopyable, nonassignable
87     MessageUtilities(MessageUtilities const&);
88     MessageUtilities& operator=(MessageUtilities const&);
90 };
92 }
94 }
100 /*
101   Local Variables:
102   mode:c++
103   c-file-style:"stroustrup"
104   c-file-offsets:((innamespace . 0)(inline-open . 0))
105   indent-tabs-mode:nil
106   fill-column:99
107   End:
108 */
109 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
110 #endif