ardour
element_import_handler.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 Paul Davis
3  Author: Sakari Bergen
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 
19 */
20 
21 #ifndef __ardour_element_import_handler_h__
22 #define __ardour_element_import_handler_h__
23 
24 #include <string>
25 #include <list>
26 #include <set>
27 
28 #include <boost/shared_ptr.hpp>
29 
31 #include "pbd/libpbd_visibility.h"
32 
33 class XMLTree;
34 
35 namespace ARDOUR {
36 
37 class Session;
38 class ElementImporter;
39 
42 {
43  public:
45  typedef std::list<ElementPtr> ElementList;
46 
54  ElementImportHandler (XMLTree const & source, ARDOUR::Session & session)
55  : source (source), session (session) { }
56 
57  virtual ~ElementImportHandler ();
58 
62  virtual std::string get_info () const = 0;
63 
65  ElementList elements;
66 
67  /* For checking duplicates names against queued elements */
68 
73  bool check_name (const std::string & name) const;
74 
76  void add_name (std::string name);
77 
79  void remove_name (const std::string & name);
80 
82  static bool dirty () { return _dirty; }
83 
85  static void set_dirty () { _dirty = true; }
86 
88  static bool errors () { return _errors; }
89 
91  static void set_errors () { _errors = true; }
92 
93  protected:
95  XMLTree const & source;
96 
99 
101  static bool _dirty;
102 
104  static bool _errors;
105 
106  private:
108  std::set<std::string> names;
109 };
110 
111 } // namespace ARDOUR
112 
113 #endif
static bool errors()
Checks wheter or not all elements were imported cleanly.
static bool _errors
Errors post initialization.
Definition: xml++.h:55
static bool _dirty
Session XML readability.
ElementImportHandler(XMLTree const &source, ARDOUR::Session &session)
ARDOUR::Session & session
Destination session.
static bool dirty()
Checks wheter or not all elements can be imported cleanly.
Definition: amp.h:29
XMLTree const & source
Source session XML tree.
#define LIBARDOUR_API
Virtual interface class for element import handlers.
std::list< ElementPtr > ElementList
const char * name
ElementList elements
Elements this handler handles.
boost::shared_ptr< ElementImporter > ElementPtr
std::set< std::string > names
Set of names for duplicate checking.
static void set_errors()
Sets handler dirty.
static void set_dirty()
Sets handler dirty.