Claw
1.7.3
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
impl
socket_stream.tpp
Go to the documentation of this file.
1
/*
2
CLAW - a C++ Library Absolutely Wonderful
3
4
CLAW is a free library without any particular aim but being useful to
5
anyone.
6
7
Copyright (C) 2005-2011 Julien Jorge
8
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of the GNU Lesser General Public
11
License as published by the Free Software Foundation; either
12
version 2.1 of the License, or (at your option) any later version.
13
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
Lesser General Public License for more details.
18
19
You should have received a copy of the GNU Lesser General Public
20
License along with this library; if not, write to the Free Software
21
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
23
contact: julien.jorge@gamned.org
24
*/
31
/*----------------------------------------------------------------------------*/
37
template
<
typename
CharT,
typename
Traits>
38
claw::net::basic_socket_stream<CharT, Traits>::basic_socket_stream
39
(
int
read_delay )
40
: m_buffer(read_delay)
41
{
42
this->init(&m_buffer);
43
}
// basic_socket_stream::basic_socket_stream()
44
45
/*----------------------------------------------------------------------------*/
53
template
<
typename
CharT,
typename
Traits>
54
claw::net::basic_socket_stream<CharT, Traits>::basic_socket_stream
55
(
const
char
* address,
int
port,
int
read_delay )
56
: m_buffer(read_delay)
57
{
58
this->init(&m_buffer);
59
open(address, port);
60
}
// basic_socket_stream::basic_socket_stream()
61
62
/*----------------------------------------------------------------------------*/
66
template
<
typename
CharT,
typename
Traits>
67
claw::net::basic_socket_stream<CharT, Traits>::~basic_socket_stream
()
68
{
69
// nothing to do
70
}
// basic_socket_stream::~basic_socket_stream()
71
72
/*----------------------------------------------------------------------------*/
76
template
<
typename
CharT,
typename
Traits>
77
typename
claw::net::basic_socket_stream<CharT, Traits>::buffer_type
*
78
claw::net::basic_socket_stream<CharT, Traits>::rdbuf
()
const
79
{
80
return
const_cast<
buffer_type
*
>
(&m_buffer);
81
}
// basic_socket_stream::rdbuf()
82
83
/*----------------------------------------------------------------------------*/
87
template
<
typename
CharT,
typename
Traits>
88
bool
claw::net::basic_socket_stream<CharT, Traits>::is_open
()
const
89
{
90
return
m_buffer.is_open();
91
}
// basic_socket_stream::is_open()
92
93
/*----------------------------------------------------------------------------*/
99
template
<
typename
CharT,
typename
Traits>
100
void
claw::net::basic_socket_stream<CharT, Traits>::set_read_time_limit
101
(
int
read_limit )
102
{
103
m_buffer.set_read_time_limit(read_limit);
104
}
// // basic_socket_stream::set_read_time_limit()
105
106
/*----------------------------------------------------------------------------*/
112
template
<
typename
CharT,
typename
Traits>
113
void
claw::net::basic_socket_stream<CharT, Traits>::open
114
(
const
char
* address,
int
port )
115
{
116
if
( !m_buffer.open(address, port) )
117
this->setstate(std::ios_base::failbit);
118
else
119
this->clear();
120
}
// basic_socket_stream::open()
121
122
/*----------------------------------------------------------------------------*/
128
template
<
typename
CharT,
typename
Traits>
129
void
claw::net::basic_socket_stream<CharT, Traits>::open
(
int
fd )
130
{
131
if
( !m_buffer.open(fd) )
132
this->setstate(std::ios_base::failbit);
133
else
134
this->clear();
135
}
// basic_socket_stream::open()
136
137
/*----------------------------------------------------------------------------*/
141
template
<
typename
CharT,
typename
Traits>
142
void
claw::net::basic_socket_stream<CharT, Traits>::close
()
143
{
144
if
( !m_buffer.close() )
145
this->setstate(std::ios_base::failbit);
146
}
// basic_socket_stream::close()
147
Generated on Thu Mar 14 2013 22:09:24 for Claw by
1.8.1.2