Stroika Library 3.0d18
 
Loading...
Searching...
No Matches
Marker.cpp
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#include "Stroika/Frameworks/StroikaPreComp.h"
5
6#include "TextStore.h"
7
8#include "Marker.h"
9
10using namespace Stroika::Foundation;
11
12using namespace Stroika::Frameworks;
13using namespace Stroika::Frameworks::Led;
14
15/*
16 ********************************************************************************
17 ********************************** MarkerOwner *********************************
18 ********************************************************************************
19 */
20/*
21@METHOD: MarkerOwner::FindNextCharacter
22@DESCRIPTION: <p>Return the associated @'TextStore::FindNextCharacter' ().</p>
23*/
24size_t MarkerOwner::FindNextCharacter (size_t afterPos) const
25{
26 return GetTextStore ().FindNextCharacter (afterPos);
27}
28
29/*
30@METHOD: MarkerOwner::FindPreviousCharacter
31@DESCRIPTION: <p>Return the associated @'TextStore::FindPreviousCharacter' ().</p>
32*/
33size_t MarkerOwner::FindPreviousCharacter (size_t beforePos) const
34{
35 return GetTextStore ().FindPreviousCharacter (beforePos);
36}
37
38/*
39@METHOD: MarkerOwner::GetLength
40@DESCRIPTION: <p>Return the associated @'TextStore::GetLength' ().</p>
41*/
42size_t MarkerOwner::GetLength () const
43{
44 return GetTextStore ().GetLength ();
45}
46
47/*
48@METHOD: MarkerOwner::GetEnd
49@DESCRIPTION: <p>Return the associated @'TextStore::GetEnd' ().</p>
50*/
51size_t MarkerOwner::GetEnd () const
52{
53 return GetTextStore ().GetEnd ();
54}
55
56/*
57@METHOD: MarkerOwner::CopyOut
58@DESCRIPTION: <p>Calls the associated @'TextStore::CopyOut' ().</p>
59*/
60void MarkerOwner::CopyOut (size_t from, size_t count, Led_tChar* buffer) const
61{
62 GetTextStore ().CopyOut (from, count, buffer);
63}
64
65/*
66 ********************************************************************************
67 ************************************ TempMarker ********************************
68 ********************************************************************************
69 */
70TempMarker::TempMarker (TextStore& ts, size_t start, size_t end)
71 : fTextStore{ts}
72{
73 Require (start <= end);
74 GetTextStore ().AddMarkerOwner (this);
75 try {
76 GetTextStore ().AddMarker (&fMarker, start, end - start, this);
77 }
78 catch (...) {
79 GetTextStore ().RemoveMarkerOwner (this);
80 throw;
81 }
82}
83
84TempMarker::~TempMarker ()
85{
86 try {
87 GetTextStore ().RemoveMarker (&fMarker);
88 }
89 catch (...) {
90 }
91 try {
92 GetTextStore ().RemoveMarkerOwner (this);
93 }
94 catch (...) {
95 }
96}
97
98TextStore* TempMarker::PeekAtTextStore () const
99{
100 return &fTextStore;
101}