1 /* 2 * C++ Interface: keduvockvtml1compability_p 3 * SPDX-FileCopyrightText: 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net> 4 * SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 #ifndef KEDUVOCKVTMLCOMPABILITY_H 7 #define KEDUVOCKVTMLCOMPABILITY_H 8 9 #include <QString> 10 #include <QMap> 11 #include <QSet> 12 13 14 // internal types, indented are subtypes 15 16 #define QM_VERB "v" // go 17 // #define QM_VERB_IRR "ir" 18 // #define QM_VERB_REG "re" 19 #define QM_NOUN "n" // table, coffee 20 // #define QM_NOUN_F "f" 21 // #define QM_NOUN_M "m" 22 // #define QM_NOUN_S "s" 23 #define QM_NAME "nm" 24 // #define QM_ART "ar" // article 25 // #define QM_ART_DEF "def" // definite a/an 26 // #define QM_ART_IND "ind" // indefinite the 27 #define QM_ADJ "aj" // adjective expensive, good 28 // #define QM_ADV "av" // adverb today, strongly 29 // #define QM_PRON "pr" // pronoun you, she 30 // #define QM_PRON_POS "pos" // possessive my, your 31 // #define QM_PRON_PER "per" // personal 32 // #define QM_PHRASE "ph" 33 // #define QM_NUM "num" // numeral 34 // #define QM_NUM_ORD "ord" // ordinal first, second 35 // #define QM_NUM_CARD "crd" // cardinal one, two 36 // #define QM_INFORMAL "ifm" 37 // #define QM_FIG "fig" 38 // #define QM_CON "con" // conjunction and, but 39 // #define QM_PREP "pre" // preposition behind, between 40 // #define QM_QUEST "qu" // question who, what 41 42 // type delimiters 43 44 #define QM_USER_TYPE "#" // designates number of user type 45 #define QM_TYPE_DIV ":" // divide main from subtype 46 47 // usage delimiters (also declared in UsageManager.h) 48 49 #define UL_USER_USAGE "#" // designates number of user type 50 51 class KEduVocWordType; 52 53 /** 54 * @file keduvockvtmlcompability.h 55 * contains defines and constants necessary for reading kvtml files prior to KDE4. kvtml version 1. 56 */ 57 class KEduVocKvtmlCompability 58 { 59 60 public: 61 /** 62 * Constructor, initialize the map. 63 */ 64 KEduVocKvtmlCompability(); 65 66 ///// TYPES 67 /** 68 * Get the type from an old type definition 69 * @param parent the parent word type 70 * @param typeSubtypeString the old string containing everything 71 * @return type 72 */ 73 KEduVocWordType* typeFromOldFormat(KEduVocWordType* parent, const QString & typeSubtypeString ) const; 74 75 /** 76 * To write old docs: convert a nice new type to the ugly old style. 77 * @param mainType type 78 * @param subType subtype 79 * @return old type string 80 */ 81 QString oldType( const QString& mainType, const QString& subType ) const; 82 83 84 void addUserdefinedTense( const QString& tense ); 85 QString tenseFromKvtml1( const QString & oldTense ); 86 QStringList documentTenses() const; 87 QString oldTense( const QString& tense ); 88 89 void setupWordTypes(KEduVocWordType* parent); 90 91 private: 92 93 //////////// TYPES ///////////////// 94 void initOldTypeLists(); 95 96 QMap<QString, QString> m_oldMainTypeNames; 97 QMap<QString, QString> m_oldSubTypeNames; 98 int m_userdefinedTypeCounter; 99 100 ///////////TENSES/CONJUGATIONS/////// 101 void initOldTenses(); 102 103 QMap<QString, QString> m_oldTenses; 104 int m_userdefinedTenseCounter; 105 QSet<QString> m_tenses; 106 107 /// # defines user defined usage/word type/tense 108 static const QString KVTML_1_USER_DEFINED; 109 /// : separates usages/word types 110 static const QString KVTML_1_SEPERATOR; 111 }; 112 113 #endif // KEDUVOCKVTMLCOMPABILITY_H 114