Claw
1.7.3
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
impl
isocket_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
/*----------------------------------------------------------------------------*/
35
template
<
typename
CharT,
typename
Traits>
36
claw::net::basic_isocket_stream<CharT, Traits>::basic_isocket_stream
()
37
: super(&m_buffer)
38
{
39
40
}
// basic_isocket_stream::basic_isocket_stream()
41
42
/*----------------------------------------------------------------------------*/
48
template
<
typename
CharT,
typename
Traits>
49
claw::net::basic_isocket_stream<CharT, Traits>::basic_isocket_stream
50
(
const
std::string& address,
int
port )
51
: super(&m_buffer)
52
{
53
open(address, port);
54
}
// basic_isocket_stream::basic_isocket_stream()
55
56
/*----------------------------------------------------------------------------*/
60
template
<
typename
CharT,
typename
Traits>
61
claw::net::basic_isocket_stream<CharT, Traits>::~basic_isocket_stream
()
62
{
63
// nothing to do
64
}
// basic_isocket_stream::~basic_isocket_stream()
65
66
/*----------------------------------------------------------------------------*/
70
template
<
typename
CharT,
typename
Traits>
71
typename
claw::net::basic_isocket_stream<CharT, Traits>::buffer_type
*
72
claw::net::basic_isocket_stream<CharT, Traits>::rdbuf
()
const
73
{
74
return
const_cast<
buffer_type
*
>
(&m_buffer);
75
}
// basic_isocket_stream::rdbuf()
76
77
/*----------------------------------------------------------------------------*/
81
template
<
typename
CharT,
typename
Traits>
82
bool
claw::net::basic_isocket_stream<CharT, Traits>::is_open
()
const
83
{
84
return
m_buffer.
is_open
();
85
}
// basic_isocket_stream::()
86
87
/*----------------------------------------------------------------------------*/
93
template
<
typename
CharT,
typename
Traits>
94
void
claw::net::basic_isocket_stream<CharT, Traits>::open
95
(
const
std::string& address,
int
port )
96
{
97
if
( !m_buffer.open(address, port) )
98
this->setstate(std::ios_base::failbit);
99
else
100
this->clear();
101
}
// basic_isocket_stream::open()
102
103
/*----------------------------------------------------------------------------*/
109
template
<
typename
CharT,
typename
Traits>
110
void
claw::net::basic_isocket_stream<CharT, Traits>::open
(
int
fd )
111
{
112
if
( !m_buffer.open(fd) )
113
this->setstate(std::ios_base::failbit);
114
else
115
this->clear();
116
}
// basic_isocket_stream::open()
117
118
/*----------------------------------------------------------------------------*/
122
template
<
typename
CharT,
typename
Traits>
123
void
claw::net::basic_isocket_stream<CharT, Traits>::close
()
124
{
125
if
( !m_buffer.close() )
126
this->setstate(std::ios_base::failbit);
127
}
// basic_isocket_stream::close()
128
Generated on Thu Mar 14 2013 22:09:24 for Claw by
1.8.1.2