root/tlate/list_value.hh

Revision 173e2ce96a7bde630476defe34fae1b5ed1baaba, 1.8 KB (checked in by Antti-Juhani Kaijanaho <antti-juhani@…>, 16 months ago)

#79: Kill tlate::msg_value precursor and followup lists if they are empty

Signed-off-by: Antti-Juhani Kaijanaho <antti-juhani@…>

  • Property mode set to 100644
Line 
1/*  This file is part of Alue, the multiprotocol Internet discussion daemon
2
3    Copyright © 2009, 2011 Antti-Juhani Kaijanaho
4
5    Alue is free software: you can redistribute it and/or modify it
6    under the terms of the GNU General Public License as published by
7    the Free Software Foundation, either version 3 of the License, or
8    (at your option) any later version.
9
10    Alue is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with Alue.  If not, see <http://www.gnu.org/licenses/>.
17
18 */
19
20#ifndef GUARD_TLATE_LIST_VALUE_HH
21#define GUARD_TLATE_LIST_VALUE_HH
22
23#include "basic_sequential_value.hh"
24#include <list>
25
26namespace tlate
27{
28        class list_value : public basic_sequential_value<
29                std::list<value::const_ptr>,
30                value::const_ptr (*)(value::const_ptr)>
31        {
32                typedef basic_sequential_value<
33                        std::list<value::const_ptr>,
34                        value::const_ptr (*)(value::const_ptr)> base;
35                static value::const_ptr id(value::const_ptr v) { return v; }
36        public:
37                typedef boost::shared_ptr<list_value> ptr;
38                typedef boost::shared_ptr<const list_value> cconst_ptr;
39                list_value(std::list<value::const_ptr> list =
40                           std::list<value::const_ptr>())
41                        : base(list, id)
42                        {}
43                void push_back(value::const_ptr v) { get().push_back(v); }
44                bool empty() const { return get().empty(); }
45        };
46}
47
48#endif /* GUARD_TLATE_LIST_VALUE_HH */
Note: See TracBrowser for help on using the browser.