diff options
author | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-07-05 10:12:45 (GMT) |
---|---|---|
committer | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-07-05 10:12:45 (GMT) |
commit | 349cda4b8e178dc4a6694c47a3eb45e5a1368fb8 (patch) | |
tree | b0576f3c60bf13a8f62396cac332edc2a421e4bd /Swiften/Whiteboard/Operations | |
parent | fadd51fbed5111aba266a3b8b22be2c57ea11262 (diff) | |
download | swift-contrib-349cda4b8e178dc4a6694c47a3eb45e5a1368fb8.zip swift-contrib-349cda4b8e178dc4a6694c47a3eb45e5a1368fb8.tar.bz2 |
Created simple WhiteboardServer with unit tests
Purpose of WhiteboardServer is to handle server side Operational
Transformation operations
Diffstat (limited to 'Swiften/Whiteboard/Operations')
-rw-r--r-- | Swiften/Whiteboard/Operations/WhiteboardInsertOperation.h | 32 | ||||
-rw-r--r-- | Swiften/Whiteboard/Operations/WhiteboardOperation.h | 60 |
2 files changed, 92 insertions, 0 deletions
diff --git a/Swiften/Whiteboard/Operations/WhiteboardInsertOperation.h b/Swiften/Whiteboard/Operations/WhiteboardInsertOperation.h new file mode 100644 index 0000000..6934053 --- /dev/null +++ b/Swiften/Whiteboard/Operations/WhiteboardInsertOperation.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/Whiteboard/Operations/WhiteboardOperation.h> + +#include <Swiften/Whiteboard/Elements/WhiteboardElement.h> + +namespace Swift { + class WhiteboardInsertOperation : public WhiteboardOperation { + public: + typedef boost::shared_ptr<WhiteboardInsertOperation> ref; + public: + ~WhiteboardInsertOperation() { + } + + WhiteboardElement::ref getElement() const { + return element_; + } + + void setElement(WhiteboardElement::ref element) { + element_ = element; + } + + private: + WhiteboardElement::ref element_; + }; +} diff --git a/Swiften/Whiteboard/Operations/WhiteboardOperation.h b/Swiften/Whiteboard/Operations/WhiteboardOperation.h new file mode 100644 index 0000000..73a8b74 --- /dev/null +++ b/Swiften/Whiteboard/Operations/WhiteboardOperation.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <boost/smart_ptr/shared_ptr.hpp> +#include <string> + +namespace Swift { + class WhiteboardOperation { + public: + typedef boost::shared_ptr<WhiteboardOperation> ref; + public: + + enum OperationOrigin { Local, Other }; + + virtual ~WhiteboardOperation(){}; + + std::string getID() const { + return id_; + } + + void setID(const std::string& id) { + id_ = id; + } + + std::string getParentID() const { + return parentID_; + } + + void setParentID(const std::string& parentID) { + parentID_ = parentID; + } + + int getPos() const { + return pos_; + } + + void setPos(int pos) { + pos_ = pos; + } + + OperationOrigin getOrigin() const { + return origin_; + } + + void setOrigin(OperationOrigin origin) { + origin_ = origin; + } + + private: + std::string id_; + std::string parentID_; + int pos_; + OperationOrigin origin_; + }; +} |