diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-10-16 12:10:01 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-10-16 12:11:27 +0200 |
commit | fd708a4cb1b224bded754a335b42e40816609a9e (patch) | |
tree | 4b73635fa7d3ddb05cb38f52dafbeb2d217c1651 /AK/StringImpl.h | |
parent | 0c1a4e8de3285d5f7d02e8eec1b7186f0193e442 (diff) | |
download | serenity-fd708a4cb1b224bded754a335b42e40816609a9e.zip |
Reduce dependence on STL.
Diffstat (limited to 'AK/StringImpl.h')
-rw-r--r-- | AK/StringImpl.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/AK/StringImpl.h b/AK/StringImpl.h index 64c4f87415..2278438f6c 100644 --- a/AK/StringImpl.h +++ b/AK/StringImpl.h @@ -2,12 +2,13 @@ #include "Retainable.h" #include "RetainPtr.h" +#include "Types.h" namespace AK { class StringImpl : public Retainable<StringImpl> { public: - static RetainPtr<StringImpl> createUninitialized(unsigned length, char*& buffer); + static RetainPtr<StringImpl> createUninitialized(size_t length, char*& buffer); static RetainPtr<StringImpl> create(const char* cstring); static RetainPtr<StringImpl> create(const char* cstring, size_t length); RetainPtr<StringImpl> toLowercase() const; @@ -17,9 +18,9 @@ public: ~StringImpl(); - unsigned length() const { return m_length; } + size_t length() const { return m_length; } const char* characters() const { return m_characters; } - char operator[](unsigned i) const { ASSERT(i < m_length); return m_characters[i]; } + char operator[](size_t i) const { ASSERT(i < m_length); return m_characters[i]; } unsigned hash() const { @@ -33,11 +34,11 @@ private: explicit StringImpl(ConstructTheEmptyStringImplTag) : m_characters("") { } enum ConstructWithInlineBufferTag { ConstructWithInlineBuffer }; - explicit StringImpl(ConstructWithInlineBufferTag, unsigned length) : m_length(length), m_characters(m_inlineBuffer) { } + explicit StringImpl(ConstructWithInlineBufferTag, size_t length) : m_length(length), m_characters(m_inlineBuffer) { } void computeHash() const; - unsigned m_length { 0 }; + size_t m_length { 0 }; bool m_ownsBuffer { true }; mutable bool m_hasHash { false }; const char* m_characters { nullptr }; |