src/librarycollection.h

changeset 1209
c2723022b173
child 1210
0b3b35f560f2
equal deleted inserted replaced
1208:8d4b8a9df724 1209:c2723022b173
1 #pragma once
2 #include <QDir>
3 #include "main.h"
4
5 /*
6 * Models a collection of libraries. A library is a folder containing directories named "p" and
7 * "parts" that contains part and subpart files.
8 */
9 class LibraryCollection
10 {
11 public:
12 enum FileType
13 {
14 Part,
15 Subpart,
16 Primitive,
17 HighResolutionPrimitive,
18 LowResolutionPrimitive,
19 };
20
21 struct FileSpec
22 {
23 QString name;
24 FileType type;
25 };
26
27 QString find(QString relativePath) const;
28 QString find(const QString& name, FileType type) const;
29 QString find(const FileSpec& spec) const;
30
31 static const QStringList directoryNames;
32
33 private:
34 class SubdirectoryNotFoundError : public std::exception {};
35
36 struct Library
37 {
38 QDir path;
39 QString name;
40
41 QDir subdirectory(FileType type) const;
42 static QString subdirectoryName(FileType type);
43 };
44
45 QVector<Library> m_libraries;
46 };

mercurial