From 2f4fc005937e75d931eb6ef87a3fe16364d45113 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Thu, 26 Jun 2014 21:59:27 -0700 Subject: Stick everything in a namespace --- src/strings/all.hpp | 5 +++++ src/strings/astring.cpp | 4 ++++ src/strings/astring.hpp | 4 ++++ src/strings/astring.py | 2 +- src/strings/astring.tcc | 4 ++++ src/strings/base.hpp | 4 ++++ src/strings/base.tcc | 4 ++++ src/strings/base_test.cpp | 4 ++++ src/strings/fwd.hpp | 4 ++++ src/strings/literal.cpp | 4 ++++ src/strings/literal.hpp | 4 ++++ src/strings/mstring.cpp | 4 ++++ src/strings/mstring.hpp | 4 ++++ src/strings/pair.hpp | 4 ++++ src/strings/rstring.cpp | 4 ++++ src/strings/rstring.hpp | 4 ++++ src/strings/rstring.py | 2 +- src/strings/rstring.tcc | 4 ++++ src/strings/sstring.cpp | 4 ++++ src/strings/sstring.hpp | 4 ++++ src/strings/sstring.tcc | 4 ++++ src/strings/strings2_test.cpp | 3 +++ src/strings/strings_test.cpp | 3 +++ src/strings/tstring.cpp | 4 ++++ src/strings/tstring.hpp | 4 ++++ src/strings/tstring.tcc | 4 ++++ src/strings/vstring.cpp | 4 ++++ src/strings/vstring.hpp | 4 ++++ src/strings/vstring.py | 2 +- src/strings/vstring.tcc | 4 ++++ src/strings/xstring.cpp | 4 ++++ src/strings/xstring.hpp | 4 ++++ src/strings/xstring.py | 2 +- src/strings/xstring.tcc | 4 ++++ src/strings/zstring.cpp | 4 ++++ src/strings/zstring.hpp | 4 ++++ src/strings/zstring.py | 2 +- src/strings/zstring.tcc | 4 ++++ 38 files changed, 136 insertions(+), 5 deletions(-) (limited to 'src/strings') diff --git a/src/strings/all.hpp b/src/strings/all.hpp index 6b67bee..9311ba4 100644 --- a/src/strings/all.hpp +++ b/src/strings/all.hpp @@ -32,4 +32,9 @@ # include "literal.hpp" # include "vstring.hpp" + +namespace tmwa +{ +} // namespace tmwa + #endif // TMWA_STRINGS_ALL_HPP diff --git a/src/strings/astring.cpp b/src/strings/astring.cpp index 9811f17..f1f12c3 100644 --- a/src/strings/astring.cpp +++ b/src/strings/astring.cpp @@ -34,6 +34,9 @@ // doing sneaky tricks here //#include "../poison.hpp" + +namespace tmwa +{ namespace strings { static_assert(sizeof(AString) == 256, "AString"); @@ -220,3 +223,4 @@ namespace strings return len; } } // namespace strings +} // namespace tmwa diff --git a/src/strings/astring.hpp b/src/strings/astring.hpp index 9e9adc2..cf33cc5 100644 --- a/src/strings/astring.hpp +++ b/src/strings/astring.hpp @@ -24,6 +24,9 @@ # include "base.hpp" # include "rstring.hpp" + +namespace tmwa +{ namespace strings { /// An owning string that has reached its final contents. @@ -77,6 +80,7 @@ namespace strings __attribute__((format(printf, 2, 0))) int do_vprint(AString& out, const char *fmt, va_list ap); } // namespace strings +} // namespace tmwa # include "astring.tcc" diff --git a/src/strings/astring.py b/src/strings/astring.py index ec1dafe..063e721 100644 --- a/src/strings/astring.py +++ b/src/strings/astring.py @@ -2,7 +2,7 @@ class AString(object): ''' print an AString ''' __slots__ = ('_value') - name = 'strings::AString' + name = 'tmwa::strings::AString' enabled = True def __init__(self, value): diff --git a/src/strings/astring.tcc b/src/strings/astring.tcc index f9606d8..f2d0dc9 100644 --- a/src/strings/astring.tcc +++ b/src/strings/astring.tcc @@ -19,6 +19,9 @@ #include "mstring.hpp" + +namespace tmwa +{ namespace strings { template @@ -57,3 +60,4 @@ namespace strings new(r_ptr()) RString(); } } // namespace strings +} // namespace tmwa diff --git a/src/strings/base.hpp b/src/strings/base.hpp index b1aff34..122d46d 100644 --- a/src/strings/base.hpp +++ b/src/strings/base.hpp @@ -26,6 +26,9 @@ # include + +namespace tmwa +{ // It is a common mistake to assume that one string class for everything. // Because C++ and TMWA have a C legacy, there are a few more here // than would probably be necessary in an ideal language. @@ -195,6 +198,7 @@ namespace strings template::value>::type> auto operator >= (const L& l, const R& r) -> decltype((pair_compare(l, r), true)); } // namespace strings +} // namespace tmwa # include "base.tcc" diff --git a/src/strings/base.tcc b/src/strings/base.tcc index 8b7982b..83dff70 100644 --- a/src/strings/base.tcc +++ b/src/strings/base.tcc @@ -23,6 +23,9 @@ #include "pair.hpp" + +namespace tmwa +{ namespace strings { namespace detail @@ -442,3 +445,4 @@ namespace strings return pair_compare(l, r) >= 0; } } // namespace strings +} // namespace tmwa diff --git a/src/strings/base_test.cpp b/src/strings/base_test.cpp index cab47be..2083fdc 100644 --- a/src/strings/base_test.cpp +++ b/src/strings/base_test.cpp @@ -30,6 +30,9 @@ #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + +namespace tmwa +{ using namespace strings; struct _test : VString<1> {}; @@ -50,3 +53,4 @@ TEST(strings, contains) EXPECT_TRUE(hi.contains_any("Hi"_s)); EXPECT_FALSE(hi.contains_any("hi"_s)); } +} // namespace tmwa diff --git a/src/strings/fwd.hpp b/src/strings/fwd.hpp index de86301..4f1fe89 100644 --- a/src/strings/fwd.hpp +++ b/src/strings/fwd.hpp @@ -24,6 +24,9 @@ # include # include + +namespace tmwa +{ // It is a common mistake to assume that one string class for everything. // Because C++ and TMWA have a C legacy, there are a few more here // than would probably be necessary in an ideal language. @@ -70,5 +73,6 @@ using strings::VString; using strings::operator "" _s; using strings::operator "" _fmt; +} // namespace tmwa #endif // TMWA_STRINGS_FWD_HPP diff --git a/src/strings/literal.cpp b/src/strings/literal.cpp index 506b79b..252bfcb 100644 --- a/src/strings/literal.cpp +++ b/src/strings/literal.cpp @@ -22,6 +22,9 @@ #include "../poison.hpp" + +namespace tmwa +{ namespace strings { LString::LString(const char *b, const char *e) @@ -50,3 +53,4 @@ namespace strings return zs.c_str(); } } // namespace strings +} // namespace tmwa diff --git a/src/strings/literal.hpp b/src/strings/literal.hpp index 001dc46..207ccff 100644 --- a/src/strings/literal.hpp +++ b/src/strings/literal.hpp @@ -23,6 +23,9 @@ # include "base.hpp" + +namespace tmwa +{ namespace strings { /// A statically owned string that is guaranteed to be NUL-terminated. @@ -73,5 +76,6 @@ namespace strings return FormatString(s); } } // namespace strings +} // namespace tmwa #endif // TMWA_STRINGS_LSTRING_HPP diff --git a/src/strings/mstring.cpp b/src/strings/mstring.cpp index 2a1ca62..d48bff2 100644 --- a/src/strings/mstring.cpp +++ b/src/strings/mstring.cpp @@ -22,6 +22,9 @@ #include "../poison.hpp" + +namespace tmwa +{ namespace strings { MString::iterator MString::begin() @@ -100,3 +103,4 @@ namespace strings return _hack.back(); } } // namespace strings +} // namespace tmwa diff --git a/src/strings/mstring.hpp b/src/strings/mstring.hpp index 47becc4..b1ecce3 100644 --- a/src/strings/mstring.hpp +++ b/src/strings/mstring.hpp @@ -23,6 +23,9 @@ # include + +namespace tmwa +{ namespace strings { /// An owning string that is still expected to change. @@ -62,5 +65,6 @@ namespace strings char& back(); }; } // namespace strings +} // namespace tmwa #endif // TMWA_STRINGS_MSTRING_HPP diff --git a/src/strings/pair.hpp b/src/strings/pair.hpp index cd59537..e249d9e 100644 --- a/src/strings/pair.hpp +++ b/src/strings/pair.hpp @@ -21,6 +21,9 @@ # include "fwd.hpp" + +namespace tmwa +{ namespace strings { // TODO instead typedef ranges::Contiguous @@ -60,5 +63,6 @@ namespace strings {} }; } // namespace strings +} // namespace tmwa #endif // TMWA_STRINGS_PAIR_HPP diff --git a/src/strings/rstring.cpp b/src/strings/rstring.cpp index c2ca64b..3e5a46d 100644 --- a/src/strings/rstring.cpp +++ b/src/strings/rstring.cpp @@ -31,6 +31,9 @@ // doing sneaky tricks here //#include "../poison.hpp" + +namespace tmwa +{ namespace strings { static_assert(sizeof(RString) == sizeof(const char *), "RString"); @@ -173,3 +176,4 @@ namespace strings return len; } } // namespace strings +} // namespace tmwa diff --git a/src/strings/rstring.hpp b/src/strings/rstring.hpp index ae8b374..c656622 100644 --- a/src/strings/rstring.hpp +++ b/src/strings/rstring.hpp @@ -25,6 +25,9 @@ # include "base.hpp" + +namespace tmwa +{ namespace strings { /// An owning string that has reached its final contents. @@ -83,6 +86,7 @@ namespace strings __attribute__((format(printf, 2, 0))) int do_vprint(RString& out, const char *fmt, va_list ap); } // namespace strings +} // namespace tmwa # include "rstring.tcc" diff --git a/src/strings/rstring.py b/src/strings/rstring.py index f0618d6..8021ec2 100644 --- a/src/strings/rstring.py +++ b/src/strings/rstring.py @@ -2,7 +2,7 @@ class RString(object): ''' print a RString ''' __slots__ = ('_value') - name = 'strings::RString' + name = 'tmwa::strings::RString' enabled = True def __init__(self, value): diff --git a/src/strings/rstring.tcc b/src/strings/rstring.tcc index 6bfc7b0..c247b8f 100644 --- a/src/strings/rstring.tcc +++ b/src/strings/rstring.tcc @@ -19,6 +19,9 @@ #include "mstring.hpp" + +namespace tmwa +{ namespace strings { template @@ -59,3 +62,4 @@ namespace strings _assign(v.begin(), v.end()); } } // namespace strings +} // namespace tmwa diff --git a/src/strings/sstring.cpp b/src/strings/sstring.cpp index 35885e8..0500129 100644 --- a/src/strings/sstring.cpp +++ b/src/strings/sstring.cpp @@ -27,6 +27,9 @@ #include "../poison.hpp" + +namespace tmwa +{ namespace strings { SString::SString() @@ -102,3 +105,4 @@ namespace strings return &_s; } } // namespace strings +} // namespace tmwa diff --git a/src/strings/sstring.hpp b/src/strings/sstring.hpp index 60fa4f3..5c5a2f5 100644 --- a/src/strings/sstring.hpp +++ b/src/strings/sstring.hpp @@ -24,6 +24,9 @@ # include "base.hpp" # include "rstring.hpp" + +namespace tmwa +{ namespace strings { /// An owning string that represents a arbitrary slice of an RString. @@ -54,6 +57,7 @@ namespace strings const RString *base() const; }; } // namespace strings +} // namespace tmwa # include "sstring.tcc" diff --git a/src/strings/sstring.tcc b/src/strings/sstring.tcc index 89effbc..315e19a 100644 --- a/src/strings/sstring.tcc +++ b/src/strings/sstring.tcc @@ -19,6 +19,9 @@ #include "vstring.hpp" + +namespace tmwa +{ namespace strings { template @@ -26,3 +29,4 @@ namespace strings : _s(v), _b(0), _e(_s.size()) {} } // namespace strings +} // namespace tmwa diff --git a/src/strings/strings2_test.cpp b/src/strings/strings2_test.cpp index 23f09fd..872d201 100644 --- a/src/strings/strings2_test.cpp +++ b/src/strings/strings2_test.cpp @@ -24,6 +24,8 @@ #include "../poison.hpp" +namespace tmwa +{ #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" TEST(StringTests, traits2) @@ -226,3 +228,4 @@ TEST(StringTests, rlong) EXPECT_EQ(&*r.begin(), &*r3.begin()); EXPECT_EQ(&*a.begin(), &*a3.begin()); } +} // namespace tmwa diff --git a/src/strings/strings_test.cpp b/src/strings/strings_test.cpp index df4c2c3..8c3d80a 100644 --- a/src/strings/strings_test.cpp +++ b/src/strings/strings_test.cpp @@ -26,6 +26,8 @@ #include "../poison.hpp" +namespace tmwa +{ #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" template @@ -308,3 +310,4 @@ typedef ::testing::Types< RString, AString, TString, ZString, VString<255> > NulStringTypes; INSTANTIATE_TYPED_TEST_CASE_P(NulStringStuff, NulStringTest, NulStringTypes); +} // namespace tmwa diff --git a/src/strings/tstring.cpp b/src/strings/tstring.cpp index 77d4b40..b0bd74a 100644 --- a/src/strings/tstring.cpp +++ b/src/strings/tstring.cpp @@ -27,6 +27,9 @@ #include "../poison.hpp" + +namespace tmwa +{ namespace strings { TString::TString() @@ -101,3 +104,4 @@ namespace strings return ts.c_str(); } } // namespace strings +} // namespace tmwa diff --git a/src/strings/tstring.hpp b/src/strings/tstring.hpp index 748af9e..054ce69 100644 --- a/src/strings/tstring.hpp +++ b/src/strings/tstring.hpp @@ -24,6 +24,9 @@ # include "base.hpp" # include "rstring.hpp" + +namespace tmwa +{ namespace strings { /// An owning string that represents a tail slice of an RString. @@ -60,6 +63,7 @@ namespace strings // Actually, it might now. const char *decay_for_printf(const TString& ts); } // namespace strings +} // namespace tmwa # include "tstring.tcc" diff --git a/src/strings/tstring.tcc b/src/strings/tstring.tcc index c62987b..2641fb7 100644 --- a/src/strings/tstring.tcc +++ b/src/strings/tstring.tcc @@ -19,6 +19,9 @@ #include "vstring.hpp" + +namespace tmwa +{ namespace strings { template @@ -26,3 +29,4 @@ namespace strings : _s(v), _o(0) {} } // namespace strings +} // namespace tmwa diff --git a/src/strings/vstring.cpp b/src/strings/vstring.cpp index 0ef8f3d..1cb313a 100644 --- a/src/strings/vstring.cpp +++ b/src/strings/vstring.cpp @@ -20,6 +20,10 @@ #include "../poison.hpp" + +namespace tmwa +{ namespace strings { } // namespace strings +} // namespace tmwa diff --git a/src/strings/vstring.hpp b/src/strings/vstring.hpp index 022347a..25051c8 100644 --- a/src/strings/vstring.hpp +++ b/src/strings/vstring.hpp @@ -25,6 +25,9 @@ # include "base.hpp" + +namespace tmwa +{ namespace strings { template @@ -73,6 +76,7 @@ T stringish(VString iv) static_cast&>(rv) = iv; return rv; } +} // namespace tmwa # include "vstring.tcc" diff --git a/src/strings/vstring.py b/src/strings/vstring.py index 39e657b..fa975b2 100644 --- a/src/strings/vstring.py +++ b/src/strings/vstring.py @@ -2,7 +2,7 @@ class VString(object): ''' print a VString ''' __slots__ = ('_value') - name = 'strings::VString' + name = 'tmwa::strings::VString' enabled = True def __init__(self, value): diff --git a/src/strings/vstring.tcc b/src/strings/vstring.tcc index 577261a..4f24a20 100644 --- a/src/strings/vstring.tcc +++ b/src/strings/vstring.tcc @@ -29,6 +29,9 @@ #include "xstring.hpp" #include "literal.hpp" + +namespace tmwa +{ namespace strings { template @@ -146,3 +149,4 @@ namespace strings return len; } } // namespace strings +} // namespace tmwa diff --git a/src/strings/xstring.cpp b/src/strings/xstring.cpp index 2f97c01..4635a90 100644 --- a/src/strings/xstring.cpp +++ b/src/strings/xstring.cpp @@ -27,6 +27,9 @@ #include "../poison.hpp" + +namespace tmwa +{ namespace strings { XString::XString() @@ -75,3 +78,4 @@ namespace strings return _base; } } // namespace strings +} // namespace tmwa diff --git a/src/strings/xstring.hpp b/src/strings/xstring.hpp index 91371c8..0de2be3 100644 --- a/src/strings/xstring.hpp +++ b/src/strings/xstring.hpp @@ -23,6 +23,9 @@ # include "base.hpp" + +namespace tmwa +{ namespace strings { /// A non-owning string that is not guaranteed to be NUL-terminated. @@ -55,6 +58,7 @@ namespace strings const RString *base() const; }; } // namespace strings +} // namespace tmwa # include "xstring.tcc" diff --git a/src/strings/xstring.py b/src/strings/xstring.py index 92cb78b..fa0abcb 100644 --- a/src/strings/xstring.py +++ b/src/strings/xstring.py @@ -2,7 +2,7 @@ class XString(object): ''' print a XString ''' __slots__ = ('_value') - name = 'strings::XString' + name = 'tmwa::strings::XString' enabled = True def __init__(self, value): diff --git a/src/strings/xstring.tcc b/src/strings/xstring.tcc index 8115d23..e9f0f1e 100644 --- a/src/strings/xstring.tcc +++ b/src/strings/xstring.tcc @@ -19,6 +19,9 @@ #include "vstring.hpp" + +namespace tmwa +{ namespace strings { template @@ -26,3 +29,4 @@ namespace strings : _b(&*s.begin()), _e(&*s.end()), _base(nullptr) {} } // namespace strings +} // namespace tmwa diff --git a/src/strings/zstring.cpp b/src/strings/zstring.cpp index 94535d0..01e9c2b 100644 --- a/src/strings/zstring.cpp +++ b/src/strings/zstring.cpp @@ -28,6 +28,9 @@ #include "../poison.hpp" + +namespace tmwa +{ namespace strings { ZString::ZString() @@ -75,3 +78,4 @@ namespace strings return zs.c_str(); } } // namespace strings +} // namespace tmwa diff --git a/src/strings/zstring.hpp b/src/strings/zstring.hpp index a0dda2c..e82c9fb 100644 --- a/src/strings/zstring.hpp +++ b/src/strings/zstring.hpp @@ -23,6 +23,9 @@ # include "base.hpp" + +namespace tmwa +{ namespace strings { /// A non-owning string that is guaranteed to be NUL-terminated. @@ -60,6 +63,7 @@ namespace strings // Actually, it might now. const char *decay_for_printf(const ZString& zs); } // namespace strings +} // namespace tmwa # include "zstring.tcc" diff --git a/src/strings/zstring.py b/src/strings/zstring.py index 5021e1c..dca5f4e 100644 --- a/src/strings/zstring.py +++ b/src/strings/zstring.py @@ -2,7 +2,7 @@ class ZString(object): ''' print a ZString ''' __slots__ = ('_value') - name = 'strings::ZString' + name = 'tmwa::strings::ZString' enabled = True def __init__(self, value): diff --git a/src/strings/zstring.tcc b/src/strings/zstring.tcc index eb55f5a..2eaa8c0 100644 --- a/src/strings/zstring.tcc +++ b/src/strings/zstring.tcc @@ -19,6 +19,9 @@ #include "vstring.hpp" + +namespace tmwa +{ namespace strings { template @@ -26,3 +29,4 @@ namespace strings : _b(&*s.begin()), _e(&*s.end()), _base(nullptr) {} } // namespace strings +} // namespace tmwa -- cgit v1.2.3-70-g09d2