LibMusicXML 3.22
xmlvisitor.h
1/*
2 MusicXML Library
3 Copyright (C) Grame 2006-2013
4
5 This Source Code Form is subject to the terms of the Mozilla Public
6 License, v. 2.0. If a copy of the MPL was not distributed with this
7 file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9 Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
10 research@grame.fr
11*/
12
13#ifndef __xmlvisitors__
14#define __xmlvisitors__
15
16#include <ostream>
17
18#include "tree_browser.h"
19#include "typedefs.h"
20#include "visitor.h"
21#include "xml.h"
22
23namespace MusicXML2
24{
25
26//______________________________________________________________________________
32class xmlendl {
33 private:
34 int fIndent;
35 public:
36 xmlendl() : fIndent(0) {}
37 virtual ~xmlendl() {}
38
40 xmlendl& operator++ (int) { fIndent++; return *this; }
42 xmlendl& operator-- (int) { fIndent--; return *this; }
44 void print(std::ostream& os) const;
45};
46std::ostream& operator<< (std::ostream& os, const xmlendl& eol);
47
48//______________________________________________________________________________
49class xmlvisitor :
50 public visitor<S_comment>,
51 public visitor<S_processing_instruction>,
52 public visitor<Sxmlelement>
53{
54 std::ostream& fOut;
55 xmlendl fendl;
56
57 public:
58 xmlvisitor(std::ostream& stream) : fOut(stream) {}
59 virtual ~xmlvisitor() {}
60
61 virtual void visitStart ( Sxmlelement& elt);
62 virtual void visitEnd ( Sxmlelement& elt);
63 virtual void visitStart ( S_comment& elt);
64 virtual void visitStart ( S_processing_instruction& elt);
65};
66
67} // namespace MusicXML2
68
69
70#endif
Definition visitor.h:27
Definition xmlvisitor.h:32
xmlendl & operator++(int)
increase the indentation
Definition xmlvisitor.h:40
xmlendl & operator--(int)
decrease the indentation
Definition xmlvisitor.h:42
void print(std::ostream &os) const
reset the indentation to none