Use StringDataPtr alias for RefPtr<StringData>
This commit is contained in:
parent
98972c18b7
commit
0eca3b5526
|
@ -59,7 +59,7 @@ private:
|
|||
ByteCoord m_coord;
|
||||
};
|
||||
|
||||
using BufferLines = Vector<RefPtr<StringData>, MemoryDomain::BufferContent>;
|
||||
using BufferLines = Vector<StringDataPtr, MemoryDomain::BufferContent>;
|
||||
|
||||
// A Buffer is a in-memory representation of a file
|
||||
//
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
StringView operator[](LineCount line) const
|
||||
{ return m_lines[line]; }
|
||||
|
||||
RefPtr<StringData> line_storage(LineCount line) const
|
||||
StringDataPtr line_storage(LineCount line) const
|
||||
{ return m_lines.get_storage(line); }
|
||||
|
||||
// returns an iterator at given coordinates. clamp line_and_column
|
||||
|
@ -174,11 +174,11 @@ private:
|
|||
struct LineList : BufferLines
|
||||
{
|
||||
[[gnu::always_inline]]
|
||||
RefPtr<StringData>& get_storage(LineCount line)
|
||||
StringDataPtr& get_storage(LineCount line)
|
||||
{ return BufferLines::operator[]((int)line); }
|
||||
|
||||
[[gnu::always_inline]]
|
||||
const RefPtr<StringData>& get_storage(LineCount line) const
|
||||
const StringDataPtr& get_storage(LineCount line) const
|
||||
{ return BufferLines::operator[]((int)line); }
|
||||
|
||||
[[gnu::always_inline]]
|
||||
|
|
|
@ -56,7 +56,9 @@ struct StringData : UseMemoryDomain<MemoryDomain::SharedString>
|
|||
}
|
||||
};
|
||||
|
||||
inline RefPtr<StringData> operator"" _ss(const char* ptr, size_t len)
|
||||
using StringDataPtr = RefPtr<StringData>;
|
||||
|
||||
inline StringDataPtr operator"" _ss(const char* ptr, size_t len)
|
||||
{
|
||||
return StringData::create({ptr, (int)len});
|
||||
}
|
||||
|
@ -103,15 +105,15 @@ public:
|
|||
return SharedString{StringView::substr(from, length), m_storage};
|
||||
}
|
||||
|
||||
explicit SharedString(RefPtr<StringData> storage)
|
||||
explicit SharedString(StringDataPtr storage)
|
||||
: StringView{storage->strview()}, m_storage(std::move(storage)) {}
|
||||
|
||||
private:
|
||||
SharedString(StringView str, RefPtr<StringData> storage)
|
||||
SharedString(StringView str, StringDataPtr storage)
|
||||
: StringView{str}, m_storage(std::move(storage)) {}
|
||||
|
||||
friend class StringRegistry;
|
||||
RefPtr<StringData> m_storage;
|
||||
StringDataPtr m_storage;
|
||||
};
|
||||
|
||||
inline size_t hash_value(const SharedString& str)
|
||||
|
@ -127,7 +129,7 @@ public:
|
|||
void purge_unused();
|
||||
|
||||
private:
|
||||
UnorderedMap<StringView, RefPtr<StringData>, MemoryDomain::SharedString> m_strings;
|
||||
UnorderedMap<StringView, StringDataPtr, MemoryDomain::SharedString> m_strings;
|
||||
};
|
||||
|
||||
inline SharedString intern(StringView str)
|
||||
|
|
|
@ -50,7 +50,7 @@ private:
|
|||
int refcount;
|
||||
};
|
||||
using WordToInfo = UnorderedMap<SharedString, WordInfo, MemoryDomain::WordDB>;
|
||||
using Lines = Vector<RefPtr<StringData>, MemoryDomain::WordDB>;
|
||||
using Lines = Vector<StringDataPtr, MemoryDomain::WordDB>;
|
||||
|
||||
SafePtr<const Buffer> m_buffer;
|
||||
size_t m_timestamp;
|
||||
|
|
Loading…
Reference in New Issue
Block a user