summaryrefslogtreecommitdiff
path: root/AK/StringImpl.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-10-16 12:10:01 +0200
committerAndreas Kling <awesomekling@gmail.com>2018-10-16 12:11:27 +0200
commitfd708a4cb1b224bded754a335b42e40816609a9e (patch)
tree4b73635fa7d3ddb05cb38f52dafbeb2d217c1651 /AK/StringImpl.h
parent0c1a4e8de3285d5f7d02e8eec1b7186f0193e442 (diff)
downloadserenity-fd708a4cb1b224bded754a335b42e40816609a9e.zip
Reduce dependence on STL.
Diffstat (limited to 'AK/StringImpl.h')
-rw-r--r--AK/StringImpl.h11
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 };