added SttpCmd and Sttp

This commit is contained in:
2018-07-18 04:35:41 +00:00
parent a346d27d5f
commit 3c85887ebc
21 changed files with 2358 additions and 105 deletions

View File

@ -41,11 +41,22 @@ pkginclude_HEADERS = \
if ENABLE_CXX
pkginclude_HEADERS += \
Mmgr.hpp StdMmgr.hpp HeapMmgr.hpp Mmged.hpp \
ScopedPtr.hpp SharedPtr.hpp \
StrBase.hpp String.hpp \
Mpool.hpp Association.hpp LinkedList.hpp HashList.hpp HashTable.hpp \
RedBlackTree.hpp RedBlackTable.hpp \
Array.hpp BinaryHeap.hpp
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
String.hpp \
StdMmgr.hpp
endif

View File

@ -88,12 +88,21 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@ENABLE_CXX_TRUE@am__append_1 = \
@ENABLE_CXX_TRUE@ Mmgr.hpp StdMmgr.hpp HeapMmgr.hpp Mmged.hpp \
@ENABLE_CXX_TRUE@ ScopedPtr.hpp SharedPtr.hpp \
@ENABLE_CXX_TRUE@ StrBase.hpp String.hpp \
@ENABLE_CXX_TRUE@ Mpool.hpp Association.hpp LinkedList.hpp HashList.hpp HashTable.hpp \
@ENABLE_CXX_TRUE@ RedBlackTree.hpp RedBlackTable.hpp \
@ENABLE_CXX_TRUE@ Array.hpp BinaryHeap.hpp
@ENABLE_CXX_TRUE@ Array.hpp \
@ENABLE_CXX_TRUE@ Association.hpp \
@ENABLE_CXX_TRUE@ BinaryHeap.hpp \
@ENABLE_CXX_TRUE@ HashList.hpp \
@ENABLE_CXX_TRUE@ HashTable.hpp \
@ENABLE_CXX_TRUE@ HeapMmgr.hpp \
@ENABLE_CXX_TRUE@ LinkedList.hpp \
@ENABLE_CXX_TRUE@ Mmged.hpp \
@ENABLE_CXX_TRUE@ Mmgr.hpp \
@ENABLE_CXX_TRUE@ Mpool.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
subdir = include/qse/cmn
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -135,10 +144,10 @@ am__pkginclude_HEADERS_DIST = alg.h arr.h chr.h cp949.h cp950.h dll.h \
env.h fma.h fmt.h gdl.h htb.h htl.h hton.h hwad.h ipad.h \
main.h map.h mb8.h mbwc.h mem.h oht.h opt.h path.h pma.h rbt.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 Mmgr.hpp StdMmgr.hpp HeapMmgr.hpp Mmged.hpp \
ScopedPtr.hpp SharedPtr.hpp StrBase.hpp String.hpp Mpool.hpp \
Association.hpp LinkedList.hpp HashList.hpp HashTable.hpp \
RedBlackTree.hpp RedBlackTable.hpp Array.hpp BinaryHeap.hpp
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
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -623,6 +632,8 @@ 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

