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/typedefs.h"
23 using Glib::ustring;
25 namespace Inkscape {
27 namespace Util {
29 class shared_ptr<char>;
31 }
33 namespace Whiteboard {
35 struct Node {
36 ustring tag;
37 ustring data;
38 ustring::size_type next_pos;
39 };
41 class XMLNodeTracker;
43 class MessageUtilities {
44 public:
45 // Message generation utilities
46 static void newObjectMessage(ustring* msgbuf, KeyToNodeMap& newidsbuf, NodeToKeyMap& newnodesbuf, NewChildObjectMessageList& childmsgbuf, XMLNodeTracker* xmt, Inkscape::XML::Node const* node, bool only_collect_nodes = false, bool collect_children = true);
47 static void objectChangeMessage(ustring* msgbuf, XMLNodeTracker* xmt, std::string const id, gchar const* key, gchar const* oldval, gchar const* newval, bool is_interactive);
48 static void objectDeleteMessage(ustring* msgbuf, XMLNodeTracker* xmt, Inkscape::XML::Node const& parent, Inkscape::XML::Node const& child, Inkscape::XML::Node const* prev);
49 static void contentChangeMessage(ustring& msgbuf, std::string const nodeid, Util::shared_ptr<char> old_value, Util::shared_ptr<char> new_value);
50 static void childOrderChangeMessage(ustring& msgbuf, std::string const childid, std::string const oldprevid, std::string const newprevid);
52 // Message parsing utilities
53 static bool getFirstMessageTag(struct Node& buf, ustring const& msg);
54 static bool findTag(struct Node& buf, ustring const& msg);
56 // Message tag generation utilities
57 static Glib::ustring makeTagWithContent(Glib::ustring tagname, Glib::ustring content);
59 private:
60 // noncopyable, nonassignable
61 MessageUtilities(MessageUtilities const&);
62 MessageUtilities& operator=(MessageUtilities const&);
64 };
66 }
68 }
74 /*
75 Local Variables:
76 mode:c++
77 c-file-style:"stroustrup"
78 c-file-offsets:((innamespace . 0)(inline-open . 0))
79 indent-tabs-mode:nil
80 fill-column:99
81 End:
82 */
83 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
84 #endif