~ubuntu-branches/ubuntu/wily/cxxtools/wily-proposed

« back to all changes in this revision

Viewing changes to src/connectable.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kari Pahula
  • Date: 2008-06-16 12:24:28 UTC
  • mfrom: (3.1.3 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080616122428-7bllgyt1358u779r
Tags: 1.4.8-2
Made libcxxtools-dev depend on libcxxtools6, not libcxxtools5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2004-2006 by Marc Boris Duerner                         *
 
3
 *                                                                         *
 
4
 *   This program is free software; you can redistribute it and/or modify  *
 
5
 *   it under the terms of the GNU Library General Public License as       *
 
6
 *   published by the Free Software Foundation; either version 2 of the    *
 
7
 *   License, or (at your option) any later version.                       *
 
8
 *                                                                         *
 
9
 *   This program is distributed in the hope that it will be useful,       *
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
12
 *   GNU General Public License for more details.                          *
 
13
 *                                                                         *
 
14
 *   You should have received a copy of the GNU Library General Public     *
 
15
 *   License along with this program; if not, write to the                 *
 
16
 *   Free Software Foundation, Inc.,                                       *
 
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 
18
 **************************************************************************/
 
19
#include "cxxtools/connectable.h"
 
20
#include "cxxtools/connection.h"
 
21
 
 
22
namespace cxxtools {
 
23
 
 
24
Connectable::Connectable()
 
25
{}
 
26
 
 
27
 
 
28
Connectable::Connectable(const Connectable& c)
 
29
 
30
    this->operator=(c); 
 
31
}
 
32
 
 
33
 
 
34
Connectable::~Connectable()
 
35
{
 
36
    this->clear();
 
37
}
 
38
 
 
39
 
 
40
void Connectable::clear()
 
41
{
 
42
    while( !_connections.empty() ) 
 
43
    {
 
44
        Connection connection = _connections.front();
 
45
        connection.close();
 
46
    }
 
47
}
 
48
 
 
49
 
 
50
Connectable& Connectable::operator=(const Connectable& other)
 
51
{
 
52
    return (*this);
 
53
}
 
54
 
 
55
 
 
56
bool Connectable::opened(const Connection& c)
 
57
{
 
58
    _connections.push_back(c);
 
59
    return true;
 
60
}
 
61
 
 
62
 
 
63
void Connectable::closed(const Connection& c)
 
64
{
 
65
    _connections.remove(c);
 
66
}
 
67
 
 
68
} // namespace cxxtools