From 70214054e84b920ca3bea5119bd5d1456c809054 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Fri, 4 Oct 2013 21:03:31 -0700 Subject: Remove owning slices They were hardly ever used, hid errors, and were obsoleted by baseful x'es. --- src/strings/base.hpp | 8 -------- src/strings/fstring.cpp | 19 ------------------- src/strings/fstring.hpp | 10 ---------- src/strings/sstring.cpp | 19 ------------------- src/strings/sstring.hpp | 10 ---------- src/strings/strings_test.cpp | 17 +---------------- src/strings/tstring.cpp | 19 ------------------- src/strings/tstring.hpp | 10 ---------- src/strings/vstring.hpp | 10 ---------- src/strings/xstring.hpp | 10 ---------- src/strings/zstring.cpp | 19 ------------------- src/strings/zstring.hpp | 10 ---------- 12 files changed, 1 insertion(+), 160 deletions(-) (limited to 'src/strings') diff --git a/src/strings/base.hpp b/src/strings/base.hpp index 2ea303f..8c0e924 100644 --- a/src/strings/base.hpp +++ b/src/strings/base.hpp @@ -190,14 +190,6 @@ namespace strings auto operator > (const L& l, const R& r) -> decltype((pair_compare(l, r), true)); template::value>::type> auto operator >= (const L& l, const R& r) -> decltype((pair_compare(l, r), true)); - - // sadness - typedef MString MS; - typedef FString FS; - typedef TString TS; - typedef SString SS; - typedef ZString ZS; - typedef XString XS; } // namespace strings #include "base.tcc" diff --git a/src/strings/fstring.cpp b/src/strings/fstring.cpp index 4b20852..32d19fe 100644 --- a/src/strings/fstring.cpp +++ b/src/strings/fstring.cpp @@ -85,25 +85,6 @@ namespace strings return &*begin(); } - TS FS::oslice_t(size_t o) const - { return TS(*this, o); } - SS FS::oslice_h(size_t o) const - { return SS(*this, 0, o); } - TS FS::orslice_t(size_t no) const - { return TS(*this, size() - no); } - SS FS::orslice_h(size_t no) const - { return SS(*this, 0, size() - no); } - TS FS::oislice_t(iterator it) const - { return TS(*this, it - begin()); } - SS FS::oislice_h(iterator it) const - { return SS(*this, 0, it - begin()); } - SS FS::olslice(size_t o, size_t l) const - { return SS(*this, o, o + l); } - SS FS::opslice(size_t b, size_t e) const - { return SS(*this, b, e); } - SS FS::oislice(iterator b, iterator e) const - { return SS(*this, b - begin(), e - begin()); } - const char *decay_for_printf(const FString& fs) { return fs.c_str(); diff --git a/src/strings/fstring.hpp b/src/strings/fstring.hpp index 0f4f09d..8538b70 100644 --- a/src/strings/fstring.hpp +++ b/src/strings/fstring.hpp @@ -65,16 +65,6 @@ namespace strings iterator end() const; const FString *base() const; const char *c_str() const; - - TString oslice_t(size_t o) const; - SString oslice_h(size_t o) const; - TString orslice_t(size_t no) const; - SString orslice_h(size_t no) const; - TString oislice_t(iterator it) const; - SString oislice_h(iterator it) const; - SString olslice(size_t o, size_t l) const; - SString opslice(size_t b, size_t e) const; - SString oislice(iterator b, iterator e) const; }; // cxxstdio helpers diff --git a/src/strings/sstring.cpp b/src/strings/sstring.cpp index bcbcb58..99f91ed 100644 --- a/src/strings/sstring.cpp +++ b/src/strings/sstring.cpp @@ -69,23 +69,4 @@ namespace strings { return &_s; } - - SS SS::oslice_t(size_t o) const - { return SS(_s, _b + o, _e); } - SS SS::oslice_h(size_t o) const - { return SS(_s, _b, _b + o); } - SS SS::orslice_t(size_t no) const - { return SS(_s, _e - no, _e); } - SS SS::orslice_h(size_t no) const - { return SS(_s, _b, _e - no); } - SS SS::oislice_t(iterator it) const - { return SS(_s, _b + it - begin(), _e); } - SS SS::oislice_h(iterator it) const - { return SS(_s, _b, _b + it - begin()); } - SS SS::olslice(size_t o, size_t l) const - { return SS(_s, _b + o, _b + o + l); } - SS SS::opslice(size_t b, size_t e) const - { return SS(_s, _b + b, _b + e); } - SS SS::oislice(iterator b, iterator e) const - { return SS(_s, _b + b - begin(), _b + e - begin()); } } // namespace strings diff --git a/src/strings/sstring.hpp b/src/strings/sstring.hpp index 6f55f9a..a9558c9 100644 --- a/src/strings/sstring.hpp +++ b/src/strings/sstring.hpp @@ -51,16 +51,6 @@ namespace strings iterator begin() const; iterator end() const; const FString *base() const; - - SString oslice_t(size_t o) const; - SString oslice_h(size_t o) const; - SString orslice_t(size_t no) const; - SString orslice_h(size_t no) const; - SString oislice_t(iterator it) const; - SString oislice_h(iterator it) const; - SString olslice(size_t o, size_t l) const; - SString opslice(size_t b, size_t e) const; - SString oislice(iterator b, iterator e) const; }; } // namespace strings diff --git a/src/strings/strings_test.cpp b/src/strings/strings_test.cpp index b7a7d39..82d39d8 100644 --- a/src/strings/strings_test.cpp +++ b/src/strings/strings_test.cpp @@ -163,21 +163,6 @@ TYPED_TEST_P(StringTest, xslice) EXPECT_TRUE(hi.endswith("World!")); } -TYPED_TEST_P(StringTest, oslice) -{ - TypeParam hi("Hello, World!"); - EXPECT_EQ(" World!", hi.oslice_t(6)); - EXPECT_EQ("Hello,", hi.oslice_h(6)); - EXPECT_EQ("World!", hi.orslice_t(6)); - EXPECT_EQ("Hello, ", hi.orslice_h(6)); - typename TypeParam::iterator it = std::find(hi.begin(), hi.end(), ' '); - EXPECT_EQ(" World!", hi.oislice_t(it)); - EXPECT_EQ("Hello,", hi.oislice_h(it)); - EXPECT_EQ("World", hi.olslice(7, 5)); - EXPECT_EQ("World", hi.opslice(7, 12)); - EXPECT_EQ("World", hi.oislice(hi.begin() + 7, hi.begin() + 12)); -} - TYPED_TEST_P(StringTest, convert) { constexpr bool is_zstring = std::is_same::value; @@ -249,7 +234,7 @@ TYPED_TEST_P(StringTest, convert) } REGISTER_TYPED_TEST_CASE_P(StringTest, - basic, order, iterators, xslice, oslice, convert); + basic, order, iterators, xslice, convert); typedef ::testing::Types< FString, TString, SString, ZString, XString, VString<255> diff --git a/src/strings/tstring.cpp b/src/strings/tstring.cpp index 9decc61..2d13888 100644 --- a/src/strings/tstring.cpp +++ b/src/strings/tstring.cpp @@ -72,25 +72,6 @@ namespace strings return &*begin(); } - TS TS::oslice_t(size_t o) const - { return TS(_s, _o + o); } - SS TS::oslice_h(size_t o) const - { return SS(_s, _o, _o + o); } - TS TS::orslice_t(size_t no) const - { return TS(_s, _s.size() - no); } - SS TS::orslice_h(size_t no) const - { return SS(_s, _o, _s.size() - no); } - TS TS::oislice_t(iterator it) const - { return TS(_s, _o + it - begin()); } - SS TS::oislice_h(iterator it) const - { return SS(_s, _o, _o + it - begin()); } - SS TS::olslice(size_t o, size_t l) const - { return SS(_s, _o + o, _o + o + l); } - SS TS::opslice(size_t b, size_t e) const - { return SS(_s, _o + b, _o + e); } - SS TS::oislice(iterator b, iterator e) const - { return SS(_s, _o + b - begin(), _o + e - begin()); } - const char *decay_for_printf(const TString& ts) { return ts.c_str(); diff --git a/src/strings/tstring.hpp b/src/strings/tstring.hpp index 63f3b7a..5d283fa 100644 --- a/src/strings/tstring.hpp +++ b/src/strings/tstring.hpp @@ -52,16 +52,6 @@ namespace strings iterator end() const; const FString *base() const; const char *c_str() const; - - TString oslice_t(size_t o) const; - SString oslice_h(size_t o) const; - TString orslice_t(size_t no) const; - SString orslice_h(size_t no) const; - TString oislice_t(iterator it) const; - SString oislice_h(iterator it) const; - SString olslice(size_t o, size_t l) const; - SString opslice(size_t b, size_t e) const; - SString oislice(iterator b, iterator e) const; }; // cxxstdio helpers diff --git a/src/strings/vstring.hpp b/src/strings/vstring.hpp index 527c2b4..7864b7d 100644 --- a/src/strings/vstring.hpp +++ b/src/strings/vstring.hpp @@ -50,16 +50,6 @@ namespace strings iterator end() const; const FString *base() const; const char *c_str() const; - - VString oslice_t(size_t o) const { return this->xslice_t(o); } - VString oslice_h(size_t o) const { return this->xslice_h(o); } - VString orslice_t(size_t no) const { return this->xrslice_t(no); } - VString orslice_h(size_t no) const { return this->xrslice_h(no); } - VString oislice_t(iterator it) const { return this->xislice_t(it); } - VString oislice_h(iterator it) const { return this->xislice_h(it); } - VString olslice(size_t o, size_t l) const { return this->xlslice(o, l); } - VString opslice(size_t b, size_t e) const { return this->xpslice(b, e); } - VString oislice(iterator b, iterator e) const { return this->xislice(b, e); } }; // cxxstdio helpers diff --git a/src/strings/xstring.hpp b/src/strings/xstring.hpp index 448d0ba..72cae1e 100644 --- a/src/strings/xstring.hpp +++ b/src/strings/xstring.hpp @@ -53,16 +53,6 @@ namespace strings iterator begin() const; iterator end() const; const FString *base() const; - - XString oslice_t(size_t o) const { return xslice_t(o); } - XString oslice_h(size_t o) const { return xslice_h(o); } - XString orslice_t(size_t no) const { return xrslice_t(no); } - XString orslice_h(size_t no) const { return xrslice_h(no); } - XString oislice_t(iterator it) const { return xislice_t(it); } - XString oislice_h(iterator it) const { return xislice_h(it); } - XString olslice(size_t o, size_t l) const { return xlslice(o, l); } - XString opslice(size_t b, size_t e) const { return xpslice(b, e); } - XString oislice(iterator b, iterator e) const { return xislice(b, e); } }; } // namespace strings diff --git a/src/strings/zstring.cpp b/src/strings/zstring.cpp index 3b86b0e..0de836c 100644 --- a/src/strings/zstring.cpp +++ b/src/strings/zstring.cpp @@ -56,25 +56,6 @@ namespace strings return &*begin(); } - ZS ZS::oslice_t(size_t o) const - { return ZS(really_construct_from_a_pointer, &begin()[o], base()); } - XS ZS::oslice_h(size_t o) const - { return XS(&*begin(), &begin()[o], base()); } - ZS ZS::orslice_t(size_t no) const - { return ZS(really_construct_from_a_pointer, &end()[-no], base()); } - XS ZS::orslice_h(size_t no) const - { return XS(&*begin(), &end()[-no], base()); } - ZS ZS::oislice_t(iterator it) const - { return ZS(really_construct_from_a_pointer, &*it, base()); } - XS ZS::oislice_h(iterator it) const - { return XS(&*begin(), &*it, base()); } - XS ZS::olslice(size_t o, size_t l) const - { return XS(&begin()[o], &begin()[o + l], base()); } - XS ZS::opslice(size_t b, size_t e) const - { return XS(&begin()[b], &begin()[e], base()); } - XS ZS::oislice(iterator b, iterator e) const - { return XS(&*b, &*e, base()); } - const char *decay_for_printf(const ZString& zs) { return zs.c_str(); diff --git a/src/strings/zstring.hpp b/src/strings/zstring.hpp index 1b7e7fc..358e3bc 100644 --- a/src/strings/zstring.hpp +++ b/src/strings/zstring.hpp @@ -54,16 +54,6 @@ namespace strings iterator end() const; const FString *base() const; const char *c_str() const; - - ZString oslice_t(size_t o) const; - XString oslice_h(size_t o) const; - ZString orslice_t(size_t no) const; - XString orslice_h(size_t no) const; - ZString oislice_t(iterator it) const; - XString oislice_h(iterator it) const; - XString olslice(size_t o, size_t l) const; - XString opslice(size_t b, size_t e) const; - XString oislice(iterator b, iterator e) const; }; // cxxstdio helpers -- cgit v1.2.3-60-g2f50