2021-06-09 10:02:01 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Gunnar Beutner <gbeutner@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-12-04 18:02:33 +00:00
|
|
|
#include <AK/DeprecatedString.h>
|
2021-06-09 10:02:01 +02:00
|
|
|
#include <AK/DistinctNumeric.h>
|
|
|
|
#include <AK/Vector.h>
|
|
|
|
|
|
|
|
namespace JS::Bytecode {
|
|
|
|
|
AK+Everywhere: Replace DistinctNumeric bool parameters with named ones
This means that rather than this:
```
AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, true, true, false, false,
false, true, FunctionAddress);
```
We now have this:
```
AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, FunctionAddress, Arithmetic,
Comparison, Increment);
```
Which is a lot more readable. :^)
Co-authored-by: Ali Mohammad Pur <mpfard@serenityos.org>
2022-11-10 15:43:23 +00:00
|
|
|
AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(size_t, StringTableIndex, Comparison);
|
2021-06-09 10:02:01 +02:00
|
|
|
|
|
|
|
class StringTable {
|
|
|
|
AK_MAKE_NONMOVABLE(StringTable);
|
|
|
|
AK_MAKE_NONCOPYABLE(StringTable);
|
|
|
|
|
|
|
|
public:
|
|
|
|
StringTable() = default;
|
|
|
|
|
2022-12-04 18:02:33 +00:00
|
|
|
StringTableIndex insert(DeprecatedString);
|
|
|
|
DeprecatedString const& get(StringTableIndex) const;
|
2021-06-09 10:02:01 +02:00
|
|
|
void dump() const;
|
|
|
|
bool is_empty() const { return m_strings.is_empty(); }
|
|
|
|
|
|
|
|
private:
|
2022-12-04 18:02:33 +00:00
|
|
|
Vector<DeprecatedString> m_strings;
|
2021-06-09 10:02:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|