vfs: check userland buffers before reading them.
[haiku.git] / src / apps / haikudepot / textview / TextSelection.cpp
blobc84facfcca6f3f387f27e33f6ae8081d625b7768
1 /*
2 * Copyright 2014, Stephan Aßmus <superstippi@gmx.de>.
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
6 #include "TextSelection.h"
9 TextSelection::TextSelection()
11 fAnchor(0),
12 fCaret(0)
17 TextSelection::TextSelection(int32 anchor, int32 caret)
19 fAnchor(anchor),
20 fCaret(caret)
25 TextSelection::TextSelection(const TextSelection& other)
27 fAnchor(other.fAnchor),
28 fCaret(other.fCaret)
33 TextSelection&
34 TextSelection::operator=(const TextSelection& other)
36 if (this == &other)
37 return *this;
39 fAnchor = other.fAnchor;
40 fCaret = other.fCaret;
41 return *this;
45 bool
46 TextSelection::operator==(const TextSelection& other) const
48 return (this == &other)
49 || (fAnchor == other.fAnchor && fCaret == other.fCaret);
53 bool
54 TextSelection::operator!=(const TextSelection& other) const
56 return !(*this == other);
60 void
61 TextSelection::SetAnchor(int32 anchor)
63 fAnchor = anchor;
67 void
68 TextSelection::SetCaret(int32 caret)
70 fCaret = caret;