1/*
2 * Copyright 2014, Stephan Aßmus <superstippi@gmx.de>.
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
5
6#include "TextSelection.h"
7
8
9TextSelection::TextSelection()
10	:
11	fAnchor(0),
12	fCaret(0)
13{
14}
15
16
17TextSelection::TextSelection(int32 anchor, int32 caret)
18	:
19	fAnchor(anchor),
20	fCaret(caret)
21{
22}
23
24
25TextSelection::TextSelection(const TextSelection& other)
26	:
27	fAnchor(other.fAnchor),
28	fCaret(other.fCaret)
29{
30}
31
32
33TextSelection&
34TextSelection::operator=(const TextSelection& other)
35{
36	if (this == &other)
37		return *this;
38
39	fAnchor = other.fAnchor;
40	fCaret = other.fCaret;
41	return *this;
42}
43
44
45bool
46TextSelection::operator==(const TextSelection& other) const
47{
48	return (this == &other)
49		|| (fAnchor == other.fAnchor && fCaret == other.fCaret);
50}
51
52
53bool
54TextSelection::operator!=(const TextSelection& other) const
55{
56	return !(*this == other);
57}
58
59
60void
61TextSelection::SetAnchor(int32 anchor)
62{
63	fAnchor = anchor;
64}
65
66
67void
68TextSelection::SetCaret(int32 caret)
69{
70	fCaret = caret;
71}
72
73