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
5
#include <Atlas/Message/DecoderBase.h>
7
namespace Atlas { namespace Message {
9
DecoderBase::DecoderBase()
13
void DecoderBase::streamBegin()
15
state.push(STATE_STREAM);
18
void DecoderBase::streamMessage(const Map&)
22
state.push(STATE_MAP);
25
void DecoderBase::streamEnd()
30
void DecoderBase::mapItem(const std::string& name, const Map&)
35
state.push(STATE_MAP);
38
void DecoderBase::mapItem(const std::string& name, const List&)
43
state.push(STATE_LIST);
46
void DecoderBase::mapItem(const std::string& name, long i)
51
void DecoderBase::mapItem(const std::string& name, double d)
56
void DecoderBase::mapItem(const std::string& name, const std::string& s)
61
void DecoderBase::mapEnd()
63
Element::MapType map = maps.top();
66
switch (state.top()) {
68
maps.top()[names.top()] = map;
72
lists.top().insert(lists.top().end(), map);
80
void DecoderBase::listItem(const Map&)
84
state.push(STATE_MAP);
87
void DecoderBase::listItem(const List&)
89
Element::ListType list;
91
state.push(STATE_LIST);
94
void DecoderBase::listItem(long i)
96
lists.top().push_back(i);
99
void DecoderBase::listItem(double d)
101
lists.top().push_back(d);
104
void DecoderBase::listItem(const std::string& s)
106
lists.top().push_back(s);
109
void DecoderBase::listEnd()
111
Element::ListType list = lists.top();
114
switch (state.top()) {
116
maps.top()[names.top()] = list;
120
lists.top().push_back(list);
123
// XXX - report error?
128
} } // namespace Atlas::Message