Atlas-C++
PresentationBridge.h
1 /*
2  Copyright (C) 2013 Erik Ogenvik
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (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 General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 
19 #ifndef PRESENTATIONBRIDGE_H_
20 #define PRESENTATIONBRIDGE_H_
21 
22 #include <sstream>
23 #include <string>
24 #include <stack>
25 #include "Bridge.h"
26 
27 namespace Atlas
28 {
29 
35 {
36 public:
37  explicit PresentationBridge(std::stringstream& stream);
38  virtual ~PresentationBridge();
39 
40  virtual void streamBegin();
41  virtual void streamMessage();
42  virtual void streamEnd();
43 
44  virtual void mapMapItem(const std::string& name);
45  virtual void mapListItem(const std::string& name);
46  virtual void mapIntItem(const std::string& name, long);
47  virtual void mapFloatItem(const std::string& name, double);
48  virtual void mapStringItem(const std::string& name, const std::string&);
49  virtual void mapEnd();
50 
51  virtual void listMapItem();
52  virtual void listListItem();
53  virtual void listIntItem(long);
54  virtual void listFloatItem(double);
55  virtual void listStringItem(const std::string&);
56  virtual void listEnd();
57 
58 private:
59 
60  void addPadding();
61 
62  void removePadding();
63 
64  std::string mPadding;
65 
66  std::stringstream& mStream;
67 
73  std::stack<int> mMapsInList;
74 };
75 
76 }
77 #endif /* PRESENTATIONBRIDGE_H_ */
Atlas::Bridge
Atlas stream bridge.
Definition: Bridge.h:36
Atlas::PresentationBridge::mapIntItem
virtual void mapIntItem(const std::string &name, long)
Adds an integer to the currently streames map.
Atlas::PresentationBridge::mapMapItem
virtual void mapMapItem(const std::string &name)
Starts a map object to the currently streamed map.
Atlas::PresentationBridge::listEnd
virtual void listEnd()
Ends the currently streamed list.
Atlas::PresentationBridge::streamBegin
virtual void streamBegin()
Begin an Atlas stream.
Atlas::PresentationBridge::mapListItem
virtual void mapListItem(const std::string &name)
Starts a list object to the currently streamed map.
Atlas::PresentationBridge::listIntItem
virtual void listIntItem(long)
Adds an integer to the currently streames list.
Atlas::PresentationBridge::streamMessage
virtual void streamMessage()
Start a message in an Atlas stream.
Atlas::PresentationBridge::streamEnd
virtual void streamEnd()
Ends the Atlas stream.
Atlas::PresentationBridge::mapFloatItem
virtual void mapFloatItem(const std::string &name, double)
Adds a float to the currently streamed map.
Atlas::PresentationBridge::mapEnd
virtual void mapEnd()
Ends the currently streamed map.
Atlas::PresentationBridge::listMapItem
virtual void listMapItem()
Starts a map object in the currently streamed list.
Atlas::PresentationBridge::listListItem
virtual void listListItem()
Starts a list object in the currently streamed list.
Atlas::PresentationBridge::listStringItem
virtual void listStringItem(const std::string &)
Adds a string to the currently streamed list.
Atlas
The Atlas namespace.
Definition: Bridge.h:20
Atlas::PresentationBridge
A bridge which is meant to be used solely for presenting Element data.
Definition: PresentationBridge.h:35
Atlas::PresentationBridge::mapStringItem
virtual void mapStringItem(const std::string &name, const std::string &)
Adds a string to the currently streamed map.
Atlas::PresentationBridge::listFloatItem
virtual void listFloatItem(double)
Adds a float to the currently streamed list.

Copyright 2000-2004 the respective authors.

This document can be licensed under the terms of the GNU Free Documentation License or the GNU General Public License and may be freely distributed under the terms given by one of these licenses.