File indexing completed on 2024-05-19 05:36:10

0001 /*
0002     SPDX-FileCopyrightText: 2010 Andriy Rysin <rysin@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QList>
0010 #include <QMap>
0011 #include <QString>
0012 
0013 /**
0014  * Represents an item for iso-* standards which consists of attributes and their values
0015  */
0016 struct IsoCodeEntry : public QMap<QString, QString> {
0017 };
0018 
0019 class IsoCodesPrivate;
0020 
0021 /**
0022  * Represents a set of codes for iso-* standards.
0023  * Uses iso-codes project to read and localize the values.
0024  */
0025 class IsoCodes
0026 {
0027 public:
0028     //  static const char* iso_639;
0029     static const char iso_639_3[];
0030 
0031     static const char attr_name[];
0032     //  static const char* attr_iso_639_2B_code;
0033     //  static const char* attr_iso_639_2T_code;
0034     //  static const char* attr_iso_639_1_code;
0035     static const char attr_iso_639_3_id[];
0036 
0037     /**
0038      * @param isoCode Code for iso standard, i.e. "639", for convenience there's iso_* constants defined
0039      * @param isoCodesXmlDir the directory where ISO data are stored
0040      */
0041     explicit IsoCodes(const QString &isoCode);
0042     ~IsoCodes();
0043 
0044     /**
0045      * @return Returns the list of items for this iso-* standard
0046      */
0047     QList<IsoCodeEntry> getEntryList();
0048     /**
0049      * @return Returns the item for which given attribute has specified value
0050      */
0051     const IsoCodeEntry *getEntry(const QString &attributeName, const QString &attributeValue);
0052 
0053 private:
0054     IsoCodesPrivate *const d;
0055 };