summaryrefslogtreecommitdiff
path: root/src/interned_string.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-10-07 09:15:32 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-10-07 09:16:19 +0100
commitb097bbbf52a8e6c7b2465b883f6b131831e5b808 (patch)
tree1b3f60baf7e2ca3161d8f831fc0b289d5cb671d3 /src/interned_string.hh
parentf3fb299359450230ac1da1238ab8cd590d0976f7 (diff)
WordDB: Use interned strings pointing directly into the buffer line data
Diffstat (limited to 'src/interned_string.hh')
-rw-r--r--src/interned_string.hh15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/interned_string.hh b/src/interned_string.hh
index c1bf3517..d21ce26f 100644
--- a/src/interned_string.hh
+++ b/src/interned_string.hh
@@ -79,6 +79,21 @@ public:
using StringView::operator==;
using StringView::operator!=;
+ InternedString acquire_substr(ByteCount from, ByteCount length = INT_MAX) const
+ {
+ if (m_slot == -1)
+ return InternedString{};
+ StringRegistry::instance().acquire(m_slot);
+ return InternedString{StringView::substr(from, length), m_slot};
+ }
+ InternedString acquire_substr(CharCount from, CharCount length = INT_MAX) const
+ {
+ if (m_slot == -1)
+ return InternedString{};
+ StringRegistry::instance().acquire(m_slot);
+ return InternedString{StringView::substr(from, length), m_slot};
+ }
+
private:
friend class StringRegistry;