LibMusicXML  3.18
lpsrElements.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 ___lpsrElements___
14 #define ___lpsrElements___
15 
16 #include "msrElements.h"
17 
18 
19 namespace MusicXML2
20 {
21 
22 //______________________________________________________________________________
23 class lpsrElement : public msrElement
24 {
25  public:
26 
27  // creation from MusicXML
28  // ------------------------------------------------------
29 
30  static SMARTP<lpsrElement> create (
31  int inputLineNumber);
32 
33  protected:
34 
35  // constructors/destructor
36  // ------------------------------------------------------
37 
38  lpsrElement (
39  int inputLineNumber);
40 
41  virtual ~lpsrElement ();
42 
43  public:
44 
45  // set and get
46  // ------------------------------------------------------
47 
48  public:
49 
50  // services
51  // ------------------------------------------------------
52 
53 
54  public:
55 
56  // visitors
57  // ------------------------------------------------------
58 
59  virtual void acceptIn (basevisitor* v);
60  virtual void acceptOut (basevisitor* v);
61 
62  virtual void browseData (basevisitor* v);
63 };
65 
66 //______________________________________________________________________________
67 template <typename T> class lpsrBrowser : public browser<T>
68 {
69  protected:
70 
71  basevisitor* fVisitor;
72 
73  virtual void enter (T& t) { t.acceptIn (fVisitor); }
74  virtual void leave (T& t) { t.acceptOut (fVisitor); }
75 
76  public:
77 
78  lpsrBrowser (basevisitor* v) : fVisitor (v)
79  {}
80 
81  virtual ~lpsrBrowser ()
82  {}
83 
84  virtual void set (basevisitor* v)
85  { fVisitor = v; }
86 
87  virtual void browse (T& t)
88  {
89  enter (t);
90 
91  t.browseData (fVisitor);
92 
93  leave (t);
94  }
95 };
96 
97 
98 }
99 
100 
101 #endif
the smart pointer implementation
Definition: smartpointer.h:58
Definition: basevisitor.h:25
Definition: browser.h:22
Definition: lpsrElements.h:68
Definition: lpsrElements.h:24
Definition: msrElements.h:26