summaryrefslogtreecommitdiffstats
blob: 543d95e79e5b63e73e87e5200a84ac72a989982a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Copyright (c) 2012 Mateusz Piękos
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

/*
 * Copyright (c) 2015 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

#pragma once

#include <Swiften/Base/API.h>
#include <Swiften/Elements/WhiteboardPayload.h>
#include <Swiften/Elements/Whiteboard/WhiteboardLineElement.h>
#include <Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h>
#include <Swiften/Elements/Whiteboard/WhiteboardRectElement.h>
#include <Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h>
#include <Swiften/Elements/Whiteboard/WhiteboardTextElement.h>
#include <Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h>
#include <Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>

namespace Swift {
	class SWIFTEN_API WhiteboardElementSerializingVisitor : public WhiteboardElementVisitor {
	public:
		void visit(WhiteboardLineElement& line);
		void visit(WhiteboardFreehandPathElement& path);
		void visit(WhiteboardRectElement& rect);
		void visit(WhiteboardPolygonElement& polygon);
		void visit(WhiteboardTextElement& text);
		void visit(WhiteboardEllipseElement& ellipse);
		XMLElement::ref getResult() const;

	private:
		std::string alphaToOpacity(int alpha) const;
		
		XMLElement::ref element;
	};

	class SWIFTEN_API WhiteboardSerializer : public GenericPayloadSerializer<WhiteboardPayload> {
	public:
		std::string serializePayload(boost::shared_ptr<WhiteboardPayload> payload) const;

	private:
		std::string typeToString(WhiteboardPayload::Type type) const;
	};
}