@ -167,23 +167,16 @@ public:
typedef StrBase<CHAR_TYPE,NULL_CHAR,OPSET,RESIZER> SelfType;
typedef StrBaseData<CHAR_TYPE,NULL_CHAR,OPSET,RESIZER> StringItem;
/// The StrBase() function creates an empty string with the default memory manager.
StrBase (): Mmged(QSE_NULL)
{
this->_item = new(this->getMmgr()) StringItem (this->getMmgr(), this->round_capacity(DEFAULT_CAPACITY), (const CHAR_TYPE*)QSE_NULL, 0);
this->ref_item ();
}
/// The StrBase() function creates an empty string with a memory manager \a mmgr.
StrBase (Mmgr* mmgr): Mmged(mmgr)
StrBase (Mmgr* mmgr = QSE_NULL): Mmged(mmgr)
{
this->_item = new(this->getMmgr()) StringItem (this->getMmgr(), this->round_capacity(DEFAULT_CAPACITY), (const CHAR_TYPE*)QSE_NULL, 0);
this->ref_item ();
}
StrBase (int capacity): Mmged(QSE_NULL)
StrBase (int capacity, Mmgr* mmgr = QSE_NULL): Mmged(mmgr)
{
if (capacity <= -1)
if (capacity <= -1)
{
// this is a special constructor to instanatiate a string with no buffer.
// it is designed to be followed by truncate() immediately for actual buffer
@ -204,66 +197,27 @@ public:
this->ref_item ();
}
}
StrBase (Mmgr* mmgr, int capacity): Mmged(mmgr)
{
if (capacity <= -1)
{
// this is a special constructor to instanatiate a string with no buffer.
// it is intended to be followed by truncate() for actual buffer allocation.
this->_item = QSE_NULL;
}
else
{
this->_item = new(this->getMmgr()) StringItem (this->getMmgr(), this->round_capacity(capacity), (const CHAR_TYPE*)QSE_NULL, 0);
this->ref_item ();
}
}
StrBase (qse_size_t capacity): Mmged(QSE_NULL)
StrBase (qse_size_t capacity, Mmgr* mmgr = QSE_NULL): Mmged(mmgr)
{
this->_item = new(this->getMmgr()) StringItem (this->getMmgr(), this->round_capacity(capacity), (const CHAR_TYPE*)QSE_NULL, 0);
this->ref_item ();
}
StrBase (Mmgr* mmgr, qse_size_t capacity): Mmged(mmgr)
{
this->_item = new(this->getMmgr()) StringItem (this->getMmgr(), this->round_capacity(capacity), (const CHAR_TYPE*)QSE_NULL, 0);
this->ref_item ();
}
StrBase (const CHAR_TYPE* str): Mmged(QSE_NULL)
StrBase (const CHAR_TYPE* str, Mmgr* mmgr = QSE_NULL): Mmged(mmgr)
{
qse_size_t len = this->_opset.getLength(str);
this->_item = new(this->getMmgr()) StringItem (this->getMmgr(), this->round_capacity(len), str, len);
this->ref_item ();
}
StrBase (Mmgr* mmgr, const CHAR_TYPE* str): Mmged(mmgr)
{
qse_size_t len = this->_opset.getLength(str);
this->_item = new(this->getMmgr()) StringItem (this->getMmgr(), this->round_capacity(len), str, len);
this->ref_item ();
}
StrBase (const CHAR_TYPE* str, qse_size_t size): Mmged(QSE_NULL)
StrBase (const CHAR_TYPE* str, qse_size_t size, Mmgr* mmgr = QSE_NULL): Mmged(mmgr)
{
this->_item = new(this->getMmgr()) StringItem (this->getMmgr(), this->round_capacity(size), str, size);
this->ref_item ();
}
StrBase (Mmgr* mmgr, const CHAR_TYPE* str, qse_size_t size): Mmged(mmgr)
{
this->_item = new(this->getMmgr()) StringItem (this->getMmgr(), this->round_capacity(size), str, size);
this->ref_item ();
}
StrBase (CHAR_TYPE c, qse_size_t size): Mmged(QSE_NULL)
{
this->_item = new(this->getMmgr()) StringItem (this->getMmgr(), this->round_capacity(size), c, size);
this->ref_item ();
}
StrBase (Mmgr* mmgr, CHAR_TYPE c, qse_size_t size): Mmged(mmgr)
StrBase (CHAR_TYPE c, qse_size_t size, Mmgr* mmgr = QSE_NULL): Mmged(mmgr)
{
this->_item = new(this->getMmgr()) StringItem (this->getMmgr(), this->round_capacity(size), c, size);
this->ref_item ();
@ -790,7 +744,7 @@ public:
void invert (qse_size_t index, qse_size_t size)
{
QSE_ASSERT (index + size <= this->_item->size);
if (this->_item->isShared()) this->possess_data ();
CHAR_TYPE c;

View File

@ -187,16 +187,11 @@ private:
public:
WcString (): ParentType() {}
WcString (Mmgr* mmgr): ParentType(mmgr) {}
WcString (int capacity): ParentType(capacity) {}
WcString (Mmgr* mmgr, int capacity): ParentType(mmgr, capacity) {}
WcString (qse_size_t capacity): ParentType(capacity) {}
WcString (Mmgr* mmgr, qse_size_t capacity): ParentType(mmgr, capacity) {}
WcString (const qse_wchar_t* str): ParentType(str) {}
WcString (Mmgr* mmgr, const qse_wchar_t* str): ParentType(mmgr, str) {}
WcString (const qse_wchar_t* str, qse_size_t size): ParentType(str, size) {}
WcString (Mmgr* mmgr, const qse_wchar_t* str, qse_size_t size): ParentType(mmgr, str, size) {}
WcString (qse_wchar_t c, qse_size_t size): ParentType(c, size) {}
WcString (Mmgr* mmgr, qse_wchar_t c, qse_size_t size): ParentType(mmgr, c, size) {}
WcString (int capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
WcString (qse_size_t capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
WcString (const qse_wchar_t* str, Mmgr* mmgr = QSE_NULL): ParentType(str, mmgr) {}
WcString (const qse_wchar_t* str, qse_size_t size, Mmgr* mmgr = QSE_NULL): ParentType(str, size, mmgr) {}
WcString (qse_wchar_t c, qse_size_t size, Mmgr* mmgr = QSE_NULL): ParentType(c, size, mmgr) {}
WcString (const WcString& str): ParentType(str) {}
#if defined(QSE_CPP_ENABLE_CPP11_MOVE)
WcString (WcString&& str): ParentType(QSE_CPP_RVREF(str)) {}
@ -224,16 +219,11 @@ private:
public:
MbString (): ParentType() {}
MbString (Mmgr* mmgr): ParentType(mmgr) {}
MbString (int capacity): ParentType(capacity) {}
MbString (Mmgr* mmgr, int capacity): ParentType(mmgr, capacity) {}
MbString (qse_size_t capacity): ParentType(capacity) {}
MbString (Mmgr* mmgr, qse_size_t capacity): ParentType(mmgr, capacity) {}
MbString (const qse_mchar_t* str): ParentType(str) {}
MbString (Mmgr* mmgr, const qse_mchar_t* str): ParentType(mmgr, str) {}
MbString (const qse_mchar_t* str, qse_size_t size): ParentType(str, size) {}
MbString (Mmgr* mmgr, const qse_mchar_t* str, qse_size_t size): ParentType(mmgr, str, size) {}
MbString (qse_mchar_t c, qse_size_t size): ParentType(c, size) {}
MbString (Mmgr* mmgr, qse_mchar_t c, qse_size_t size): ParentType(mmgr, c, size) {}
MbString (int capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
MbString (qse_size_t capacity, Mmgr* mmgr = QSE_NULL): ParentType(capacity, mmgr) {}
MbString (const qse_mchar_t* str, Mmgr* mmgr = QSE_NULL): ParentType(str, mmgr) {}
MbString (const qse_mchar_t* str, qse_size_t size, Mmgr* mmgr = QSE_NULL): ParentType(str, size, mmgr) {}
MbString (qse_mchar_t c, qse_size_t size, Mmgr* mmgr = QSE_NULL): ParentType(c, size, mmgr) {}
MbString (const MbString& str): ParentType(str) {}
MbString (const ParentType& str): ParentType(str) {}
#if defined(QSE_CPP_ENABLE_CPP11_MOVE)

View File

@ -0,0 +1,52 @@
/*
* $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 EXPRESS 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_TRANSMITTABLE_CLASS_
#define _QSE_CMN_TRANSMITTABLE_CLASS_
#include <qse/cmn/time.h>
QSE_BEGIN_NAMESPACE(QSE)
class Transmittable
{
public:
virtual ~Transmittable () {}
//virtual void enableTimeout (qse_ntime_t t) = 0;
//virtual void disableTimeout () = 0;
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;
};
QSE_END_NAMESPACE(QSE)
#endif