Atlas-C++
Formatter.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) 2004 Alistair Riddoch
4 
5 // $Id$
6 
7 #ifndef ATLAS_FORMATTER_H
8 #define ATLAS_FORMATTER_H
9 
10 #include <Atlas/Bridge.h>
11 
12 namespace Atlas {
13 
23 class Formatter : public Bridge
24 {
25  public:
26 
27  Formatter(std::ostream & s, Atlas::Bridge & b);
28 
29  void streamBegin() override;
30  void streamMessage() override;
31  void streamEnd() override;
32 
33  void mapMapItem(std::string name) override;
34  void mapListItem(std::string name) override;
35  void mapIntItem(std::string name, long) override;
36  void mapFloatItem(std::string name, double) override;
37  void mapStringItem(std::string name, std::string) override;
38  void mapEnd() override;
39 
40  void listMapItem() override;
41  void listListItem() override;
42  void listIntItem(long) override;
43  void listFloatItem(double) override;
44  void listStringItem(std::string) override;
45  void listEnd() override;
46 
47  void setSpacing(int s) {
48  m_spacing = s;
49  }
50 
51  protected:
52 
53  std::ostream & m_stream;
54  Bridge & m_bridge;
55  int m_indent;
56  int m_spacing;
57 };
58 
59 } // Atlas namespace
60 
61 #endif // ATLAS_FORMATTER_H
void mapStringItem(std::string name, std::string) override
Adds a string to the currently streamed map.
void mapListItem(std::string name) override
Starts a list object to the currently streamed map.
Atlas stream bridge.
Definition: Bridge.h:35
void mapMapItem(std::string name) override
Starts a map object to the currently streamed map.
void listListItem() override
Starts a list object in the currently streamed list.
Atlas stream formatter.
Definition: Formatter.h:23
void streamBegin() override
Begin an Atlas stream.
void listIntItem(long) override
Adds an integer to the currently streames list.
The Atlas namespace.
Definition: Bridge.h:20
void mapEnd() override
Ends the currently streamed map.
void listFloatItem(double) override
Adds a float to the currently streamed list.
void listStringItem(std::string) override
Adds a string to the currently streamed list.
void mapIntItem(std::string name, long) override
Adds an integer to the currently streames map.
void streamMessage() override
Start a message in an Atlas stream.
void streamEnd() override
Ends the Atlas stream.
void listMapItem() override
Starts a map object in the currently streamed list.
void mapFloatItem(std::string name, double) override
Adds a float to the currently streamed map.
void listEnd() override
Ends 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.