added Named.

removed unneeded lines from Transmittable.hpp
fixed include/qse/cmn/Makefile.am
This commit is contained in:
hyung-hwan 2018-07-19 07:32:04 +00:00
parent 3c85887ebc
commit f6c51b1a67
4 changed files with 98 additions and 14 deletions

View File

@ -51,12 +51,14 @@ pkginclude_HEADERS += \
Mmged.hpp \
Mmgr.hpp \
Mpool.hpp \
Named.hpp \
RedBlackTree.hpp \
RedBlackTable.hpp \
ScopedPtr.hpp \
SharedPtr.hpp \
StrBase.hpp
StrBase.hpp \
String.hpp \
StdMmgr.hpp
StdMmgr.hpp \
Transmittable.hpp
endif

View File

@ -98,11 +98,15 @@ host_triplet = @host@
@ENABLE_CXX_TRUE@ Mmged.hpp \
@ENABLE_CXX_TRUE@ Mmgr.hpp \
@ENABLE_CXX_TRUE@ Mpool.hpp \
@ENABLE_CXX_TRUE@ Named.hpp \
@ENABLE_CXX_TRUE@ RedBlackTree.hpp \
@ENABLE_CXX_TRUE@ RedBlackTable.hpp \
@ENABLE_CXX_TRUE@ ScopedPtr.hpp \
@ENABLE_CXX_TRUE@ SharedPtr.hpp \
@ENABLE_CXX_TRUE@ StrBase.hpp
@ENABLE_CXX_TRUE@ StrBase.hpp \
@ENABLE_CXX_TRUE@ String.hpp \
@ENABLE_CXX_TRUE@ StdMmgr.hpp \
@ENABLE_CXX_TRUE@ Transmittable.hpp
subdir = include/qse/cmn
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -146,8 +150,9 @@ am__pkginclude_HEADERS_DIST = alg.h arr.h chr.h cp949.h cp950.h dll.h \
rex.h sll.h slmb.h str.h time.h tmr.h tre.h test.h uni.h uri.h \
utf8.h xma.h Array.hpp Association.hpp BinaryHeap.hpp \
HashList.hpp HashTable.hpp HeapMmgr.hpp LinkedList.hpp \
Mmged.hpp Mmgr.hpp Mpool.hpp RedBlackTree.hpp \
RedBlackTable.hpp ScopedPtr.hpp SharedPtr.hpp StrBase.hpp
Mmged.hpp Mmgr.hpp Mpool.hpp Named.hpp RedBlackTree.hpp \
RedBlackTable.hpp ScopedPtr.hpp SharedPtr.hpp StrBase.hpp \
String.hpp StdMmgr.hpp Transmittable.hpp
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -632,8 +637,6 @@ uninstall-am: uninstall-pkgincludeHEADERS
.PRECIOUS: Makefile
@ENABLE_CXX_TRUE@ String.hpp \
@ENABLE_CXX_TRUE@ StdMmgr.hpp
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -0,0 +1,85 @@
/*
* $Id$
*
Copyright (c) 2006-2014 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EQSERESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _QSE_CMN_NAMED_CLASS_
#define _QSE_CMN_NAMED_CLASS_
#include <qse/Types.hpp>
#include <qse/cmn/str.h>
QSE_BEGIN_NAMESPACE(QSE)
template <int N>
class Named
{
public:
Named (const qse_char_t* name = QSE_T("")) QSE_CPP_NOEXCEPT
{
QSE_ASSERT (name != QSE_NULL);
// WARNING: a long name can be truncated
qse_strxcpy (this->name_buf, QSE_COUNTOF(this->name_buf), name);
}
~Named () QSE_CPP_NOEXCEPT {}
qse_char_t* getName () QSE_CPP_NOEXCEPT
{
return this->name_buf;
}
const qse_char_t* getName () const QSE_CPP_NOEXCEPT
{
return this->name_buf;
}
void setName (const qse_char_t* name) QSE_CPP_NOEXCEPT
{
QSE_ASSERT (name != QSE_NULL);
// WARNING: a long name can be truncated
qse_strxcpy (this->name_buf, QSE_COUNTOF(this->name_buf), name);
}
bool isNamed () const QSE_CPP_NOEXCEPT
{
return this->name_buf[0] != QSE_T('\0');
}
bool isNamed (const qse_char_t* n) const QSE_CPP_NOEXCEPT
{
return qse_strcmp(this->name_buf, n) == 0;
}
enum
{
MAX_NAME_LEN = N
};
protected:
qse_char_t name_buf[MAX_NAME_LEN + 1];
};
QSE_END_NAMESPACE(QSE)
#endif

View File

@ -34,16 +34,10 @@ QSE_BEGIN_NAMESPACE(QSE)
class Transmittable
{
public:
virtual ~Transmittable () {}
//virtual void enableTimeout (qse_ntime_t t) = 0;
//virtual void disableTimeout () = 0;
virtual ~Transmittable() QSE_CPP_NOEXCEPT {}
virtual qse_ssize_t send (const void* buf, qse_size_t len) QSE_CPP_NOEXCEPT = 0;
virtual qse_ssize_t receive (void* buf, qse_size_t len) QSE_CPP_NOEXCEPT = 0;
//qse_ssize_t send (const void* buf, qse_size_t len, const SocketAddress& dstaddr) QSE_CPP_NOEXCEPT;
//qse_ssize_t receive (void* buf, qse_size_t len, SocketAddress& srcaddr) QSE_CPP_NOEXCEPT;
};