File indexing completed on 2024-04-21 04:32:08

0001 /*
0002  * Copyright (C) 2003-2015 by Stephen Allewell
0003  * steve.allewell@gmail.com
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2 of the License, or
0008  * (at your option) any later version.
0009  */
0010 
0011 #ifndef LibraryFile_H
0012 #define LibraryFile_H
0013 
0014 #include <QList>
0015 #include <QString>
0016 
0017 class LibraryPattern;
0018 
0019 class LibraryFile
0020 {
0021 public:
0022     explicit LibraryFile(const QString &);
0023     ~LibraryFile();
0024 
0025     QString path() const;
0026     QString localFile() const;
0027     bool isWritable() const;
0028 
0029     void addPattern(LibraryPattern *);
0030     void deletePattern(LibraryPattern *);
0031     LibraryPattern *first();
0032     LibraryPattern *next();
0033 
0034 private:
0035     void readFile();
0036     void writeFile();
0037     bool hasChanged();
0038 
0039     static const int version = 100;
0040 
0041     bool m_exists;
0042     bool m_read;
0043     QString m_path;
0044     QList<LibraryPattern *> m_libraryPatterns;
0045     int m_current;
0046 };
0047 
0048 #endif // LibraryFile_H