Ardour  8.12
element_import_handler.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008 Sakari Bergen <sakari.bergen@beatwaves.net>
3  * Copyright (C) 2013 Paul Davis <paul@linuxaudiosystems.com>
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 along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef __ardour_element_import_handler_h__
21 #define __ardour_element_import_handler_h__
22 
23 #include <list>
24 #include <memory>
25 #include <set>
26 #include <string>
27 
29 #include "pbd/libpbd_visibility.h"
30 
31 class XMLTree;
32 
33 namespace ARDOUR {
34 
35 class Session;
36 class ElementImporter;
37 
40 {
41  public:
42  typedef std::shared_ptr<ElementImporter> ElementPtr;
43  typedef std::list<ElementPtr> ElementList;
44 
54  : source (source), session (session) { }
55 
57 
61  virtual std::string get_info () const = 0;
62 
65 
66  /* For checking duplicates names against queued elements */
67 
72  bool check_name (const std::string & name) const;
73 
75  void add_name (std::string name);
76 
78  void remove_name (const std::string & name);
79 
81  static bool dirty () { return _dirty; }
82 
84  static void set_dirty () { _dirty = true; }
85 
87  static bool errors () { return _errors; }
88 
90  static void set_errors () { _errors = true; }
91 
92  protected:
94  XMLTree const & source;
95 
98 
100  static bool _dirty;
101 
103  static bool _errors;
104 
105  private:
107  std::set<std::string> names;
108 };
109 
110 } // namespace ARDOUR
111 
112 #endif
Virtual interface class for element import handlers.
static bool errors()
Checks wheter or not all elements were imported cleanly.
ARDOUR::Session & session
Destination session.
bool check_name(const std::string &name) const
static bool _dirty
Session XML readability.
std::list< ElementPtr > ElementList
void remove_name(const std::string &name)
Removes name from the list of used names.
std::set< std::string > names
Set of names for duplicate checking.
ElementList elements
Elements this handler handles.
ElementImportHandler(XMLTree const &source, ARDOUR::Session &session)
static void set_dirty()
Sets handler dirty.
static void set_errors()
Sets handler dirty.
static bool _errors
Errors post initialization.
void add_name(std::string name)
Adds name to the list of used names.
virtual std::string get_info() const =0
std::shared_ptr< ElementImporter > ElementPtr
static bool dirty()
Checks wheter or not all elements can be imported cleanly.
XMLTree const & source
Source session XML tree.
Definition: xml++.h:74
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
void session(lua_State *L)