File indexing completed on 2024-04-28 04:31:57

0001 /*
0002  * Copyright (C) 2010-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 DocumentPalette_H
0012 #define DocumentPalette_H
0013 
0014 #include <QDataStream>
0015 #include <QList>
0016 #include <QMap>
0017 #include <QSharedDataPointer>
0018 #include <QStringList>
0019 
0020 #include "DocumentFloss.h"
0021 
0022 class QString;
0023 
0024 class DocumentPaletteData;
0025 
0026 class DocumentPalette
0027 {
0028 public:
0029     DocumentPalette();
0030     DocumentPalette(const DocumentPalette &other);
0031     ~DocumentPalette();
0032 
0033     QString schemeName() const;
0034     QString symbolLibrary() const;
0035     QMap<int, DocumentFloss *> flosses() const;
0036     QVector<int> sortedFlosses() const;
0037     QList<qint16> usedSymbols() const;
0038     const DocumentFloss *currentFloss() const;
0039     DocumentFloss *floss(int);
0040     int currentIndex() const;
0041 
0042     void setSchemeName(const QString &);
0043     void setSymbolLibrary(const QString &);
0044     void setCurrentIndex(int);
0045     void add(int, DocumentFloss *);
0046     int add(const QColor &);
0047     DocumentFloss *remove(int);
0048     DocumentFloss *replace(int, DocumentFloss *);
0049     void swap(int, int);
0050     qint16 freeSymbol() const;
0051 
0052     DocumentPalette &operator=(const DocumentPalette &);
0053     bool operator==(const DocumentPalette &) const;
0054     bool operator!=(const DocumentPalette &) const;
0055 
0056     friend QDataStream &operator<<(QDataStream &, const DocumentPalette &);
0057     friend QDataStream &operator>>(QDataStream &, DocumentPalette &);
0058 
0059 private:
0060     int freeIndex() const;
0061 
0062     QSharedDataPointer<DocumentPaletteData> d;
0063 };
0064 
0065 QDataStream &operator<<(QDataStream &, const DocumentPalette &);
0066 QDataStream &operator>>(QDataStream &, DocumentPalette &);
0067 
0068 #endif // DocumentPalette_H