LibMusicXML
3.18
src
lib
tree_browser.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 __tree_browser__
14
#define __tree_browser__
15
16
#include "exports.h"
17
#include "basevisitor.h"
18
#include "browser.h"
19
#include "ctree.h"
20
21
namespace
MusicXML2
22
{
23
24
//______________________________________________________________________________
25
template
<
typename
T>
class
EXP
tree_browser
:
public
browser
<T>
26
{
27
protected
:
28
basevisitor
* fVisitor;
29
30
virtual
void
enter (T& t) { t.acceptIn(*fVisitor); }
31
virtual
void
leave (T& t) { t.acceptOut(*fVisitor); }
32
33
public
:
34
typedef
typename
ctree<T>::treePtr
treePtr
;
35
36
tree_browser
(
basevisitor
* v) : fVisitor(v) {}
37
virtual
~
tree_browser
() {}
38
39
virtual
void
set (
basevisitor
* v) { fVisitor = v; }
40
virtual
void
browse (T& t) {
41
enter(t);
42
typename
ctree<T>::literator
iter;
43
for
(iter = t.lbegin(); iter != t.lend(); iter++)
44
browse(**iter);
45
leave(t);
46
}
47
};
48
49
}
50
51
#endif
MusicXML2::ctree::literator
branchs::iterator literator
the current level iterator type
Definition:
ctree.h:128
MusicXML2::tree_browser
Definition:
tree_browser.h:26
MusicXML2::SMARTP
the smart pointer implementation
Definition:
smartpointer.h:58
MusicXML2::basevisitor
Definition:
basevisitor.h:25
MusicXML2::browser
Definition:
browser.h:22
Generated by
1.8.18