Ardour  9.0-pre0-582-g084a23a80d
library.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Paul Davis <paul@linuxaudiosystems.com>
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 #pragma once
20 
21 #include <cstdio>
22 #include <cstdint>
23 #include <functional>
24 #include <string>
25 #include <vector>
26 
27 
29 #include <curl/curl.h>
30 
31 namespace ARDOUR {
32 
34 {
35  public:
36  LibraryDescription (std::string const & n, std::string const & a, std::string const & d, std::string const & u, std::string const & l, std::string const & td, std::string const & s)
37  : _name (n), _author (a), _description (d), _url (u), _license (l), _toplevel_dir (td), _size (s), _installed (false) {}
38 
39  std::string const & name() const { return _name; }
40  std::string const & description() const { return _description; }
41  std::string const & author() const { return _author; }
42  std::string const & url() const { return _url; }
43  std::string const & license() const { return _license; }
44  std::string const & toplevel_dir() const { return _toplevel_dir; }
45  std::string const & size() const { return _size; }
46 
47  bool installed() const { return _installed; }
48  void set_installed (bool yn) { _installed = yn; }
49 
50  private:
51  std::string _name;
52  std::string _author;
53  std::string _description;
54  std::string _url;
55  std::string _license;
56  std::string _toplevel_dir;
57  std::string _size;
58  bool _installed;
59 };
60 
62  public:
64 
65  int add (std::string const & root_dir);
66 
68  size_t n_descriptions() const { return _descriptions.size(); }
69  void foreach_description (std::function<void (LibraryDescription)> f) const;
70 
71  bool installed (LibraryDescription const & desc);
72  void foreach_description (std::function<void (LibraryDescription)> f);
73 
74  private:
75  std::vector<LibraryDescription> _descriptions;
76  std::string install_path_for (LibraryDescription const &);
77 };
78 
79 } /* namespace */
80 
std::string _license
Definition: library.h:55
std::string const & license() const
Definition: library.h:43
std::string const & name() const
Definition: library.h:39
std::string _toplevel_dir
Definition: library.h:56
bool installed() const
Definition: library.h:47
std::string _description
Definition: library.h:53
std::string const & description() const
Definition: library.h:40
std::string const & toplevel_dir() const
Definition: library.h:44
std::string const & url() const
Definition: library.h:42
std::string const & size() const
Definition: library.h:45
void set_installed(bool yn)
Definition: library.h:48
std::string const & author() const
Definition: library.h:41
LibraryDescription(std::string const &n, std::string const &a, std::string const &d, std::string const &u, std::string const &l, std::string const &td, std::string const &s)
Definition: library.h:36
void foreach_description(std::function< void(LibraryDescription)> f) const
void foreach_description(std::function< void(LibraryDescription)> f)
std::vector< LibraryDescription > _descriptions
Definition: library.h:75
bool installed(LibraryDescription const &desc)
int add(std::string const &root_dir)
std::string install_path_for(LibraryDescription const &)
size_t n_descriptions() const
Definition: library.h:68
#define LIBARDOUR_API