mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
AK: Add FlyString::to_deprecated_fly_string()
This adds the conversion function to_deprecated_fly_string() to enable conversion from new FlyString to DeprecatedFlyString.
This commit is contained in:
parent
efabfd4c66
commit
03ceca4ca1
2 changed files with 9 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/DeprecatedFlyString.h>
|
||||||
#include <AK/FlyString.h>
|
#include <AK/FlyString.h>
|
||||||
#include <AK/HashMap.h>
|
#include <AK/HashMap.h>
|
||||||
#include <AK/Singleton.h>
|
#include <AK/Singleton.h>
|
||||||
|
@ -162,6 +163,11 @@ size_t FlyString::number_of_fly_strings()
|
||||||
return all_fly_strings().size();
|
return all_fly_strings().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeprecatedFlyString FlyString::to_deprecated_fly_string() const
|
||||||
|
{
|
||||||
|
return DeprecatedFlyString(bytes_as_string_view());
|
||||||
|
}
|
||||||
|
|
||||||
unsigned Traits<FlyString>::hash(FlyString const& fly_string)
|
unsigned Traits<FlyString>::hash(FlyString const& fly_string)
|
||||||
{
|
{
|
||||||
return fly_string.bytes_as_string_view().hash();
|
return fly_string.bytes_as_string_view().hash();
|
||||||
|
|
|
@ -51,6 +51,9 @@ public:
|
||||||
// This is primarily interesting to unit tests.
|
// This is primarily interesting to unit tests.
|
||||||
[[nodiscard]] static size_t number_of_fly_strings();
|
[[nodiscard]] static size_t number_of_fly_strings();
|
||||||
|
|
||||||
|
// FIXME: Remove this once all code has been ported to FlyString
|
||||||
|
[[nodiscard]] DeprecatedFlyString to_deprecated_fly_string() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// This will hold either the pointer to the Detail::StringData it represents or the raw bytes of
|
// This will hold either the pointer to the Detail::StringData it represents or the raw bytes of
|
||||||
// an inlined short string.
|
// an inlined short string.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue