summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Małek <michalm@jabster.pl>2014-08-07 20:54:45 (GMT)
committerMichał Małek <michalm@jabster.pl>2014-08-07 20:54:45 (GMT)
commit162b9c8e9dcbdbff60f9e6586338423ab5f1d7bb (patch)
tree58f333a7caeb9e646ccf5347dc2ba497558e0ff0
parentaf905c92f3333442b2d67eb11e02c8bde8eb4858 (diff)
Export also catogires.h header
-rw-r--r--libkcddb/CMakeLists.txt1
-rw-r--r--libkcddb/categories.cpp47
-rw-r--r--libkcddb/categories.h15
3 files changed, 52 insertions, 11 deletions
diff --git a/libkcddb/CMakeLists.txt b/libkcddb/CMakeLists.txt
index 79406f6..b92ef33 100644
--- a/libkcddb/CMakeLists.txt
+++ b/libkcddb/CMakeLists.txt
@@ -71,6 +71,7 @@ set_target_properties(kcddb PROPERTIES VERSION ${KCDDB_VERSION} SOVERSION ${KCDD
install(TARGETS kcddb EXPORT LibkcddbTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES
+ categories.h
cdinfo.h
cdinfodialog.h
client.h
diff --git a/libkcddb/categories.cpp b/libkcddb/categories.cpp
index 5a0569a..40abf0a 100644
--- a/libkcddb/categories.cpp
+++ b/libkcddb/categories.cpp
@@ -10,26 +10,61 @@
#include <KI18n/KLocalizedString>
+class KCDDB::Categories::Private
+{
+public:
+ QStringList cddb;
+ QStringList i18n;
+};
+
KCDDB::Categories::Categories()
+ : d(new Private)
{
// These are only 11 Category values defined by CDDB. See
//
// http://www.freedb.org/modules.php?name=Sections&sop=viewarticle&artid=26
//
- m_cddb << QLatin1String( "blues" ) << QLatin1String( "classical" ) << QLatin1String( "country" ) <<
+ d->cddb << QLatin1String( "blues" ) << QLatin1String( "classical" ) << QLatin1String( "country" ) <<
QLatin1String( "data" ) << QLatin1String( "folk" ) << QLatin1String( "jazz" ) << QLatin1String( "misc" ) <<
QLatin1String( "newage" ) << QLatin1String( "reggae" ) << QLatin1String( "rock" ) << QLatin1String( "soundtrack" );
- m_i18n << i18n("Blues") << i18n("Classical") << i18nc("music genre", "Country") <<
+ d->i18n << i18n("Blues") << i18n("Classical") << i18nc("music genre", "Country") <<
i18n("Data") << i18n("Folk") << i18n("Jazz") << i18n("Miscellaneous") <<
i18n("New Age") << i18n("Reggae") << i18n("Rock") << i18n("Soundtrack");
}
+KCDDB::Categories::~Categories()
+{
+ delete d;
+}
+
+KCDDB::Categories::Categories(const Categories& other)
+ :d(new Private)
+{
+ *d = *other.d;
+}
+
+KCDDB::Categories& KCDDB::Categories::operator=(const Categories& other)
+{
+ *d = *other.d;
+ return *this;
+}
+
+const QStringList &KCDDB::Categories::cddbList() const
+{
+ return d->cddb;
+}
+
+const QStringList &KCDDB::Categories::i18nList() const
+{
+ return d->i18n;
+}
+
const QString KCDDB::Categories::cddb2i18n(const QString &category) const
{
- int index = m_cddb.indexOf(category.trimmed());
+ int index = d->cddb.indexOf(category.trimmed());
if (index != -1)
{
- return m_i18n[index];
+ return d->i18n[index];
}
else
{
@@ -39,10 +74,10 @@ const QString KCDDB::Categories::cddb2i18n(const QString &category) const
const QString KCDDB::Categories::i18n2cddb(const QString &category) const
{
- int index = m_i18n.indexOf(category.trimmed());
+ int index = d->i18n.indexOf(category.trimmed());
if (index != -1)
{
- return m_cddb[index];
+ return d->cddb[index];
}
else
{
diff --git a/libkcddb/categories.h b/libkcddb/categories.h
index 2c13861..d96ae35 100644
--- a/libkcddb/categories.h
+++ b/libkcddb/categories.h
@@ -8,6 +8,7 @@
#ifndef KCDDB_CATEGORIES_H
#define KCDDB_CATEGORIES_H
+#include <libkcddb/kcddb_export.h>
#include <QtCore/QString>
#include <QtCore/QStringList>
@@ -16,13 +17,17 @@ namespace KCDDB
/**
* Category values defined by CDDB.
*/
- class Categories
+ class KCDDB_EXPORT Categories
{
public:
Categories();
+ Categories(const Categories&);
+ ~Categories();
- const QStringList &cddbList() const { return m_cddb; }
- const QStringList &i18nList() const { return m_i18n; }
+ Categories& operator=(const Categories&);
+
+ const QStringList &cddbList() const;
+ const QStringList &i18nList() const;
/**
* Lookup the CDDB category, and return the i18n'd version.
@@ -34,8 +39,8 @@ namespace KCDDB
*/
const QString i18n2cddb(const QString &category) const;
private:
- QStringList m_cddb;
- QStringList m_i18n;
+ class Private;
+ Private * const d;
};
}