LibMusicXML 3.22
clonevisitor.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 __cloneVisitor__
14#define __cloneVisitor__
15
16#include <stack>
17#include "visitor.h"
18#include "xml.h"
19
20namespace MusicXML2
21{
22
27
31class EXP clonevisitor :
32 public visitor<Sxmlelement>
33{
34 public:
35 clonevisitor() : fClone(true) {}
36 virtual ~clonevisitor() {}
37
38 virtual void visitStart( Sxmlelement& elt );
39 virtual void visitEnd ( Sxmlelement& elt );
40
41 virtual Sxmlelement clone() { return fStack.top(); }
42
43 protected:
44 virtual void clone(bool state) { fClone = state; }
45 virtual void copyAttributes (const Sxmlelement& src, Sxmlelement& dst);
46 virtual Sxmlelement copy (const Sxmlelement& elt);
47 virtual Sxmlelement& lastCopy () { return fLastCopy; }
48
49 bool fClone;
50 Sxmlelement fLastCopy;
51 std::stack<Sxmlelement> fStack;
52};
53
55
56}
57
58#endif
Definition visitor.h:27