summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-02-08 15:09:25 -0800
committerBen Longbons <b.r.longbons@gmail.com>2014-02-08 16:18:22 -0800
commit730e5dde39333cb2f63c72a7d7152bee5c4dbb05 (patch)
tree510ef3e0ad46ecf1f2bee1fa42f26e6377b51686 /src/common
parent7a15a3efe85837d52d950cc9f895eadcc9eb6be1 (diff)
downloadtmwa-730e5dde39333cb2f63c72a7d7152bee5c4dbb05.tar.gz
tmwa-730e5dde39333cb2f63c72a7d7152bee5c4dbb05.tar.bz2
tmwa-730e5dde39333cb2f63c72a7d7152bee5c4dbb05.tar.xz
tmwa-730e5dde39333cb2f63c72a7d7152bee5c4dbb05.zip
Implement AString
Diffstat (limited to 'src/common')
-rw-r--r--src/common/dumb_ptr.hpp4
-rw-r--r--src/common/extract.cpp4
-rw-r--r--src/common/extract.hpp2
-rw-r--r--src/common/intern-pool.hpp9
-rw-r--r--src/common/mmo.hpp3
-rw-r--r--src/common/socket.hpp6
-rw-r--r--src/common/utils.cpp2
7 files changed, 16 insertions, 14 deletions
diff --git a/src/common/dumb_ptr.hpp b/src/common/dumb_ptr.hpp
index 1ac237a..bf97f22 100644
--- a/src/common/dumb_ptr.hpp
+++ b/src/common/dumb_ptr.hpp
@@ -25,7 +25,7 @@
# include <algorithm>
-# include "../strings/fstring.hpp"
+# include "../strings/astring.hpp"
# include "../strings/zstring.hpp"
# include "../strings/xstring.hpp"
@@ -246,7 +246,7 @@ struct dumb_string
return ZString(strings::really_construct_from_a_pointer, c_str(), nullptr);
}
- FString str() const
+ AString str() const
{
return ZString(*this);
}
diff --git a/src/common/extract.cpp b/src/common/extract.cpp
index bac7b38..5c07e24 100644
--- a/src/common/extract.cpp
+++ b/src/common/extract.cpp
@@ -18,7 +18,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/xstring.hpp"
#include "../strings/vstring.hpp"
@@ -30,7 +30,7 @@ bool extract(XString str, XString *rv)
return true;
}
-bool extract(XString str, FString *rv)
+bool extract(XString str, AString *rv)
{
*rv = str;
return true;
diff --git a/src/common/extract.hpp b/src/common/extract.hpp
index e798204..31cf111 100644
--- a/src/common/extract.hpp
+++ b/src/common/extract.hpp
@@ -84,7 +84,7 @@ bool extract(XString str, T *iv)
bool extract(XString str, XString *rv);
-bool extract(XString str, FString *rv);
+bool extract(XString str, AString *rv);
template<uint8_t N>
bool extract(XString str, VString<N> *out)
diff --git a/src/common/intern-pool.hpp b/src/common/intern-pool.hpp
index 163e5cc..e75a359 100644
--- a/src/common/intern-pool.hpp
+++ b/src/common/intern-pool.hpp
@@ -6,18 +6,19 @@
# include <map>
# include <vector>
-# include "../strings/fstring.hpp"
+# include "../strings/rstring.hpp"
# include "../strings/zstring.hpp"
# include "../strings/xstring.hpp"
class InternPool
{
- std::map<FString, size_t> known;
- std::vector<FString> names;
+ std::map<RString, size_t> known;
+ std::vector<RString> names;
public:
size_t intern(XString name_)
{
- FString name = name_;
+ // TODO just look up the XString, the memory should not move by now
+ RString name = name_;
// hm, I could change this to do aliases
auto pair = known.insert({name, known.size()});
if (pair.second)
diff --git a/src/common/mmo.hpp b/src/common/mmo.hpp
index 8b18181..b2f36b6 100644
--- a/src/common/mmo.hpp
+++ b/src/common/mmo.hpp
@@ -69,7 +69,8 @@ public:
iterator end() const { return &*_impl.end(); }
const char *c_str() const { return _impl.c_str(); }
- operator FString() const { return _impl; }
+ operator RString() const { return _impl; }
+ operator AString() const { return _impl; }
operator TString() const { return _impl; }
operator SString() const { return _impl; }
operator ZString() const { return _impl; }
diff --git a/src/common/socket.hpp b/src/common/socket.hpp
index 6d0ca01..e0847ac 100644
--- a/src/common/socket.hpp
+++ b/src/common/socket.hpp
@@ -9,7 +9,7 @@
# include <array>
-# include "../strings/fstring.hpp"
+# include "../strings/astring.hpp"
# include "../strings/vstring.hpp"
# include "../strings/xstring.hpp"
@@ -183,7 +183,7 @@ VString<len-1> RFIFO_STRING(Session *s, size_t pos)
return XString(begin, mid, nullptr);
}
inline
-FString RFIFO_STRING(Session *s, size_t pos, size_t len)
+AString RFIFO_STRING(Session *s, size_t pos, size_t len)
{
const char *const begin = static_cast<const char *>(RFIFOP(s, pos));
const char *const end = begin + len;
@@ -242,7 +242,7 @@ VString<len-1> RBUF_STRING(const uint8_t *p, size_t pos)
return XString(begin, mid, nullptr);
}
inline
-FString RBUF_STRING(const uint8_t *p, size_t pos, size_t len)
+AString RBUF_STRING(const uint8_t *p, size_t pos, size_t len)
{
const char *const begin = static_cast<const char *>(RBUFP(p, pos));
const char *const end = begin + len;
diff --git a/src/common/utils.cpp b/src/common/utils.cpp
index 3a26e6d..0dbf145 100644
--- a/src/common/utils.cpp
+++ b/src/common/utils.cpp
@@ -5,7 +5,7 @@
#include <algorithm>
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"