From f92713c7c3e2d626d945ec1e557374a02112d5ca Mon Sep 17 00:00:00 2001 From: Myun2 Date: Fri, 17 Sep 2010 21:12:25 +0900 Subject: [PATCH] =?utf8?q?sized=5Fcharbuf.hpp:=20=E7=B5=90=E5=B1=80=20size?= =?utf8?q?d=5Fcharbuf=20=E3=81=A8=20sized=5Fccharbuf=20=E3=82=92=E7=B5=B1?= =?utf8?q?=E5=90=88=E3=81=97=E3=81=A6typedef=E3=81=99=E3=82=8B=E5=BD=A2?= =?utf8?q?=E3=81=AB=E3=83=BB=E3=83=BB=E3=83=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- roast/include/roast/str/sized_charbuf.hpp | 43 ++++++++++--------------------- 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/roast/include/roast/str/sized_charbuf.hpp b/roast/include/roast/str/sized_charbuf.hpp index a0fc34d2..591d8121 100644 --- a/roast/include/roast/str/sized_charbuf.hpp +++ b/roast/include/roast/str/sized_charbuf.hpp @@ -8,49 +8,27 @@ #include "roast/memory/sized_ptr.hpp" #include + namespace roast { - //typedef sized_ptr_ sized_charbuf; - //typedef sized_ptr_ sized_ccharbuf; - - /////////////////////////////////////////////////////////// - - struct sized_charbuf : public sized_ptr_ + template + struct sized_xcharbuf : public sized_ptr_ { private: - typedef char T; typedef sized_ptr_ _Base; public: - sized_charbuf(){} - sized_charbuf(T* ptr_in, size_t size_in) : _Base(ptr_in, size_in){} - ///////////////////////////////////// - - ::std::string to_string() - { - return ::std::string(ptr, size); - } - }; - - /////////////////////////////////////////////////////////// - - struct sized_ccharbuf : public sized_ptr_ - { - private: - typedef const char T; - typedef sized_ptr_ _Base; + sized_xcharbuf(){} + sized_xcharbuf(T* ptr_in, size_t size_in) : _Base(ptr_in, size_in){} - public: - sized_ccharbuf(){} - sized_ccharbuf(T* ptr_in, size_t size_in) : _Base(ptr_in, size_in){} - ///////////////////////////////////// + //////////////////////////////////////////////// - ::std::string to_string() const + ::std::string to_string() { return ::std::string(ptr, size); } - int operator == ( const sized_ccharbuf& other ) const + int operator == ( const sized_xcharbuf& other ) const { //return _Base::operator ==(s); @@ -99,6 +77,11 @@ namespace roast return 0; } }; + + /////////////////////////////////////////////////////////// + + typedef sized_xcharbuf sized_charbuf; + typedef sized_xcharbuf sized_ccharbuf; } #endif//__SFJP_ROAST__str__sized_charbuf_HPP__ -- 2.11.0