root/tlate/value.hh

Revision cc0a570a9262613f7046938be649f27646987cb8, 2.0 KB (checked in by Antti-Juhani Kaijanaho <antti-juhani@…>, 2 years ago)

Add support for Atom feeds, and implement a group feed

Partially addresses #8

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, 2010 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_VALUE_HH
21#define GUARD_TLATE_VALUE_HH
22
23#include <boost/shared_ptr.hpp>
24#include <string>
25#include <sstream>
26
27namespace tlate
28{
29        class sequential_value;
30        class value
31        {
32        protected:
33                value() {}
34                value(const value &) {}
35                value &operator=(const value &);
36        public:
37                typedef boost::shared_ptr<value> ptr;
38                typedef boost::shared_ptr<const value> const_ptr;
39
40                virtual ~value() {}
41                virtual bool is_missing() const { return false; }
42                virtual
43                value::const_ptr call(boost::shared_ptr<sequential_value>,
44                                      std::string /*fname*/, int /*line*/)
45                        const {
46                        return value::ptr();
47                }
48                virtual void print(std::ostream &) const = 0;
49                std::string to_string() const {
50                        std::ostringstream ss;
51                        print(ss);
52                        return ss.str();
53                }
54        };
55
56        inline std::ostream &operator<<(std::ostream &os, value::const_ptr v)
57        {
58                if (v) v->print(os);
59                return os;
60        }
61}
62
63#endif /* GUARD_TLATE_VALUE_HH */
Note: See TracBrowser for help on using the browser.