Ardour  9.0-pre0-582-g084a23a80d
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 #pragma once
21 
22 #include <list>
23 #include <memory>
24 #include <set>
25 #include <string>
26 
28 #include "pbd/libpbd_visibility.h"
29 
30 class XMLTree;
31 
32 namespace ARDOUR {
33 
34 class Session;
35 class ElementImporter;
36 
39 {
40  public:
41  typedef std::shared_ptr<ElementImporter> ElementPtr;
42  typedef std::list<ElementPtr> ElementList;
43 
53  : source (source), session (session) { }
54 
56 
60  virtual std::string get_info () const = 0;
61 
64 
65  /* For checking duplicates names against queued elements */
66 
71  bool check_name (const std::string & name) const;
72 
74  void add_name (std::string name);
75 
77  void remove_name (const std::string & name);
78 
80  static bool dirty () { return _dirty; }
81 
83  static void set_dirty () { _dirty = true; }
84 
86  static bool errors () { return _errors; }
87 
89  static void set_errors () { _errors = true; }
90 
91  protected:
93  XMLTree const & source;
94 
97 
99  static bool _dirty;
100 
102  static bool _errors;
103 
104  private:
106  std::set<std::string> names;
107 };
108 
109 } // namespace ARDOUR
110 
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)