2
* Whiteboard session manager
6
* David Yip <yipdw@rose-hulman.edu>
8
* Copyright (c) 2005 Authors
10
* Released under GNU GPL, read the file 'COPYING' for more information
13
#ifndef __INKSCAPE_WHITEBOARD_DEFINES_H__
14
#define __INKSCAPE_WHITEBOARD_DEFINES_H__
17
#include "jabber_whiteboard/message-tags.h"
28
#include <sigc++/sigc++.h>
32
// Various specializations of std::less for XMLNodeTracker maps.
34
using Inkscape::XML::Node;
37
* Specialization of std::less<> for pointers to XML::Nodes.a
39
* \see Inkscape::XML::Node
42
struct less< Node* > : public binary_function < Node*, Node*, bool >
44
bool operator()(Node* _x, Node* _y) const
60
template< typename T > class ListContainer;
63
namespace Whiteboard {
69
typedef const std::string Wrapper;
70
typedef std::string Message;
72
extern Wrapper PROTOCOL;
74
extern Wrapper REMOVE;
75
extern Wrapper CONFIGURE;
78
extern Message CONNECT_REQUEST;
79
extern Message CONNECTED;
80
extern Message ACCEPT_INVITATION;
81
extern Message DECLINE_INVITATION;
82
extern Message DOCUMENT_BEGIN;
83
extern Message DOCUMENT_END;
89
extern const std::string DOCUMENT_ROOT_NODE;
91
extern const std::string INKBOARD_XMLNS;
93
extern const std::string WHITEBOARD_MESSAGE;
94
extern const std::string PROTOCOL_MESSAGE;
95
extern const std::string NEW_MESSAGE;
96
extern const std::string CONFIGURE_MESSAGE;
97
extern const std::string CONFIGURE_TEXT_MESSAGE;
98
extern const std::string MOVE_MESSAGE;
99
extern const std::string REMOVE_MESSAGE;
105
typedef const std::string SessionType;
107
extern SessionType WHITEBOARD_MUC;
108
extern SessionType WHITEBOARD_PEER;
113
AWAITING_INVITATION_REPLY = 1,
115
INVITATION_RECIEVED = 3,
116
AWAITING_CONNECTED = 4,
118
AWAITING_DOCUMENT_BEGIN = 6,
129
ACCEPT_INVITATION = 0,
130
DECLINE_INVITATION = 1
138
typedef std::pair<Glib::ustring, Glib::ustring> Configure;
140
// Message handler modes
147
// Actions to pass to the node tracker when we modify a node in
148
// the document tree upon event serialization
149
enum NodeTrackerAction {
155
// I am assuming that std::string (which will not properly represent Unicode data) will
156
// suffice for associating (integer, Jabber ID) identifiers with nodes.
157
// We do not need to preserve all semantics handled by Unicode; we just need to have
158
// the byte representation. std::string is good enough for that.
160
// The reason for this is that comparisons with std::string are much faster than
161
// comparisons with Glib::ustring (simply because the latter is using significantly
162
// more complex text-handling algorithms), and we need speed here. We _could_ use
163
// Glib::ustring::collate_key() here and therefore get the best of both worlds,
164
// but collation keys are rather big.
166
// XML node tracker maps
168
/// Associates node keys to pointers to XML::Nodes.
169
/// \see Inkscape::Whiteboard::XMLNodeTracker
170
typedef std::map< std::string, XML::Node*, std::less< std::string >, GC::Alloc< std::pair< std::string, XML::Node* >, GC::MANUAL > > KeyToTrackerNodeMap;
172
/// Associates pointers to XML::Nodes with node keys.
173
/// \see Inkscape::Whiteboard::XMLNodeTracker
174
typedef std::map< XML::Node*, std::string, std::less< XML::Node* >, GC::Alloc< std::pair< XML::Node*, std::string >, GC::MANUAL > > TrackerNodeToKeyMap;
177
// TODO: Clean up these typedefs. I'm sure quite a few of these aren't used anymore; additionally,
178
// it's probably possible to consolidate a few of these types into one.
180
// Temporary storage of new object messages and new nodes in said messages
181
typedef std::list< Glib::ustring > NewChildObjectMessageList;
183
typedef std::pair< KeyNodePair, NodeTrackerAction > SerializedEventNodeAction;
185
typedef std::list< SerializedEventNodeAction > KeyToNodeActionList;
187
//typedef std::map< std::string, SerializedEventNodeAction > KeyToNodeActionMap;
189
typedef std::set< std::string > AttributesScannedSet;
190
typedef std::set< XML::Node* > AttributesUpdatedSet;
192
typedef std::map< std::string, XML::Node const* > KeyToNodeMap;
193
typedef std::map< XML::Node const*, std::string > NodeToKeyMap;
196
// Message context verification and processing
197
struct MessageProcessor;
198
class ReceiveMessageQueue;
200
typedef std::map< std::string, ReceiveMessageQueue*, std::less< std::string >, GC::Alloc< std::pair< std::string, ReceiveMessageQueue* >, GC::MANUAL > > RecipientToReceiveQueueMap;
201
typedef std::map< std::string, unsigned int > ReceipientToLatestTransactionMap;
203
typedef std::string ReceivedCommitEvent;
204
typedef std::list< ReceivedCommitEvent > CommitsQueue;
206
// Message serialization
207
typedef std::list< Glib::ustring > SerializedEventList;
210
//typedef std::pair< Glib::ustring, InvitationResponses > Invitation_response_type;
211
//typedef std::list< Invitation_response_type > Invitation_responses_type;
212
// Error handling -- someday
213
// TODO: finish and integrate this
214
//typedef boost::function< LmHandlerResult (unsigned int code) > ErrorHandlerFunctor;
215
//typedef std::map< unsigned int, ErrorHandlerFunctor > ErrorHandlerFunctorMap;
217
// TODO: breaking these up into namespaces would be nice, but it's too much typing
221
extern char const* MESSAGE_PROTOCOL_V1;
222
extern int const HIGHEST_SUPPORTED;
224
// Node types (as strings)
225
extern char const* NODETYPE_DOCUMENT_STR;
226
extern char const* NODETYPE_ELEMENT_STR;
227
extern char const* NODETYPE_TEXT_STR;
228
extern char const* NODETYPE_COMMENT_STR;
230
// Number of chars to allocate for type field (in SessionManager::sendMessage)
231
extern int const TYPE_FIELD_SIZE;
233
// Number of chars to allocate for sequence number field (in SessionManager::sendMessage)
234
extern int const SEQNUM_FIELD_SIZE;
236
// Designators for certain "special" nodes in the document
237
// These nodes are "special" because they are generally present in all documents
238
extern char const* DOCUMENT_ROOT_NODE;
239
extern char const* DOCUMENT_NAMEDVIEW_NODE;
241
// Names of these special nodes
242
extern char const* DOCUMENT_ROOT_NAME;
243
extern char const* DOCUMENT_NAMEDVIEW_NAME;
256
c-file-style:"stroustrup"
257
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
262
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :