summaryrefslogtreecommitdiff
path: root/src/strings/astring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings/astring.cpp')
-rw-r--r--src/strings/astring.cpp43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/strings/astring.cpp b/src/strings/astring.cpp
index f1e9030..f1f12c3 100644
--- a/src/strings/astring.cpp
+++ b/src/strings/astring.cpp
@@ -18,15 +18,25 @@
// 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 <cstdarg>
+#include <cstdio>
+#include <cstdlib>
+
+#include <algorithm>
+
#include "mstring.hpp"
#include "tstring.hpp"
#include "sstring.hpp"
#include "zstring.hpp"
#include "xstring.hpp"
-#include "vstring.hpp"
+#include "literal.hpp"
+// doing sneaky tricks here
//#include "../poison.hpp"
+
+namespace tmwa
+{
namespace strings
{
static_assert(sizeof(AString) == 256, "AString");
@@ -156,6 +166,13 @@ namespace strings
special = 255 - x.size();
}
}
+ AString::AString(LString l)
+ : data{}, special()
+ {
+ new(r_ptr()) RString();
+ special = 255;
+ *this = XString(l);
+ }
AString::iterator AString::begin() const
{
@@ -205,27 +222,5 @@ namespace strings
out = AString(buffer, buffer + len);
return len;
}
-
- AStringConverter::AStringConverter(AString& s)
- : out(s), mid(nullptr)
- {}
-
- AStringConverter::~AStringConverter()
- {
- if (mid)
- {
- out = ZString(really_construct_from_a_pointer, mid, nullptr);
- free(mid);
- }
- }
-
- char **AStringConverter::operator &()
- {
- return &mid;
- }
-
- AStringConverter convert_for_scanf(AString& s)
- {
- return AStringConverter(s);
- }
} // namespace strings
+} // namespace tmwa