Ardour  9.0-pre0-582-g084a23a80d
plugin_scan_result.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef _ardour_plugin_scan_result_h_
20 #define _ardour_plugin_scan_result_h_
21 
22 #ifdef WAF_BUILD
23 #include "libardour-config.h"
24 #endif
25 
26 #include <string>
27 
28 #include "ardour/plugin.h"
29 #include "ardour/types.h"
30 
31 namespace ARDOUR {
32 
34 {
35 public:
36  PluginScanLogEntry (PluginType const, std::string const& path);
39 
41  OK = 0x000,
42  New = 0x001, // plugin has no cache file, scan needed
43  Updated = 0x002, // plugin is newer than cache, scan needed
44  Error = 0x004, // scan failed
45  Incompatible = 0x008, // plugin is not compatible (eg 32/64bit) or LV2 in VST2 path
46  TimeOut = 0x010, // scan timed out
47  Blacklisted = 0x100,
48  Faulty = 0x017 // New | Updated | Error | Incompatible | TimeOut
49  };
50 
51  void reset ();
53  void msg (PluginScanResult, std::string msg = "");
55 
56  PluginInfoList const& nfo () const
57  {
58  return _info;
59  }
60 
61  XMLNode& state () const;
62 
63  PluginType type () const
64  {
65  return _type;
66  }
67 
68  std::string path () const
69  {
70  return _path;
71  }
72 
73  std::string log () const
74  {
75  return _scan_log;
76  }
77 
79  {
80  return _result;
81  }
82 
83  bool recent () const
84  {
85  return _recent;
86  }
87 
88  bool operator== (PluginScanLogEntry const& other) const
89  {
90  return other._type == _type && other._path == _path;
91  }
92 
93  bool operator!= (PluginScanLogEntry const& other) const
94  {
95  return other._type != _type || other._path != _path;
96  }
97 
98  bool operator< (PluginScanLogEntry const& other) const
99  {
100  if (other._type == _type) {
101  return _path < other._path;
102  }
103  return _type < other._type;
104  }
105 
106 private:
108  std::string _path;
110  std::string _scan_log;
112  bool _recent; // true: touched in this instance, false: loaded from disk
113 };
114 
115 } /* namespace ARDOUR */
116 
117 #endif /* _ardour_plugin_scan_result_h_ */
void set_result(PluginScanResult)
PluginInfoList const & nfo() const
PluginScanLogEntry(PluginScanLogEntry const &)
PluginScanResult result() const
PluginScanLogEntry(XMLNode const &)
PluginScanLogEntry(PluginType const, std::string const &path)
void msg(PluginScanResult, std::string msg="")
void add(PluginInfoPtr)
XMLNode & state() const
Definition: xml++.h:114
#define LIBARDOUR_API
std::list< PluginInfoPtr > PluginInfoList
Definition: plugin.h:66
std::shared_ptr< PluginInfo > PluginInfoPtr
Definition: plugin.h:65
bool operator==(const ProcessorSelection &a, const ProcessorSelection &b)