Atlas 0.7.0
Networking protocol for the Worldforge system.
EncoderBase.h
1// This file may be redistributed and modified only under the terms of
2// the GNU Lesser General Public License (See COPYING for details).
3// Copyright (C) 2000 Stefanus Du Toit
4
5// $Id$
6
7#ifndef ATLAS_ENCODERBASE_H
8#define ATLAS_ENCODERBASE_H
9
10#include <Atlas/Bridge.h>
11
12namespace Atlas {
13
30class EncoderBase { // : public Atlas::Bridge {
31public:
32
34 explicit EncoderBase(Atlas::Bridge & b) : m_b(b) { }
35
36 virtual ~EncoderBase() = default;
37
38 void streamBegin() { m_b.streamBegin(); }
39 void streamMessage() { m_b.streamMessage(); }
40 void streamEnd() { m_b.streamEnd(); }
41
42 void mapMapItem(const std::string& name)
43 { m_b.mapMapItem(name); }
44 void mapListItem(const std::string& name)
45 { m_b.mapListItem(name); }
46 void mapIntItem(const std::string& name, std::int64_t i)
47 { m_b.mapIntItem(name, i); }
48 void mapFloatItem(const std::string& name, double d)
49 { m_b.mapFloatItem(name, d); }
50 void mapStringItem(const std::string& name, const std::string& s)
51 { m_b.mapStringItem(name, s); }
52 void mapEnd()
53 { m_b.mapEnd(); }
54
55 void listMapItem() { m_b.listMapItem(); }
56 void listListItem() { m_b.listListItem(); }
57 void listIntItem(std::int64_t i) { m_b.listIntItem(i); }
58 void listFloatItem(double d) { m_b.listFloatItem(d); }
59 void listStringItem(const std::string& s) { m_b.listStringItem(s); }
60 void listEnd() { m_b.listEnd(); }
61
62protected:
65};
66
67} // namespace Atlas
68
69#endif // ATLAS_ENCODERBASE_H
virtual void mapFloatItem(std::string name, double)=0
virtual void mapEnd()=0
virtual void listEnd()=0
virtual void streamMessage()=0
virtual void listListItem()=0
virtual void listMapItem()=0
virtual void mapMapItem(std::string name)=0
virtual void streamEnd()=0
virtual void listStringItem(std::string)=0
virtual void listIntItem(std::int64_t)=0
virtual void streamBegin()=0
virtual void listFloatItem(double)=0
virtual void mapListItem(std::string name)=0
virtual void mapIntItem(std::string name, std::int64_t)=0
virtual void mapStringItem(std::string name, std::string)=0
Atlas::Bridge & m_b
The bridge that requests are forwarded to.
Definition: EncoderBase.h:64
EncoderBase(Atlas::Bridge &b)
You will need to implement this in subclasses.
Definition: EncoderBase.h:34
Definition: Bridge.h:20