Commit MetaInfo

Revision03f84de68d102be02eecc03615b2dd3e6b266224 (tree)
Time2017-10-22 23:10:20
Author <exeal@user...>

Log Message

Introduced kernel.DocumentAccess and kernel.PositionAccess meta-functions.

Change Summary

Incremental Difference

diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/kernel/abstract-point.hpp
--- a/ascension/ascension/kernel/abstract-point.hpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/ascension/kernel/abstract-point.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -10,6 +10,7 @@
1010 #include <ascension/corelib/basic-exceptions.hpp>
1111 #include <ascension/corelib/signals.hpp>
1212 #include <ascension/direction.hpp>
13+#include <ascension/kernel/access.hpp>
1314
1415 namespace ascension {
1516 namespace kernel {
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/kernel/access.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ascension/ascension/kernel/access.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -0,0 +1,107 @@
1+/**
2+ */
3+
4+#ifndef ASCENSION_KERNEL_ACCESS_HPP
5+#define ASCENSION_KERNEL_ACCESS_HPP
6+#include <ascension/corelib/future/type-traits.hpp>
7+#include <ascension/kernel/position.hpp>
8+
9+namespace ascension {
10+ namespace kernel {
11+ class Document;
12+
13+ /**
14+ * Metafunction to access the document.
15+ * @tparam T The document-related object type
16+ */
17+ template<typename T>
18+ struct DocumentAccess {
19+ /**
20+ * Returns the document of the given document-related object.
21+ * @param object The object to query
22+ * @return The document
23+ */
24+ static auto get(T& object) BOOST_NOEXCEPT -> decltype(object.document()) {
25+ return object.document();
26+ }
27+ };
28+
29+ /**
30+ * Metafunction to access the position.
31+ * @tparam T The object type
32+ */
33+ template<typename T>
34+ struct PositionAccess {
35+ /**
36+ * Returns the position value of the given positional object.
37+ * @param p The positional object
38+ * @return The position value
39+ */
40+ static inline auto get(T& p) BOOST_NOEXCEPT -> decltype(p.position()) {
41+ return p.position();
42+ }
43+ };
44+
45+ template<>
46+ struct PositionAccess<Position> {
47+ static Position& get(Position& p) BOOST_NOEXCEPT {
48+ return p;
49+ }
50+ };
51+
52+ template<>
53+ struct PositionAccess<const Position> {
54+ static const Position& get(const Position& p) BOOST_NOEXCEPT {
55+ return p;
56+ }
57+ };
58+
59+ /**
60+ * Returns the document of the given document-related object.
61+ * @tparam T The type of @a object
62+ * @param object The object to query
63+ * @return A reference to the document
64+ */
65+ template<typename T>
66+ inline auto document(T& object) BOOST_NOEXCEPT -> decltype(DocumentAccess<T>::get(object)) {
67+ return DocumentAccess<T>::get(object);
68+ }
69+
70+ /**
71+ * Returns the position value of the given positional object.
72+ * @tparam T The type of @a p
73+ * @param p The positional object
74+ * @return The position value
75+ */
76+ template<typename T>
77+ inline auto position(T& p) BOOST_NOEXCEPT -> decltype(PositionAccess<T>::get(p)) {
78+ return PositionAccess<T>::get(p);
79+ }
80+
81+ /**
82+ * Returns the line number of the given positional object.
83+ * @tparam T The type of @a p. This should be able to pass to @c position function
84+ * @param p The positional object
85+ * @return The line number. Not a reference
86+ */
87+ template<typename T>
88+ BOOST_CONSTEXPR inline Index line(const T& p) BOOST_NOEXCEPT {
89+ return position(p).line;
90+ }
91+
92+ /**
93+ * Returns the offset in the line of the given positional object.
94+ * @tparam T The type of @a p. This should be able to pass to @c position function
95+ * @param p The positional object
96+ * @return The offset in the line. Not a reference
97+ */
98+ template<typename T>
99+ BOOST_CONSTEXPR inline Index offsetInLine(const T& p) BOOST_NOEXCEPT {
100+ return position(p).offsetInLine;
101+ }
102+
103+ /// @}
104+ }
105+}
106+
107+#endif // !ASCENSION_KERNEL_ACCESS_HPP
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/kernel/document-character-iterator.hpp
--- a/ascension/ascension/kernel/document-character-iterator.hpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/ascension/kernel/document-character-iterator.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -103,10 +103,12 @@
103103 return position_;
104104 }
105105
106- /// @overload
107- inline const Position& position(const DocumentCharacterIterator& i) BOOST_NOEXCEPT {
108- return i.tell();
109- }
106+ template<>
107+ struct PositionAccess<const DocumentCharacterIterator> {
108+ static const Position& get(const DocumentCharacterIterator& i) BOOST_NOEXCEPT {
109+ return i.tell();
110+ }
111+ };
110112 }
111113 } // namespace ascension.kernel
112114
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/kernel/document.hpp
--- a/ascension/ascension/kernel/document.hpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/ascension/kernel/document.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -529,12 +529,14 @@
529529
530530 /**
531531 * Returns the content type of the partition contains the specified position.
532+ * @tparam The type of @a p (@c locations#PointProxy)
532533 * @param p The position in the document
533534 * @throw ... Any exception thrown by @c DocumentPartitioner#contentType method
534535 * @return The content type
535536 */
536- inline ContentType contentType(const std::pair<const Document&, Position>& p) {
537- return std::get<0>(p).partitioner().contentType(std::get<1>(p));
537+ template<typename T>
538+ inline ContentType contentType(const T& p) {
539+ return document(p).partitioner().contentType(position(p));
538540 }
539541
540542 /**
@@ -566,8 +568,9 @@
566568
567569 namespace detail {
568570 /// @internal Returns the @c text#IdentifierSyntax object corresponds to the given point.
569- inline const text::IdentifierSyntax& identifierSyntax(const std::pair<const Document&, Position>& p) {
570- return std::get<0>(p).contentTypeInformation().getIdentifierSyntax(contentType(p));
571+ template<typename T>
572+ inline const text::IdentifierSyntax& identifierSyntax(const T& p) {
573+ return document(p).contentTypeInformation().getIdentifierSyntax(contentType(p));
571574 }
572575 }
573576 }
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/kernel/locations.hpp
--- a/ascension/ascension/kernel/locations.hpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/ascension/kernel/locations.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -35,21 +35,7 @@
3535 GLYPH_CLUSTER ///< A glyph is a character (not implemented).
3636 };
3737
38- /**
39- * Describes a position in the document.
40- * @see viewer#locations#PointProxy
41- */
42- typedef std::pair<const Document&, Position> PointProxy;
43-
44- /**
45- * Returns a @c PointProxy from the given document and position.
46- * @param document The document
47- * @param position The position
48- * @return A @c PointProxy
49- */
50- inline PointProxy makePointProxy(const Document& document, const Position& position) BOOST_NOEXCEPT {
51- return std::make_pair(std::ref(document), position);
52- }
38+ struct PointProxy;
5339
5440 /// @defgroup special_locations_in_document Special Locations in Document
5541 /// Free functions related to special locations.
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/kernel/point-proxy.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ascension/ascension/kernel/point-proxy.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -0,0 +1,50 @@
1+/**
2+ * @file kernel/point-proxy.hpp
3+ * Defines @c kernel#locations#PointProxy class.
4+ * @author exeal
5+ * @date 2017-10-17 Separated from visual-locations.hpp.
6+ * @see kernel/point-proxy.hpp
7+ */
8+
9+#ifndef ASCENSION_KERNEL_POINT_PROXY_HPP
10+#define ASCENSION_KERNEL_POINT_PROXY_HPP
11+#include <ascension/kernel/access.hpp>
12+
13+namespace ascension {
14+ namespace kernel {
15+ class Document;
16+
17+ namespace locations {
18+ /**
19+ * Describes a position in the document.
20+ * @see viewer#locations#PointProxy
21+ */
22+ struct PointProxy {
23+ /// The document.
24+ const Document& document;
25+ /// The position.
26+ const Position position;
27+ /// Creates a @c PointProxy instance.
28+ PointProxy(const Document& document, const Position& position) BOOST_NOEXCEPT : document(document), position(position) {}
29+ /// Returns a reference to @c #position.
30+ operator const Position&() const BOOST_NOEXCEPT {return position;}
31+ };
32+ }
33+
34+ template<>
35+ struct DocumentAccess<const locations::PointProxy> {
36+ static const Document& get(const locations::PointProxy& p) BOOST_NOEXCEPT {
37+ return p.document;
38+ }
39+ };
40+
41+ template<>
42+ struct PositionAccess<const locations::PointProxy> {
43+ static const Position& get(const locations::PointProxy& p) BOOST_NOEXCEPT {
44+ return p.position;
45+ }
46+ };
47+ }
48+}
49+
50+#endif // !ASCENSION_KERNEL_POINT_PROXY_HPP
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/kernel/point.hpp
--- a/ascension/ascension/kernel/point.hpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/ascension/kernel/point.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -7,7 +7,7 @@
77 #ifndef ASCENSION_KERNEL_POINT_HPP
88 #define ASCENSION_KERNEL_POINT_HPP
99 #include <ascension/kernel/abstract-point.hpp>
10-#include <ascension/kernel/position.hpp>
10+#include <ascension/kernel/point-proxy.hpp>
1111 #include <boost/operators.hpp>
1212
1313 namespace ascension {
@@ -19,7 +19,7 @@
1919 explicit Point(Document& document, const Position& position = kernel::Position::zero());
2020 Point(const Point& other);
2121 virtual ~Point() BOOST_NOEXCEPT;
22- operator std::pair<const Document&, Position>() const;
22+ operator locations::PointProxy() const;
2323
2424 /// @name Core Attribute
2525 const Position& position() const BOOST_NOEXCEPT;
@@ -60,17 +60,12 @@
6060 return lhs.position() < rhs.position();
6161 }
6262
63- /// @overload
64- inline const Position& position(const Point& p) BOOST_NOEXCEPT {
65- return p.position();
66- }
67-
6863
6964 // Point method inline implementation /////////////////////////////////////////////////////
7065
7166 /// Conversion operator for convenience.
72- inline Point::operator std::pair<const Document&, Position>() const {
73- return std::make_pair(std::ref(document()), position());
67+ inline Point::operator locations::PointProxy() const {
68+ return locations::PointProxy(document(), position());
7469 }
7570
7671 /**
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/kernel/position.hpp
--- a/ascension/ascension/kernel/position.hpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/ascension/kernel/position.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -112,40 +112,6 @@
112112 private:
113113 const boost::optional<Position> requestedPosition_;
114114 };
115-
116- /// @defgroup position_accessors Position Accessors
117- /// @{
118- /**
119- * Returns the line number of the given positional object.
120- * @tparam T The type of @a p. This should be able to pass to @c position function
121- * @param p The positional object
122- * @return The line number
123- */
124- template<typename T>
125- BOOST_CONSTEXPR inline Index line(const T& p) BOOST_NOEXCEPT {
126- return position(p).line;
127- }
128-
129- /**
130- * Returns the offset in the line of the given positional object.
131- * @tparam T The type of @a p. This should be able to pass to @c position function
132- * @param p The positional object
133- * @return The offset in the line
134- */
135- template<typename T>
136- BOOST_CONSTEXPR inline Index offsetInLine(const T& p) BOOST_NOEXCEPT {
137- return position(p).offsetInLine;
138- }
139-
140- /**
141- * Returns the position value of the given positional object.
142- * @param p The positional object
143- * @return The position value
144- */
145- inline const Position& position(const Position& p) BOOST_NOEXCEPT {
146- return p;
147- }
148- /// @}
149115 }
150116 } // namespace ascension.kernel
151117
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/kernel/region.hpp
--- a/ascension/ascension/kernel/region.hpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/ascension/kernel/region.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -7,7 +7,7 @@
77
88 #ifndef ASCENSION_REGION_HPP
99 #define ASCENSION_REGION_HPP
10-#include <ascension/kernel/position.hpp>
10+#include <ascension/kernel/access.hpp>
1111 #include <boost/range/irange.hpp>
1212 #include <utility> // std.max, std.min, std.pair, std.swap
1313
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/viewer/caret.hpp
--- a/ascension/ascension/viewer/caret.hpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/ascension/viewer/caret.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -13,6 +13,7 @@
1313 #include <ascension/corelib/text/newline.hpp>
1414 #include <ascension/kernel/document-observers.hpp>
1515 #include <ascension/viewer/caret-painter.hpp>
16+#include <ascension/viewer/point-proxy.hpp>
1617 #include <ascension/viewer/selected-region.hpp>
1718 #include <ascension/viewer/visual-point.hpp>
1819 #include <ascension/viewer/detail/input-method.hpp>
@@ -78,10 +79,10 @@
7879
7980 /// @name The Anchor and The Caret
8081 /// @{
81- const VisualPoint& anchor() const BOOST_NOEXCEPT;
82- const VisualPoint& beginning() const BOOST_NOEXCEPT;
82+ locations::PointProxy anchor() const BOOST_NOEXCEPT;
83+ locations::PointProxy beginning() const BOOST_NOEXCEPT;
8384 Caret& enableAutoShow(bool enable = true) BOOST_NOEXCEPT;
84- const VisualPoint& end() const BOOST_NOEXCEPT;
85+ locations::PointProxy end() const BOOST_NOEXCEPT;
8586 bool isAutoShowEnabled() const BOOST_NOEXCEPT;
8687 /// @}
8788
@@ -311,11 +312,13 @@
311312 // inline implementations /////////////////////////////////////////////////////////////////
312313
313314 /// Returns the anchor of the selection.
314- inline const VisualPoint& Caret::anchor() const BOOST_NOEXCEPT {return *anchor_;}
315+ inline locations::PointProxy Caret::anchor() const BOOST_NOEXCEPT {
316+ return locations::PointProxy(textArea(), boost::get_optional_value_or(anchor_, hit()));
317+ }
315318
316319 /// Returns the neighborhood to the beginning of the document among the anchor and this point.
317- inline const VisualPoint& Caret::beginning() const BOOST_NOEXCEPT {
318- return std::min(static_cast<const VisualPoint&>(*this), static_cast<const VisualPoint&>(*anchor_));
320+ inline locations::PointProxy Caret::beginning() const BOOST_NOEXCEPT {
321+ return locations::PointProxy(textArea(), std::min(hit(), anchor().hit));
319322 }
320323
321324 /**
@@ -341,8 +344,8 @@
341344 }
342345
343346 /// Returns the neighborhood to the end of the document among the anchor and this point.
344- inline const VisualPoint& Caret::end() const BOOST_NOEXCEPT {
345- return std::max(static_cast<const VisualPoint&>(*this), static_cast<const VisualPoint&>(*anchor_));
347+ inline locations::PointProxy Caret::end() const BOOST_NOEXCEPT {
348+ return locations::PointProxy(textArea(), std::max(hit(), anchor().hit));
346349 }
347350
348351 /// Returns @c true if the point will be shown automatically when moved. Default is @c true.
@@ -426,6 +429,34 @@
426429 } // namespace viewer
427430
428431 namespace kernel {
432+ template<>
433+ struct DocumentAccess<viewer::Caret> {
434+ static Document& get(viewer::Caret& p) BOOST_NOEXCEPT {
435+ return p.document();
436+ }
437+ };
438+
439+ template<>
440+ struct PositionAccess<viewer::Caret> {
441+ static Position get(viewer::Caret& p) BOOST_NOEXCEPT {
442+ return viewer::insertionPosition(p);
443+ }
444+ };
445+
446+ template<>
447+ struct DocumentAccess<const viewer::Caret> {
448+ static const Document& get(const viewer::Caret& p) BOOST_NOEXCEPT {
449+ return p.document();
450+ }
451+ };
452+
453+ template<>
454+ struct PositionAccess<const viewer::Caret> {
455+ static Position get(const viewer::Caret& p) BOOST_NOEXCEPT {
456+ return viewer::insertionPosition(p);
457+ }
458+ };
459+
429460 /**
430461 * @overload
431462 * @note There is no @c offsetInLine for @c viewer#Caret.
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/viewer/point-proxy.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ascension/ascension/viewer/point-proxy.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -0,0 +1,50 @@
1+/**
2+ * @file viewer/point-proxy.hpp
3+ * Defines @c viewer#locations#PointProxy class.
4+ * @author exeal
5+ * @date 2017-10-17 Separated from visual-locations.hpp.
6+ * @see kernel/point-proxy.hpp
7+ */
8+
9+#ifndef ASCENSION_VIEWER_POINT_PROXY_HPP
10+#define ASCENSION_VIEWER_POINT_PROXY_HPP
11+#include <ascension/kernel/point-proxy.hpp>
12+#include <ascension/viewer/text-hit.hpp>
13+
14+namespace ascension {
15+ namespace viewer {
16+ class TextArea;
17+
18+ namespace locations {
19+ /**
20+ * Describes a position in the @c TextArea.
21+ * @see kernel#locations#PointProxy
22+ */
23+ struct PointProxy {
24+ /// The text area.
25+ const TextArea& textArea;
26+ /// The text hit.
27+ const TextHit hit;
28+ /// Creates a @c PointProxy instance.
29+ PointProxy(const TextArea& textArea, const TextHit& hit) BOOST_NOEXCEPT : textArea(textArea), hit(hit) {}
30+ /// Returns a reference to @c #hit.
31+ operator const TextHit&() const BOOST_NOEXCEPT {return hit;}
32+ };
33+ }
34+
35+ kernel::locations::PointProxy insertionPosition(const locations::PointProxy& p);
36+ }
37+
38+ namespace kernel {
39+ template<>
40+ struct DocumentAccess<const viewer::locations::PointProxy> {
41+ static std::shared_ptr<const Document> get(const viewer::locations::PointProxy& p) BOOST_NOEXCEPT;
42+ };
43+ template<>
44+ struct PositionAccess<const viewer::locations::PointProxy> {
45+ static Position get(const viewer::locations::PointProxy& p) BOOST_NOEXCEPT;
46+ };
47+ }
48+}
49+
50+#endif // !ASCENSION_VIEWER_POINT_PROXY_HPP
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/viewer/text-area.hpp
--- a/ascension/ascension/viewer/text-area.hpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/ascension/viewer/text-area.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -12,6 +12,7 @@
1212 #include <ascension/graphics/font/text-renderer.hpp>
1313 #include <ascension/graphics/font/text-viewport-base.hpp>
1414 #include <ascension/graphics/font/visual-lines-listener.hpp>
15+#include <ascension/kernel/access.hpp>
1516 #include <ascension/kernel/document-observers.hpp>
1617 #include <ascension/presentation/flow-relative-two-axes.hpp>
1718 #include <ascension/viewer/detail/weak-reference-for-points.hpp>
@@ -158,12 +159,6 @@
158159 caretMotionConnection_, defaultFontChangedConnection_, matchBracketsChangedConnection_, selectionShapeChangedConnection_;
159160 };
160161
161- /// @addtogroup shortcuts_to_main_objects
162- /// @{
163- kernel::Document& document(TextArea& textArea);
164- const kernel::Document& document(const TextArea& textArea);
165- /// @}
166-
167162
168163 /// Returns the caret, or @c nullptr if not installed.
169164 inline std::shared_ptr<Caret> TextArea::caret() BOOST_NOEXCEPT {
@@ -205,6 +200,17 @@
205200 return viewport_;
206201 }
207202 }
203+
204+ namespace kernel {
205+ template<>
206+ struct DocumentAccess<viewer::TextArea> {
207+ static std::shared_ptr<Document> get(viewer::TextArea& textArea) BOOST_NOEXCEPT;
208+ };
209+ template<>
210+ struct DocumentAccess<const viewer::TextArea> {
211+ static std::shared_ptr<const Document> get(const viewer::TextArea& textArea) BOOST_NOEXCEPT;
212+ };
213+ }
208214 }
209215
210216 #endif // !ASCENSION_TEXT_AREA_HPP
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/viewer/text-hit.hpp
--- a/ascension/ascension/viewer/text-hit.hpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/ascension/viewer/text-hit.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -18,9 +18,17 @@
1818 namespace ascension {
1919 namespace kernel {
2020 class Document;
21+
22+ namespace locations {
23+ struct PointProxy;
24+ }
2125 }
2226
2327 namespace viewer {
28+ namespace locations {
29+ struct PointProxy;
30+ }
31+
2432 /**
2533 * Used by procedures which move @c VisualPoint.
2634 * @see graphics#font#TextHit
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/viewer/visual-locations.hpp
--- a/ascension/ascension/viewer/visual-locations.hpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/ascension/viewer/visual-locations.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -30,11 +30,7 @@
3030 * @see kernel#locations
3131 */
3232 namespace locations {
33- /**
34- * Describes a position in the @c TextArea.
35- * @see kernel#locations#PointProxy
36- */
37- typedef std::pair<const TextArea&, TextHit> PointProxy;
33+ struct PointProxy;
3834
3935 /// @defgroup special_locations_in_text_area Special Locations in Text Area
4036 /// Free functions related to special locations in @c TextArea.
@@ -58,10 +54,10 @@
5854 TextHit lastPrintableCharacterOfVisualLine(const PointProxy& p);
5955 /// @}
6056
61-#ifdef ASCENSION_ABANDONED_AT_VERSION_08
6257 /// @defgroup motions_in_text_area Motions in Text Area
6358 /// @note All functions are *affected* by accessible region of the document.
6459 /// @{
60+#ifdef ASCENSION_ABANDONED_AT_VERSION_08
6561 viewer::VisualDestinationProxy backwardPage(const PointProxy& p, Index pages = 1);
6662 viewer::VisualDestinationProxy backwardVisualLine(const PointProxy& p, Index lines = 1);
6763 viewer::VisualDestinationProxy forwardPage(const PointProxy& p, Index pages = 1);
@@ -74,12 +70,12 @@
7470 const VisualPoint& p, CharacterUnit unit, Index characters = 1);
7571 boost::optional<Position> rightWord(const PointProxy& p, Index words = 1);
7672 boost::optional<Position> rightWordEnd(const PointProxy& p, Index words = 1);
73+#endif // ASCENSION_ABANDONED_AT_VERSION_08
7774 /// @}
78-#endif // ASCENSION_ABANDONED_AT_VERSION_08
7975
8076 /// @defgroup miscellaneous_visual_locational_functions Miscellaneous Visual Locational Functions
8177 /// @{
82- TextHit updateTextHit(const TextHit& position, const kernel::DocumentChange& change, Direction gravity) BOOST_NOEXCEPT;
78+ TextHit updateTextHit(const TextHit& hit, const kernel::Document& document, const kernel::DocumentChange& change, Direction gravity);
8379 /// @}
8480 }
8581 }
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/ascension/viewer/visual-point.hpp
--- a/ascension/ascension/viewer/visual-point.hpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/ascension/viewer/visual-point.hpp Sun Oct 22 23:10:20 2017 +0900
@@ -12,10 +12,12 @@
1212 #ifndef ASCENSION_VISUAL_POINT_HPP
1313 #define ASCENSION_VISUAL_POINT_HPP
1414 #include <ascension/kernel/point.hpp>
15+#include <ascension/kernel/point-proxy.hpp>
1516 #include <ascension/graphics/font/visual-line.hpp>
1617 #include <ascension/graphics/font/visual-lines-listener.hpp>
1718 #include <ascension/graphics/geometry/point.hpp>
1819 #include <ascension/viewer/detail/weak-reference-for-points.hpp>
20+#include <ascension/viewer/point-proxy.hpp>
1921 #include <ascension/viewer/visual-destination-proxy.hpp>
2022
2123 namespace ascension {
@@ -67,8 +69,8 @@
6769 explicit VisualPoint(const graphics::font::TextHit<kernel::Point>& other);
6870 VisualPoint(const VisualPoint& other);
6971 virtual ~VisualPoint() BOOST_NOEXCEPT;
70- operator std::pair<const kernel::Document&, kernel::Position>() const;
71- operator std::pair<const TextArea&, TextHit>() const;
72+ operator kernel::locations::PointProxy() const;
73+ operator locations::PointProxy() const;
7274
7375 /// @name Installation
7476 /// @{
@@ -155,13 +157,13 @@
155157 }
156158
157159 /// Conversion operator into @c kernel#locations#PointProyx.
158- inline VisualPoint::operator std::pair<const kernel::Document&, kernel::Position>() const {
159- return std::make_pair(std::ref(document()), insertionPosition(*this));
160+ inline VisualPoint::operator kernel::locations::PointProxy() const {
161+ return kernel::locations::PointProxy(document(), insertionPosition(*this));
160162 }
161163
162164 /// Conversion operator into @c viewer#locations#PointProxy.
163- inline VisualPoint::operator std::pair<const TextArea&, TextHit>() const {
164- return std::make_pair(std::ref(textArea()), hit());
165+ inline VisualPoint::operator locations::PointProxy() const {
166+ return locations::PointProxy(textArea(), hit());
165167 }
166168
167169 /**
@@ -256,6 +258,34 @@
256258 } // namespace viewer
257259
258260 namespace kernel {
261+ template<>
262+ struct DocumentAccess<viewer::VisualPoint> {
263+ static Document& get(viewer::VisualPoint& p) BOOST_NOEXCEPT {
264+ return p.document();
265+ }
266+ };
267+
268+ template<>
269+ struct DocumentAccess<const viewer::VisualPoint> {
270+ static const Document& get(const viewer::VisualPoint& p) BOOST_NOEXCEPT {
271+ return p.document();
272+ }
273+ };
274+
275+ template<>
276+ struct PositionAccess<viewer::VisualPoint> {
277+ static Position get(viewer::VisualPoint& p) BOOST_NOEXCEPT {
278+ return viewer::insertionPosition(p);
279+ }
280+ };
281+
282+ template<>
283+ struct PositionAccess<const viewer::VisualPoint> {
284+ static Position get(const viewer::VisualPoint& p) BOOST_NOEXCEPT {
285+ return viewer::insertionPosition(p);
286+ }
287+ };
288+
259289 /**
260290 * @overload
261291 * @note There is no @c offsetInLine for @c viewer#VisualPoint.
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/src/kernel/locations.cpp
--- a/ascension/src/kernel/locations.cpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/src/kernel/locations.cpp Sun Oct 22 23:10:20 2017 +0900
@@ -15,6 +15,7 @@
1515 #include <ascension/kernel/document.hpp>
1616 #include <ascension/kernel/document-character-iterator.hpp>
1717 #include <ascension/kernel/locations.hpp>
18+#include <ascension/kernel/point-proxy.hpp>
1819 #include <boost/core/ignore_unused.hpp>
1920
2021
@@ -23,20 +24,6 @@
2324 namespace locations {
2425 namespace {
2526 template<typename T>
26- inline const Document& document(const T& p) BOOST_NOEXCEPT {
27- return std::get<0>(p);
28- }
29- template<typename T>
30- inline const Position& position(const T& p) BOOST_NOEXCEPT {
31- return std::get<1>(p);
32- }
33- inline Index line(const PointProxy& p) BOOST_NOEXCEPT {
34- return kernel::line(position(p));
35- }
36- inline Index offsetInLine(const PointProxy& p) BOOST_NOEXCEPT {
37- return kernel::offsetInLine(position(p));
38- }
39- template<typename T>
4027 inline void throwIfOutsideOfDocument(const T& p) {
4128 if(isOutsideOfDocumentRegion(p))
4229 throw BadPositionException(position(p));
@@ -89,7 +76,7 @@
8976 */
9077 Position beginningOfLine(const PointProxy& p) {
9178 throwIfOutsideOfDocument(p);
92- return shrinkToAccessibleRegion(makePointProxy(document(p), Position::bol(position(p))));
79+ return shrinkToAccessibleRegion(PointProxy(document(p), Position::bol(position(p))));
9380 }
9481
9582 /**
@@ -124,7 +111,7 @@
124111 Position endOfLine(const PointProxy& p) {
125112 throwIfOutsideOfDocument(p);
126113 const auto ln = line(p);
127- return shrinkToAccessibleRegion(makePointProxy(document(p), Position(ln, document(p).lineLength(ln))));
114+ return shrinkToAccessibleRegion(PointProxy(document(p), Position(ln, document(p).lineLength(ln))));
128115 }
129116
130117 /**
@@ -343,8 +330,8 @@
343330 */
344331 Region shrinkToAccessibleRegion(const Document& document, const Region& region) BOOST_NOEXCEPT {
345332 return Region(
346- shrinkToAccessibleRegion(makePointProxy(document, *boost::const_begin(region))),
347- shrinkToAccessibleRegion(makePointProxy(document, *boost::const_end(region))));
333+ shrinkToAccessibleRegion(PointProxy(document, *boost::const_begin(region))),
334+ shrinkToAccessibleRegion(PointProxy(document, *boost::const_end(region))));
348335 }
349336
350337 /**
@@ -364,8 +351,8 @@
364351 */
365352 Region shrinkToDocumentRegion(const Document& document, const Region& region) BOOST_NOEXCEPT {
366353 return Region(
367- shrinkToDocumentRegion(makePointProxy(document, *boost::const_begin(region))),
368- shrinkToDocumentRegion(makePointProxy(document, *boost::const_end(region))));
354+ shrinkToDocumentRegion(PointProxy(document, *boost::const_begin(region))),
355+ shrinkToDocumentRegion(PointProxy(document, *boost::const_end(region))));
369356 }
370357
371358 /**
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/src/kernel/point.cpp
--- a/ascension/src/kernel/point.cpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/src/kernel/point.cpp Sun Oct 22 23:10:20 2017 +0900
@@ -11,6 +11,7 @@
1111 #include <ascension/kernel/document-character-iterator.hpp>
1212 #include <ascension/kernel/locations.hpp>
1313 #include <ascension/kernel/point.hpp>
14+#include <ascension/kernel/point-proxy.hpp>
1415 #include <boost/core/ignore_unused.hpp>
1516
1617
@@ -157,11 +158,11 @@
157158 Point& Point::moveTo(const Position& to) {
158159 if(isDocumentDisposed())
159160 throw DocumentDisposedException();
160- else if(locations::isOutsideOfDocumentRegion(locations::makePointProxy(document(), to)))
161+ else if(locations::isOutsideOfDocumentRegion(locations::PointProxy(document(), to)))
161162 throw BadPositionException(to);
162163 Position destination(to);
163164 aboutToMove(destination);
164- destination = locations::shrinkToDocumentRegion(locations::makePointProxy(document(), destination));
165+ destination = locations::shrinkToDocumentRegion(locations::PointProxy(document(), destination));
165166 const Position from(position());
166167 position_ = destination;
167168 moved(from);
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/src/text-editor/commands/conversions.cpp
--- a/ascension/src/text-editor/commands/conversions.cpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/src/text-editor/commands/conversions.cpp Sun Oct 22 23:10:20 2017 +0900
@@ -40,9 +40,9 @@
4040 viewer::TextViewer& viewer = target();
4141 abortModes();
4242 const auto document(viewer::document(viewer));
43- const auto& peos = viewer.textArea()->caret()->end();
43+ const auto peos(viewer.textArea()->caret()->end());
4444 const auto eos(*boost::const_end(viewer.textArea()->caret()->selectedRegion()));
45- if(kernel::locations::isBeginningOfLine(peos) || (document->isNarrowed() && eos == *boost::const_begin(document->accessibleRegion())))
45+ if(kernel::locations::isBeginningOfLine(viewer::insertionPosition(peos)) || (document->isNarrowed() && eos == *boost::const_begin(document->accessibleRegion())))
4646 return false;
4747
4848 const auto caret(viewer.textArea()->caret());
@@ -55,7 +55,7 @@
5555 return false;
5656 }
5757 viewer::AutoFreeze af(&viewer);
58- caret->select(viewer::_anchor = kernel::Position(kernel::line(eos), kernel::offsetInLine(eos) - ((c > 0xffffu) ? 2 : 1)), viewer::_caret = peos.hit());
58+ caret->select(viewer::_anchor = kernel::Position(kernel::line(eos), kernel::offsetInLine(eos) - ((c > 0xffffu) ? 2 : 1)), viewer::_caret = peos);
5959 try {
6060 caret->replaceSelection(hex, false);
6161 } catch(const kernel::DocumentInput::ChangeRejectedException&) {
@@ -83,9 +83,9 @@
8383 const auto document(viewer::document(target()));
8484 const auto textArea(target().textArea());
8585 const auto caret(textArea->caret());
86- const auto& peos = caret->end();
86+ const auto peos(caret->end());
8787 const auto eos(*boost::const_end(caret->selectedRegion()));
88- if(kernel::locations::isBeginningOfLine(peos) || (document->isNarrowed() && eos == *boost::const_begin(document->accessibleRegion())))
88+ if(kernel::locations::isBeginningOfLine(viewer::insertionPosition(peos)) || (document->isNarrowed() && eos == *boost::const_begin(document->accessibleRegion())))
8989 return false;
9090
9191 const String& lineString = document->lineString(kernel::line(eos));
@@ -115,7 +115,7 @@
115115 if(i >= 2 && lineString[i - 1] == L'+' && (lineString[i - 2] == L'U' || lineString[i - 2] == L'u'))
116116 i -= 2;
117117 viewer::AutoFreeze af(&target());
118- caret->select(viewer::_anchor = kernel::Position(kernel::line(eos), i), viewer::_caret = peos.hit());
118+ caret->select(viewer::_anchor = kernel::Position(kernel::line(eos), i), viewer::_caret = peos);
119119 try {
120120 caret->replaceSelection(s, false);
121121 }
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/src/text-editor/commands/deletions.cpp
--- a/ascension/src/text-editor/commands/deletions.cpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/src/text-editor/commands/deletions.cpp Sun Oct 22 23:10:20 2017 +0900
@@ -76,11 +76,11 @@
7676 if(direction_ == Direction::forward())
7777 region = kernel::Region(
7878 *boost::const_begin(region),
79- kernel::locations::nextCharacter(caret->end(),
79+ kernel::locations::nextCharacter(viewer::insertionPosition(caret->end()),
8080 Direction::forward(), kernel::locations::GRAPHEME_CLUSTER, viewer::isSelectionEmpty(*caret) ? n : (n - 1)));
8181 else
8282 region = kernel::Region(
83- kernel::locations::nextCharacter(caret->beginning(),
83+ kernel::locations::nextCharacter(viewer::insertionPosition(caret->beginning()),
8484 Direction::backward(), kernel::locations::UTF32_CODE_UNIT, viewer::isSelectionEmpty(*caret) ? n : (n - 1)),
8585 *boost::const_end(region));
8686 try {
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/src/text-editor/commands/inputs.cpp
--- a/ascension/src/text-editor/commands/inputs.cpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/src/text-editor/commands/inputs.cpp Sun Oct 22 23:10:20 2017 +0900
@@ -166,7 +166,7 @@
166166 return false;
167167 }
168168 document->insertUndoBoundary();
169- caret->moveTo(caret->anchor().hit());
169+ caret->moveTo(caret->anchor());
170170 return true;
171171 }
172172
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/src/viewer/caret.cpp
--- a/ascension/src/viewer/caret.cpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/src/viewer/caret.cpp Sun Oct 22 23:10:20 2017 +0900
@@ -182,7 +182,7 @@
182182 /// @see VisualPoint#aboutToMove
183183 void Caret::aboutToMove(TextHit& to) {
184184 const auto ip(insertionPosition(document(), to));
185- if(kernel::locations::isOutsideOfDocumentRegion(kernel::locations::makePointProxy(document(), ip)))
185+ if(kernel::locations::isOutsideOfDocumentRegion(kernel::locations::PointProxy(document(), ip)))
186186 throw kernel::BadPositionException(ip, "Caret tried to move outside of document.");
187187 VisualPoint::aboutToMove(to);
188188 }
@@ -499,7 +499,7 @@
499499 if(validateSequence) {
500500 if(const texteditor::Session* const session = doc.session()) {
501501 if(const std::shared_ptr<const texteditor::InputSequenceCheckers> checker = session->inputSequenceCheckers()) {
502- const auto ip(insertionPosition(document(), beginning().hit()));
502+ const auto ip(insertionPosition(document(), beginning()));
503503 const Char* const lineString = doc.lineString(kernel::line(ip)).data();
504504 if(!checker->check(StringPiece(lineString, kernel::offsetInLine(ip)), character)) {
505505 eraseSelection(*this);
@@ -524,8 +524,7 @@
524524 destructiveInsert(*this, StringPiece(buffer, (character < 0x10000u) ? 1 : 2));
525525 doc.insertUndoBoundary();
526526 } else {
527- const bool alpha = kernel::detail::identifierSyntax(
528- static_cast<std::pair<const kernel::Document&, kernel::Position>>(*this)).isIdentifierContinueCharacter(character);
527+ const bool alpha = kernel::detail::identifierSyntax(*this).isIdentifierContinueCharacter(character);
529528 if(context_.lastTypedPosition != boost::none && (!alpha || boost::get(context_.lastTypedPosition) != insertionPosition(*this))) {
530529 // end sequential typing
531530 doc.insertUndoBoundary();
@@ -621,7 +620,7 @@
621620 const StringPiece lineString(document().lineString(kernel::line(hit().characterIndex())));
622621 StringPiece::const_iterator position(lineString.cbegin());
623622 if(boost::size(selectedRegion().lines()) == 1)
624- position += kernel::offsetInLine(insertionPosition(document(), beginning().hit()));
623+ position += kernel::offsetInLine(insertionPosition(document(), beginning()));
625624 return std::make_pair(lineString, position);
626625 }
627626
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/src/viewer/text-area.cpp
--- a/ascension/src/viewer/text-area.cpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/src/viewer/text-area.cpp Sun Oct 22 23:10:20 2017 +0900
@@ -946,5 +946,25 @@
946946 }
947947 }
948948 }
949+
950+ kernel::locations::PointProxy insertionPosition(const locations::PointProxy& p) {
951+ return kernel::locations::PointProxy(*kernel::document(p), insertionPosition(*kernel::document(p), p.hit));
952+ }
953+ }
954+
955+ std::shared_ptr<kernel::Document> kernel::DocumentAccess<viewer::TextArea>::get(viewer::TextArea& textArea) BOOST_NOEXCEPT {
956+ return kernel::document(textArea.textViewer());
957+ }
958+
959+ std::shared_ptr<const kernel::Document> kernel::DocumentAccess<const viewer::TextArea>::get(const viewer::TextArea& textArea) BOOST_NOEXCEPT {
960+ return kernel::document(textArea.textViewer());
961+ }
962+
963+ std::shared_ptr<const kernel::Document> kernel::DocumentAccess<const viewer::locations::PointProxy>::get(const viewer::locations::PointProxy& p) BOOST_NOEXCEPT {
964+ return kernel::document(p.textArea);
965+ }
966+
967+ kernel::Position kernel::PositionAccess<const viewer::locations::PointProxy>::get(const viewer::locations::PointProxy& p) BOOST_NOEXCEPT {
968+ return viewer::insertionPosition(p);
949969 }
950970 }
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/src/viewer/visual-locations.cpp
--- a/ascension/src/viewer/visual-locations.cpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/src/viewer/visual-locations.cpp Sun Oct 22 23:10:20 2017 +0900
@@ -14,6 +14,7 @@
1414 #include <ascension/graphics/font/text-layout.hpp>
1515 #include <ascension/graphics/font/text-viewport.hpp>
1616 #include <ascension/kernel/document.hpp>
17+#include <ascension/kernel/document-character-iterator.hpp>
1718 #include <ascension/kernel/locations.hpp>
1819 #include <ascension/viewer/caret.hpp>
1920 #include <ascension/viewer/text-area.hpp>
@@ -23,29 +24,23 @@
2324 namespace viewer {
2425 namespace locations {
2526 namespace {
26- inline const TextArea& textArea(const PointProxy& p) BOOST_NOEXCEPT {
27- return std::get<0>(p);
28- }
2927 inline const kernel::Document& document(const PointProxy& p) BOOST_NOEXCEPT {
30- return textArea(p).caret()->document();
31- }
32- inline const TextHit& hit(const PointProxy& p) BOOST_NOEXCEPT {
33- return std::get<1>(p);
28+ return p.textArea.caret()->document();
3429 }
3530 inline kernel::Position position(const PointProxy& p) BOOST_NOEXCEPT {
36- return insertionPosition(document(p), hit(p));
31+ return insertionPosition(document(p), p.hit);
3732 }
3833 inline kernel::Position normalPosition(const PointProxy& p) BOOST_NOEXCEPT {
39- return kernel::locations::shrinkToAccessibleRegion(kernel::locations::makePointProxy(document(p), position(p)));
34+ return kernel::locations::shrinkToAccessibleRegion(kernel::locations::PointProxy(document(p), position(p)));
4035 }
4136 inline TextHit normalHit(const PointProxy& p) BOOST_NOEXCEPT {
42- const auto np(kernel::locations::shrinkToAccessibleRegion(kernel::locations::makePointProxy(document(p), hit(p).characterIndex())));
43- if(np != hit(p).characterIndex() || kernel::locations::isEndOfLine(kernel::locations::makePointProxy(document(p), np)))
37+ const auto np(kernel::locations::shrinkToAccessibleRegion(kernel::locations::PointProxy(document(p), p.hit.characterIndex())));
38+ if(np != p.hit.characterIndex() || kernel::locations::isEndOfLine(kernel::locations::PointProxy(document(p), np)))
4439 return TextHit::leading(np);
45- return hit(p);
40+ return p.hit;
4641 }
47- inline std::pair<const kernel::Document&, kernel::Position> kernelProxy(const PointProxy& p) {
48- return kernel::locations::makePointProxy(document(p), position(p));
42+ inline kernel::locations::PointProxy kernelProxy(const PointProxy& p) {
43+ return kernel::locations::PointProxy(document(p), position(p));
4944 }
5045 inline graphics::font::TextHit<> inlineHit(const TextHit& hit) BOOST_NOEXCEPT {
5146 return graphics::font::transformTextHit(hit, [](const kernel::Position& p) {
@@ -107,7 +102,7 @@
107102 */
108103 TextHit beginningOfVisualLine(const PointProxy& p) {
109104 const auto h(normalHit(p));
110- if(const graphics::font::TextLayout* const layout = textArea(p).textRenderer()->layouts().at(kernel::line(h.characterIndex())))
105+ if(const graphics::font::TextLayout* const layout = p.textArea.textRenderer()->layouts().at(kernel::line(h.characterIndex())))
111106 return TextHit::leading(kernel::Position(kernel::line(h.characterIndex()), layout->lineOffset(layout->lineAt(inlineHit(h)))));
112107 return TextHit::leading(kernel::locations::beginningOfLine(kernelProxy(p)));
113108 }
@@ -160,7 +155,7 @@
160155 TextHit endOfVisualLine(const PointProxy& p) {
161156 auto h(normalHit(p));
162157 const auto line = kernel::line(h.characterIndex());
163- if(const graphics::font::TextLayout* const layout = textArea(p).textRenderer()->layouts().at(line)) {
158+ if(const graphics::font::TextLayout* const layout = p.textArea.textRenderer()->layouts().at(line)) {
164159 const Index subline = layout->lineAt(inlineHit(h));
165160 if(subline < layout->numberOfLines() - 1)
166161 return otherHit(document(p), TextHit::leading(kernel::Position(line, layout->lineOffset(subline + 1))));
@@ -191,7 +186,7 @@
191186 TextHit firstPrintableCharacterOfVisualLine(const PointProxy& p) {
192187 kernel::Position np(normalPosition(p));
193188 const String& s = document(p).lineString(kernel::line(np));
194- if(const graphics::font::TextLayout* const layout = textArea(p).textRenderer()->layouts().at(kernel::line(np))) {
189+ if(const graphics::font::TextLayout* const layout = p.textArea.textRenderer()->layouts().at(kernel::line(np))) {
195190 const Index subline = layout->lineAt(graphics::font::makeLeadingTextHit(kernel::offsetInLine(np)));
196191 np.offsetInLine = kernel::detail::identifierSyntax(kernelProxy(p)).eatWhiteSpaces(
197192 s.begin() + layout->lineOffset(subline),
@@ -258,7 +253,7 @@
258253 if(kernel::locations::isBeginningOfLine(kernelProxy(p))) // this considers narrowing
259254 return true;
260255 const kernel::Position np(normalPosition(p));
261- if(const graphics::font::TextLayout* const layout = textArea(p).textRenderer()->layouts().at(kernel::line(np)))
256+ if(const graphics::font::TextLayout* const layout = p.textArea.textRenderer()->layouts().at(kernel::line(np)))
262257 return kernel::offsetInLine(np) == layout->lineOffset(layout->lineAt(graphics::font::makeLeadingTextHit(kernel::offsetInLine(np))));
263258 return kernel::locations::isBeginningOfLine(kernelProxy(p));
264259 }
@@ -273,7 +268,7 @@
273268 if(kernel::locations::isEndOfLine(kernelProxy(p))) // this considers narrowing
274269 return true;
275270 const kernel::Position np(normalPosition(p));
276- if(const graphics::font::TextLayout* const layout = textArea(p).textRenderer()->layouts().at(kernel::line(np))) {
271+ if(const graphics::font::TextLayout* const layout = p.textArea.textRenderer()->layouts().at(kernel::line(np))) {
277272 const Index subline = layout->lineAt(graphics::font::makeLeadingTextHit(kernel::offsetInLine(np)));
278273 return kernel::offsetInLine(np) == layout->lineOffset(subline) + layout->lineLength(subline);
279274 }
diff -r 7668a9fffb7f -r 03f84de68d10 ascension/src/viewer/visual-point.cpp
--- a/ascension/src/viewer/visual-point.cpp Sun Oct 22 23:05:54 2017 +0900
+++ b/ascension/src/viewer/visual-point.cpp Sun Oct 22 23:10:20 2017 +0900
@@ -19,6 +19,7 @@
1919 #include <ascension/viewer/text-area.hpp>
2020 #include <ascension/viewer/text-viewer.hpp>
2121 #include <ascension/viewer/text-viewer-model-conversion.hpp>
22+#include <ascension/viewer/visual-locations.hpp>
2223 #include <ascension/viewer/visual-point.hpp>
2324 #ifndef ASCENSION_PIXELFUL_SCROLL_IN_BPD
2425 # include <boost/math/special_functions/trunc.hpp>
@@ -398,16 +399,16 @@
398399 #endif
399400 namespace {
400401 inline bool isOutsideOfDocumentRegion(const kernel::Document& document, const TextHit& hit) BOOST_NOEXCEPT {
401- return kernel::locations::isOutsideOfDocumentRegion(kernel::locations::makePointProxy(document, insertionPosition(document, hit)));
402+ return kernel::locations::isOutsideOfDocumentRegion(kernel::locations::PointProxy(document, insertionPosition(document, hit)));
402403 }
403404 inline TextHit shrinkToDocumentRegion(const kernel::Document& document, const TextHit& hit) BOOST_NOEXCEPT {
404405 if(kernel::line(hit.characterIndex()) >= document.numberOfLines())
405- return TextHit::leading(kernel::locations::endOfDocument(kernel::locations::makePointProxy(document, hit.characterIndex())));
406+ return TextHit::leading(kernel::locations::endOfDocument(kernel::locations::PointProxy(document, hit.characterIndex())));
406407 const Index line = kernel::line(hit.characterIndex());
407408 if(kernel::offsetInLine(hit.characterIndex()) < document.lineLength(line))
408409 return hit;
409410 else
410- return TextHit::leading(kernel::locations::endOfLine(kernel::locations::makePointProxy(document, hit.characterIndex())));
411+ return TextHit::leading(kernel::locations::endOfLine(kernel::locations::PointProxy(document, hit.characterIndex())));
411412 }
412413 }
413414
Show on old repository browser