summaryrefslogtreecommitdiff
path: root/src/strings/fstring.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings/fstring.hpp')
-rw-r--r--src/strings/fstring.hpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/strings/fstring.hpp b/src/strings/fstring.hpp
index b025d74..48da326 100644
--- a/src/strings/fstring.hpp
+++ b/src/strings/fstring.hpp
@@ -2,7 +2,7 @@
#define TMWA_STRINGS_FSTRING_HPP
// strings/fstring.hpp - An owned, reference-counted immutable string.
//
-// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
+// Copyright © 2013-2014 Ben Longbons <b.r.longbons@gmail.com>
//
// This file is part of The Mana World (Athena server)
//
@@ -22,24 +22,34 @@
# include <cstdarg>
# include <cstring>
-# include <memory>
-# include <vector>
-
# include "base.hpp"
namespace strings
{
/// An owning string that has reached its final contents.
/// The storage is NUL-terminated
- /// TODO reimplement without std::shared_ptr
class FString : public _crtp_string<FString, FString, ZPair>
{
- std::shared_ptr<std::vector<char>> _hack2;
+ struct Rep
+ {
+ size_t count;
+ size_t size;
+ char body[];
+ };
+ static
+ uint8_t empty_string_rep[sizeof(Rep) + 1];
+
+ Rep *owned;
template<class It>
void _assign(It b, It e);
public:
FString();
+ FString(const FString&);
+ FString(FString&&);
+ FString& operator = (const FString&);
+ FString& operator = (FString&&);
+ ~FString();
explicit FString(const MString& s);