File: Formatter.h

package info (click to toggle)
atlas-cpp 0.5.98-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,652 kB
  • ctags: 2,284
  • sloc: sh: 8,305; cpp: 6,372; python: 1,471; makefile: 216
file content (59 lines) | stat: -rw-r--r-- 1,513 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// This file may be redistributed and modified only under the terms of
// the GNU Lesser General Public License (See COPYING for details).
// Copyright (C) 2004 Alistair Riddoch

#ifndef ATLAS_FORMATTER_H
#define ATLAS_FORMATTER_H

#include <Atlas/Bridge.h>

namespace Atlas {

/** Atlas stream formatter

This class implements the Bridge interface that accepts an Atlas stream.
It copies the input stream to an output bridge, inserting formatting
characters according to settings defined at construction time.

@see Codec
*/

class Formatter : public Bridge
{
  public:
    
    Formatter(std::iostream & s, Atlas::Bridge & b);

    virtual void streamBegin();
    virtual void streamMessage();
    virtual void streamEnd();
    
    virtual void mapMapItem(const std::string& name);
    virtual void mapListItem(const std::string& name);
    virtual void mapIntItem(const std::string& name, long);
    virtual void mapFloatItem(const std::string& name, double);
    virtual void mapStringItem(const std::string& name, const std::string&);
    virtual void mapEnd();
    
    virtual void listMapItem();
    virtual void listListItem();
    virtual void listIntItem(long);
    virtual void listFloatItem(double);
    virtual void listStringItem(const std::string&);
    virtual void listEnd();

    void setSpacing(int s) {
        m_spacing = s;
    }

  protected:

    std::iostream & m_stream;
    Bridge & m_bridge;
    int m_indent;
    int m_spacing;
};

} // Atlas namespace

#endif // ATLAS_FORMATTER_H