Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
SimpleTextStore.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Frameworks_Led_SimpleTextStore_h_
5#define _Stroika_Frameworks_Led_SimpleTextStore_h_ 1
6
7#include "Stroika/Frameworks/StroikaPreComp.h"
8
9/*
10@MODULE: SimpleTextStore
11@DESCRIPTION:
12 <p>SimpleTextStore is a module for the implementation of the class - @'SimpleTextStore' -
13 a very simple implementation of the @'TextStore' class.</p>
14 */
15
16#include "Stroika/Frameworks/Led/TextStore.h"
17
18namespace Stroika::Frameworks::Led {
19
20 /*
21 @CLASS: SimpleTextStore
22 @BASES: @'TextStore'
23 @DESCRIPTION:
24 <p>SimpleTextStore is a very simple implementation of the TextStore API.
25 It is useful as a starting point for any new TextStore implementations, because of
26 its simplicity. And it is useful for understanding.</p>
27 */
28 class SimpleTextStore : public TextStore {
29 public:
30 SimpleTextStore ();
31 virtual ~SimpleTextStore ();
32
33 public:
34 virtual TextStore* ConstructNewTextStore () const override;
35
36 public:
37 virtual size_t GetLength () const noexcept override;
38 virtual void CopyOut (size_t from, size_t count, Led_tChar* buffer) const noexcept override;
39 virtual void ReplaceWithoutUpdate (size_t from, size_t to, const Led_tChar* withWhat, size_t withWhatCount) override;
40
41 protected:
42 nonvirtual void InsertAfter_ (const Led_tChar* what, size_t howMany, size_t after);
43 nonvirtual void DeleteAfter_ (size_t howMany, size_t after);
44
45 public:
46 virtual void AddMarker (Marker* marker, size_t lhs, size_t length, MarkerOwner* owner) override;
47 virtual void RemoveMarkers (Marker* const markerArray[], size_t markerCount) override;
48 virtual void PreRemoveMarker (Marker* marker) override;
49 virtual void SetMarkerRange (Marker* m, size_t start, size_t end) noexcept override;
50 virtual void CollectAllMarkersInRangeInto (size_t from, size_t to, const MarkerOwner* owner, MarkerSink& output) const override;
51
52 private:
53 size_t fLength;
54 Led_tChar* fBuffer;
55 vector<Marker*> fMarkers;
56
57#if qStroika_Foundation_Debug_AssertionsChecked
58 protected:
59 virtual void Invariant_ () const override;
60#endif
61 };
62
63}
64
65/*
66 ********************************************************************************
67 ***************************** Implementation Details ***************************
68 ********************************************************************************
69 */
70#include "SimpleTextStore.inl"
71
72#endif /*_Stroika_Frameworks_Led_SimpleTextStore_h_*/