Verovio
Source code documentation
iobase.h
1 // Name: iobase.h
3 // Author: Laurent Pugin
4 // Created: 2012
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_IOBASE_H__
9 #define __VRV_IOBASE_H__
10 
11 #include <string>
12 #include <vector>
13 
14 //----------------------------------------------------------------------------
15 
16 #include "vrvdef.h"
17 
18 namespace vrv {
19 
20 class Doc;
21 class Object;
22 
23 //----------------------------------------------------------------------------
24 // Output
25 //----------------------------------------------------------------------------
26 
31 class Output {
32 public:
33  // constructors and destructors
34  Output(Doc *doc, std::string filename);
35  Output(Doc *doc);
36  Output() {}
37  virtual ~Output();
38 
42  virtual std::string Export() = 0;
43 
47  virtual bool WriteObject(Object *object) { return true; }
48 
52  virtual bool WriteObjectEnd(Object *object) { return true; }
53 
57  virtual bool Skip(Object *object) const { return false; }
58 
59 public:
60  //
61 protected:
62  Doc *m_doc;
63 };
64 
65 //----------------------------------------------------------------------------
66 // Input
67 //----------------------------------------------------------------------------
68 
73 class Input {
74 public:
75  // constructors and destructors
76  Input(Doc *doc);
77  virtual ~Input();
78 
79  void SetOutputFormat(const std::string &format) { m_outformat = format; }
80  std::string GetOutputFormat() { return m_outformat; }
81 
82  // read
83  virtual bool Import(std::string const &data) { return true; }
84 
89  LayoutInformation GetLayoutInformation() { return m_layoutInformation; }
90 
91 private:
95  void Init();
96 
97 public:
98  //
99 
100 protected:
101  Doc *m_doc;
102 
108  LayoutInformation m_layoutInformation;
109 
110  std::string m_outformat = "mei";
111 };
112 
113 } // namespace vrv
114 
115 #endif
This class is a hold the data and corresponds to the model of a MVC design pattern.
Definition: doc.h:41
This class is a base class for input classes.
Definition: iobase.h:73
LayoutInformation m_layoutInformation
Indicates if we have layout information in the file loaded.
Definition: iobase.h:108
LayoutInformation GetLayoutInformation()
Getter for layoutInformation flag that is set to true during import if layout information is found (a...
Definition: iobase.h:89
This class represents a basic object.
Definition: object.h:61
This class is a base class for output classes.
Definition: iobase.h:31
virtual bool WriteObject(Object *object)
Dummy object method that must be overridden in child class.
Definition: iobase.h:47
virtual bool Skip(Object *object) const
Method for skipping under certain circumstances.
Definition: iobase.h:57
virtual std::string Export()=0
Main method for exporting the data.
virtual bool WriteObjectEnd(Object *object)
Dummy object method that must be overridden in child class.
Definition: iobase.h:52