log4cplus
2.0.6
include
log4cplus
helpers
socketbuffer.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
// Module: Log4CPLUS
3
// File: socketbuffer.h
4
// Created: 5/2003
5
// Author: Tad E. Smith
6
//
7
//
8
// Copyright 2003-2017 Tad E. Smith
9
//
10
// Licensed under the Apache License, Version 2.0 (the "License");
11
// you may not use this file except in compliance with the License.
12
// You may obtain a copy of the License at
13
//
14
// http://www.apache.org/licenses/LICENSE-2.0
15
//
16
// Unless required by applicable law or agreed to in writing, software
17
// distributed under the License is distributed on an "AS IS" BASIS,
18
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
// See the License for the specific language governing permissions and
20
// limitations under the License.
21
24
#ifndef LOG4CPLUS_HELPERS_SOCKET_BUFFER_HEADER_
25
#define LOG4CPLUS_HELPERS_SOCKET_BUFFER_HEADER_
26
27
#include <
log4cplus/config.hxx
>
28
29
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
30
#pragma once
31
#endif
32
33
#include <
log4cplus/tstring.h
>
34
35
36
namespace
log4cplus
{
37
namespace
helpers {
38
42
class
LOG4CPLUS_EXPORT
SocketBuffer
43
{
44
public
:
45
explicit
SocketBuffer
(std::size_t max);
46
virtual
~
SocketBuffer
();
47
48
char
*
getBuffer
()
const
{
return
buffer; }
49
std::size_t
getMaxSize
()
const
{
return
maxsize; }
50
std::size_t
getSize
()
const
{
return
size; }
51
void
setSize
(std::size_t s) { size = s; }
52
std::size_t
getPos
()
const
{
return
pos; }
53
54
unsigned
char
readByte();
55
unsigned
short
readShort();
56
unsigned
int
readInt();
57
tstring
readString(
unsigned
char
sizeOfChar);
58
59
void
appendByte(
unsigned
char
val);
60
void
appendShort(
unsigned
short
val);
61
void
appendInt(
unsigned
int
val);
62
void
appendString(
const
tstring
& str);
63
void
appendBuffer(
const
SocketBuffer
& buffer);
64
65
private
:
66
// Data
67
std::size_t maxsize;
68
std::size_t size;
69
std::size_t pos;
70
char
*buffer;
71
72
SocketBuffer
(
SocketBuffer
const
& rhs);
73
SocketBuffer
& operator= (
SocketBuffer
const
& rhs);
74
};
75
76
}
// end namespace helpers
77
}
// end namespace log4cplus
78
79
#endif // LOG4CPLUS_HELPERS_SOCKET_HEADER_
tstring.h
log4cplus
Definition:
appender.h:46
log4cplus::tstring
std::basic_string< tchar > tstring
Definition:
tstring.h:39
log4cplus::helpers::SocketBuffer::getPos
std::size_t getPos() const
Definition:
socketbuffer.h:52
log4cplus::helpers::SocketBuffer::getMaxSize
std::size_t getMaxSize() const
Definition:
socketbuffer.h:49
config.hxx
log4cplus::helpers::SocketBuffer::getSize
std::size_t getSize() const
Definition:
socketbuffer.h:50
log4cplus::helpers::SocketBuffer::setSize
void setSize(std::size_t s)
Definition:
socketbuffer.h:51
log4cplus::helpers::SocketBuffer
Definition:
socketbuffer.h:42
LOG4CPLUS_EXPORT
#define LOG4CPLUS_EXPORT
Definition:
win32.h:141
log4cplus::helpers::SocketBuffer::getBuffer
char * getBuffer() const
Definition:
socketbuffer.h:48
Generated on Fri Jun 18 2021 08:46:20 for log4cplus by
1.8.17