mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +00:00
LibJS: Replace Vector<u16> usage in PrimitiveString wth Utf16String
This commit does not go out of its way to reduce copying of the string data yet, but is a minimum set of changes to compile LibJS after making PrimitiveString hold a Utf16String.
This commit is contained in:
parent
02e7dceb96
commit
c1e99fca1a
11 changed files with 80 additions and 87 deletions
|
@ -7,15 +7,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibJS/Heap/Cell.h>
|
||||
#include <LibJS/Runtime/Utf16String.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
class PrimitiveString final : public Cell {
|
||||
public:
|
||||
explicit PrimitiveString(String);
|
||||
explicit PrimitiveString(Vector<u16>);
|
||||
explicit PrimitiveString(Utf16String);
|
||||
virtual ~PrimitiveString();
|
||||
|
||||
PrimitiveString(PrimitiveString const&) = delete;
|
||||
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
String const& string() const;
|
||||
|
||||
Vector<u16> const& utf16_string() const;
|
||||
Utf16String const& utf16_string() const;
|
||||
Utf16View utf16_string_view() const;
|
||||
|
||||
private:
|
||||
|
@ -32,15 +32,15 @@ private:
|
|||
mutable String m_utf8_string;
|
||||
mutable bool m_has_utf8_string { false };
|
||||
|
||||
mutable Vector<u16> m_utf16_string;
|
||||
mutable Utf16String m_utf16_string;
|
||||
mutable bool m_has_utf16_string { false };
|
||||
};
|
||||
|
||||
PrimitiveString* js_string(Heap&, Utf16View const&);
|
||||
PrimitiveString* js_string(VM&, Utf16View const&);
|
||||
|
||||
PrimitiveString* js_string(Heap&, Vector<u16>);
|
||||
PrimitiveString* js_string(VM&, Vector<u16>);
|
||||
PrimitiveString* js_string(Heap&, Utf16String);
|
||||
PrimitiveString* js_string(VM&, Utf16String);
|
||||
|
||||
PrimitiveString* js_string(Heap&, String);
|
||||
PrimitiveString* js_string(VM&, String);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue