mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Just renamed some files and turned the sockstreambuf into a single
implementation component. So no real functional code changes in this commit. --HG-- rename : dlib/sockstreambuf/sockstreambuf_kernel_2.cpp => dlib/sockstreambuf/sockstreambuf.cpp rename : dlib/sockstreambuf/sockstreambuf_kernel_2.h => dlib/sockstreambuf/sockstreambuf.h rename : dlib/sockstreambuf/sockstreambuf_kernel_abstract.h => dlib/sockstreambuf/sockstreambuf_abstract.h rename : dlib/sockstreambuf/sockstreambuf_kernel_1.cpp => dlib/sockstreambuf/sockstreambuf_unbuffered.cpp rename : dlib/sockstreambuf/sockstreambuf_kernel_1.h => dlib/sockstreambuf/sockstreambuf_unbuffered.h
This commit is contained in:
parent
93c3e95a94
commit
e56b4c533e
@ -36,8 +36,8 @@
|
|||||||
#include "../misc_api/misc_api_kernel_2.cpp"
|
#include "../misc_api/misc_api_kernel_2.cpp"
|
||||||
#include "../sockets/sockets_extensions.cpp"
|
#include "../sockets/sockets_extensions.cpp"
|
||||||
#include "../sockets/sockets_kernel_2.cpp"
|
#include "../sockets/sockets_kernel_2.cpp"
|
||||||
#include "../sockstreambuf/sockstreambuf_kernel_1.cpp"
|
#include "../sockstreambuf/sockstreambuf.cpp"
|
||||||
#include "../sockstreambuf/sockstreambuf_kernel_2.cpp"
|
#include "../sockstreambuf/sockstreambuf_unbuffered.cpp"
|
||||||
#include "../server/server_kernel.cpp"
|
#include "../server/server_kernel.cpp"
|
||||||
#include "../server/server_iostream.cpp"
|
#include "../server/server_iostream.cpp"
|
||||||
#include "../server/server_http.cpp"
|
#include "../server/server_http.cpp"
|
||||||
|
@ -1,36 +1,11 @@
|
|||||||
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
|
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
|
||||||
// License: Boost Software License See LICENSE.txt for the full license.
|
// License: Boost Software License See LICENSE.txt for the full license.
|
||||||
#ifndef _SOCKSTREAMBUf_
|
#ifndef DLIB_SOCKSTREAMBUf_H___
|
||||||
#define _SOCKSTREAMBUf_
|
#define DLIB_SOCKSTREAMBUf_H___
|
||||||
|
|
||||||
#include "sockstreambuf/sockstreambuf_kernel_1.h"
|
#include "sockstreambuf/sockstreambuf.h"
|
||||||
#include "sockstreambuf/sockstreambuf_kernel_2.h"
|
#include "sockstreambuf/sockstreambuf_unbuffered.h"
|
||||||
|
|
||||||
|
|
||||||
namespace dlib
|
#endif // DLIB_SOCKSTREAMBUf_H___
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class sockstreambuf
|
|
||||||
{
|
|
||||||
sockstreambuf() {}
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//----------- kernels ---------------
|
|
||||||
|
|
||||||
// kernel_1a
|
|
||||||
typedef sockstreambuf_kernel_1
|
|
||||||
kernel_1a;
|
|
||||||
|
|
||||||
// kernel_2a
|
|
||||||
typedef sockstreambuf_kernel_2
|
|
||||||
kernel_2a;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
|
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
|
||||||
// License: Boost Software License See LICENSE.txt for the full license.
|
// License: Boost Software License See LICENSE.txt for the full license.
|
||||||
#ifndef DLIB_SOCKSTREAMBUF_KERNEL_2_CPp_
|
#ifndef DLIB_SOCKStREAMBUF_CPp_
|
||||||
#define DLIB_SOCKSTREAMBUF_KERNEL_2_CPp_
|
#define DLIB_SOCKStREAMBUF_CPp_
|
||||||
#include "sockstreambuf_kernel_2.h"
|
|
||||||
|
#include "sockstreambuf.h"
|
||||||
#include "../assert.h"
|
#include "../assert.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -14,7 +15,7 @@ namespace dlib
|
|||||||
// output functions
|
// output functions
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
sockstreambuf_kernel_2::int_type sockstreambuf_kernel_2::
|
sockstreambuf::int_type sockstreambuf::
|
||||||
overflow (
|
overflow (
|
||||||
int_type c
|
int_type c
|
||||||
)
|
)
|
||||||
@ -34,7 +35,7 @@ namespace dlib
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
std::streamsize sockstreambuf_kernel_2::
|
std::streamsize sockstreambuf::
|
||||||
xsputn (
|
xsputn (
|
||||||
const char* s,
|
const char* s,
|
||||||
std::streamsize num
|
std::streamsize num
|
||||||
@ -90,7 +91,7 @@ namespace dlib
|
|||||||
// input functions
|
// input functions
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
sockstreambuf_kernel_2::int_type sockstreambuf_kernel_2::
|
sockstreambuf::int_type sockstreambuf::
|
||||||
underflow(
|
underflow(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -125,7 +126,7 @@ namespace dlib
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
std::streamsize sockstreambuf_kernel_2::
|
std::streamsize sockstreambuf::
|
||||||
xsgetn (
|
xsgetn (
|
||||||
char_type* s,
|
char_type* s,
|
||||||
std::streamsize n
|
std::streamsize n
|
||||||
@ -163,5 +164,5 @@ namespace dlib
|
|||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif // DLIB_SOCKSTREAMBUF_KERNEL_2_CPp_
|
#endif // DLIB_SOCKStREAMBUF_CPp_
|
||||||
|
|
@ -1,19 +1,20 @@
|
|||||||
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
|
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
|
||||||
// License: Boost Software License See LICENSE.txt for the full license.
|
// License: Boost Software License See LICENSE.txt for the full license.
|
||||||
#ifndef DLIB_SOCKSTREAMBUF_KERNEl_2_
|
#ifndef DLIB_SOCKStREAMBUF_H__
|
||||||
#define DLIB_SOCKSTREAMBUF_KERNEl_2_
|
#define DLIB_SOCKStREAMBUF_H__
|
||||||
|
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
#include "../sockets.h"
|
#include "../sockets.h"
|
||||||
#include "sockstreambuf_kernel_abstract.h"
|
#include "sockstreambuf_abstract.h"
|
||||||
|
#include "sockstreambuf_unbuffered.h"
|
||||||
|
|
||||||
namespace dlib
|
namespace dlib
|
||||||
{
|
{
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class sockstreambuf_kernel_2 : public std::streambuf
|
class sockstreambuf : public std::streambuf
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
INITIAL VALUE
|
INITIAL VALUE
|
||||||
@ -28,7 +29,13 @@ namespace dlib
|
|||||||
!*/
|
!*/
|
||||||
|
|
||||||
public:
|
public:
|
||||||
sockstreambuf_kernel_2 (
|
|
||||||
|
// These typedefs are here for backwards compatibility with previous versions of
|
||||||
|
// dlib.
|
||||||
|
typedef sockstreambuf_unbuffered kernel_1a;
|
||||||
|
typedef sockstreambuf kernel_2a;
|
||||||
|
|
||||||
|
sockstreambuf (
|
||||||
connection* con_
|
connection* con_
|
||||||
) :
|
) :
|
||||||
con(*con_),
|
con(*con_),
|
||||||
@ -38,7 +45,7 @@ namespace dlib
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
sockstreambuf_kernel_2 (
|
sockstreambuf (
|
||||||
const scoped_ptr<connection>& con_
|
const scoped_ptr<connection>& con_
|
||||||
) :
|
) :
|
||||||
con(*con_),
|
con(*con_),
|
||||||
@ -48,7 +55,7 @@ namespace dlib
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~sockstreambuf_kernel_2 (
|
virtual ~sockstreambuf (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
sync();
|
sync();
|
||||||
@ -141,8 +148,8 @@ namespace dlib
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NO_MAKEFILE
|
#ifdef NO_MAKEFILE
|
||||||
#include "sockstreambuf_kernel_2.cpp"
|
#include "sockstreambuf.cpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // DLIB_SOCKSTREAMBUF_KERNEl_2_
|
#endif // DLIB_SOCKStREAMBUF_H__
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
|
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
|
||||||
// License: Boost Software License See LICENSE.txt for the full license.
|
// License: Boost Software License See LICENSE.txt for the full license.
|
||||||
#undef DLIB_SOCKSTREAMBUF_KERNEl_ABSTRACT_
|
#undef DLIB_SOCKSTREAMBUF_ABSTRACT_
|
||||||
#ifdef DLIB_SOCKSTREAMBUF_KERNEl_ABSTRACT_
|
#ifdef DLIB_SOCKSTREAMBUF_ABSTRACT_
|
||||||
|
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
@ -94,5 +94,5 @@ namespace dlib
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DLIB_SOCKSTREAMBUF_KERNEl_ABSTRACT_
|
#endif // DLIB_SOCKSTREAMBUF_ABSTRACT_
|
||||||
|
|
@ -1,8 +1,9 @@
|
|||||||
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
|
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
|
||||||
// License: Boost Software License See LICENSE.txt for the full license.
|
// License: Boost Software License See LICENSE.txt for the full license.
|
||||||
#ifndef DLIB_SOCKSTREAMBUF_KERNEL_1_CPp_
|
#ifndef DLIB_SOCKSTrEAMBUF_UNBUFFERED_CPp_
|
||||||
#define DLIB_SOCKSTREAMBUF_KERNEL_1_CPp_
|
#define DLIB_SOCKSTrEAMBUF_UNBUFFERED_CPp_
|
||||||
#include "sockstreambuf_kernel_1.h"
|
|
||||||
|
#include "sockstreambuf_unbuffered.h"
|
||||||
|
|
||||||
|
|
||||||
namespace dlib
|
namespace dlib
|
||||||
@ -12,7 +13,7 @@ namespace dlib
|
|||||||
// output functions
|
// output functions
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
sockstreambuf_kernel_1::int_type sockstreambuf_kernel_1::
|
sockstreambuf_unbuffered::int_type sockstreambuf_unbuffered::
|
||||||
overflow (
|
overflow (
|
||||||
int_type c
|
int_type c
|
||||||
)
|
)
|
||||||
@ -31,7 +32,7 @@ namespace dlib
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
std::streamsize sockstreambuf_kernel_1::
|
std::streamsize sockstreambuf_unbuffered::
|
||||||
xsputn (
|
xsputn (
|
||||||
const char* s,
|
const char* s,
|
||||||
std::streamsize num
|
std::streamsize num
|
||||||
@ -49,7 +50,7 @@ namespace dlib
|
|||||||
// input functions
|
// input functions
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
sockstreambuf_kernel_1::int_type sockstreambuf_kernel_1::
|
sockstreambuf_unbuffered::int_type sockstreambuf_unbuffered::
|
||||||
underflow(
|
underflow(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -76,7 +77,7 @@ namespace dlib
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
sockstreambuf_kernel_1::int_type sockstreambuf_kernel_1::
|
sockstreambuf_unbuffered::int_type sockstreambuf_unbuffered::
|
||||||
uflow(
|
uflow(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -106,7 +107,7 @@ namespace dlib
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
sockstreambuf_kernel_1::int_type sockstreambuf_kernel_1::
|
sockstreambuf_unbuffered::int_type sockstreambuf_unbuffered::
|
||||||
pbackfail(
|
pbackfail(
|
||||||
int_type c
|
int_type c
|
||||||
)
|
)
|
||||||
@ -126,7 +127,7 @@ namespace dlib
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
std::streamsize sockstreambuf_kernel_1::
|
std::streamsize sockstreambuf_unbuffered::
|
||||||
xsgetn (
|
xsgetn (
|
||||||
char_type* s,
|
char_type* s,
|
||||||
std::streamsize n
|
std::streamsize n
|
||||||
@ -163,5 +164,5 @@ namespace dlib
|
|||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif // DLIB_SOCKSTREAMBUF_KERNEL_1_CPp_
|
#endif // DLIB_SOCKSTrEAMBUF_UNBUFFERED_CPp_
|
||||||
|
|
@ -1,21 +1,26 @@
|
|||||||
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
|
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
|
||||||
// License: Boost Software License See LICENSE.txt for the full license.
|
// License: Boost Software License See LICENSE.txt for the full license.
|
||||||
#ifndef DLIB_SOCKSTREAMBUF_KERNEl_1_
|
#ifndef DLIB_SOCKSTrEAMBUF_UNBUFFERED_H__
|
||||||
#define DLIB_SOCKSTREAMBUF_KERNEl_1_
|
#define DLIB_SOCKSTrEAMBUF_UNBUFFERED_H__
|
||||||
|
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
#include "../sockets.h"
|
#include "../sockets.h"
|
||||||
#include "sockstreambuf_kernel_abstract.h"
|
#include "sockstreambuf_abstract.h"
|
||||||
|
|
||||||
namespace dlib
|
namespace dlib
|
||||||
{
|
{
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class sockstreambuf_kernel_1 : public std::streambuf
|
class sockstreambuf_unbuffered : public std::streambuf
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
|
WHAT THIS OBJECT REPRESENTS
|
||||||
|
This is an implementation of the interface defined in sockstreambuf_abstract.h
|
||||||
|
except that it doesn't do any kind of buffering at all. It just writes
|
||||||
|
data directly to a connection.
|
||||||
|
|
||||||
INITIAL VALUE
|
INITIAL VALUE
|
||||||
con == a connection
|
con == a connection
|
||||||
lastread_next == false
|
lastread_next == false
|
||||||
@ -36,7 +41,9 @@ namespace dlib
|
|||||||
!*/
|
!*/
|
||||||
|
|
||||||
public:
|
public:
|
||||||
sockstreambuf_kernel_1 (
|
|
||||||
|
|
||||||
|
sockstreambuf_unbuffered (
|
||||||
connection* con_
|
connection* con_
|
||||||
) :
|
) :
|
||||||
con(*con_),
|
con(*con_),
|
||||||
@ -44,7 +51,7 @@ namespace dlib
|
|||||||
lastread_next(false)
|
lastread_next(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
sockstreambuf_kernel_1 (
|
sockstreambuf_unbuffered (
|
||||||
const scoped_ptr<connection>& con_
|
const scoped_ptr<connection>& con_
|
||||||
) :
|
) :
|
||||||
con(*con_),
|
con(*con_),
|
||||||
@ -99,8 +106,8 @@ namespace dlib
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NO_MAKEFILE
|
#ifdef NO_MAKEFILE
|
||||||
#include "sockstreambuf_kernel_1.cpp"
|
#include "sockstreambuf_unbuffered.cpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // DLIB_SOCKSTREAMBUF_KERNEl_1_
|
#endif // DLIB_SOCKSTrEAMBUF_UNBUFFERED_H__
|
||||||
|
|
Loading…
Reference in New Issue
Block a user