LibMusicXML  3.18
xmlfile.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 __xmlfile__
14 #define __xmlfile__
15 
16 #include <ostream>
17 #include <string>
18 #include "exports.h"
19 #include "xml.h"
20 #include "ctree.h"
21 
22 namespace MusicXML2
23 {
24 
25 //______________________________________________________________________________
26 class EXP TXMLDecl {
27  std::string fVersion;
28  std::string fEncoding;
29  int fStandalone;
30 
31  public:
32  enum { kundefined=-1, kNo, kYes };
33  TXMLDecl (const std::string version, const std::string encoding, int stdalone=kundefined)
34  : fVersion(version), fEncoding(encoding), fStandalone(stdalone) {}
35  virtual ~TXMLDecl() {}
36 
37  void setEncoding (std::string encoding) { fEncoding = encoding; }
38  std::string getVersion () const { return fVersion; }
39  std::string getEncoding () const { return fEncoding; }
40  int getStandalone () const { return fStandalone; }
41  void print (std::ostream& s);
42 };
44 
45 //______________________________________________________________________________
46 class EXP TDocType {
47  private:
48 
49  std::string fStartElement;
50  bool fPublic;
51  std::string fPubLitteral;
52  std::string fSysLitteral;
53 
54  public:
55  TDocType (const std::string start);
56  TDocType ( const std::string start, bool pub, const std::string publit, const std::string syslit)
57  : fStartElement(start), fPublic(pub), fPubLitteral(publit), fSysLitteral(syslit) {}
58  virtual ~TDocType() {}
59 
60  std::string getStartElement () { return fStartElement; }
61  bool getPublic () { return fPublic; }
62  std::string getPubLitteral () { return fPubLitteral; }
63  std::string getSysLitteral () { return fSysLitteral; }
64  void print (std::ostream& s);
65 };
67 
68 //______________________________________________________________________________
69 class EXP TXMLFile : public smartable
70 {
71  private:
72  TXMLDecl* fXMLDecl;
73  TDocType* fDocType;
74  Sxmlelement fXMLTree;
75 
76  protected:
77  TXMLFile () : fXMLDecl(0), fDocType(0) {}
78  virtual ~TXMLFile () { delete fXMLDecl; delete fDocType; }
79 
80  public:
81  static SMARTP<TXMLFile> create();
82 
83  public:
84  TXMLDecl* getXMLDecl () { return fXMLDecl; }
85  TDocType* getDocType () { return fDocType; }
86  Sxmlelement elements () { return fXMLTree; }
87 
88  void set (Sxmlelement root) { fXMLTree = root; }
89  void set (TXMLDecl * dec) { fXMLDecl = dec; }
90  void set (TDocType * dt) { fDocType = dt; }
91 
92  void print (std::ostream& s);
93 };
95 
96 
97 }
98 
99 #endif
the smart pointer implementation
Definition: smartpointer.h:58
Definition: xmlfile.h:46
Definition: xmlfile.h:26
Definition: xmlfile.h:70
the base class for smart pointers implementation
Definition: smartpointer.h:29