2
2
* This file is part of the Okteta Kasten Framework, made within the KDE community.
4
* Copyright 2009, 2010 Alex Richardson <alex.richardson@gmx.de>
4
* Copyright 2009, 2010, 2012 Alex Richardson <alex.richardson@gmx.de>
6
6
* This library is free software; you can redistribute it and/or
7
7
* modify it under the terms of the GNU Lesser General Public
35
35
class TopLevelDataInformation;
36
36
class AbstractStructureParser;
41
41
* This class takes care of all the XML parsing and stores the result.
43
43
class StructureDefinitionFile
45
Q_DISABLE_COPY(StructureDefinitionFile)
47
48
* This class uses lazy parsing
52
53
StructureDefinitionFile(StructureDefinitionFile& f);
53
54
virtual ~StructureDefinitionFile();
55
QList<TopLevelDataInformation*> structures();
56
/** this is all that is needed for the StructureAddRemoveWidget,
57
* should allow improving performance compared to before.
58
* This method is not const, since it may cause parsing when called the first time
60
const QStringList structureNames();
61
uint structuresCount();
62
TopLevelDataInformation* structure(QString& name);
56
QVector<TopLevelDataInformation*> structures() const;
57
QStringList structureNames() const;
58
TopLevelDataInformation* structure(const QString& name) const;
64
60
const KPluginInfo& pluginInfo() const;
65
61
const QDir dir() const;
66
62
/** @return the absolute path to the directory containing the structure definition */
67
63
QString absolutePath() const;
69
bool isParsed() const;
70
bool isParsedCompletely() const;
71
64
bool isValid() const;
73
66
KPluginInfo mPluginInfo;
74
67
/** the directory the plugin is saved in */
76
QList<const TopLevelDataInformation*> mTopLevelStructures;
77
QStringList mStructureNames;
79
AbstractStructureParser* mParser;
81
/** when true basic parsing finished (names of structures found)
82
* , i.e. mStructureNames has been filled */
83
bool mStructureNamesParsed :1;
84
/** when true complete parsing finished, i.e. mTopLevelStructures has been filled */
85
bool mStructuresParsedCompletely :1;
69
QScopedPointer<AbstractStructureParser> mParser;
88
72
inline const KPluginInfo& StructureDefinitionFile::pluginInfo() const
98
82
inline bool StructureDefinitionFile::isValid() const
103
inline bool StructureDefinitionFile::isParsed() const
105
return mStructureNamesParsed;
108
inline bool StructureDefinitionFile::isParsedCompletely() const
110
return mStructuresParsedCompletely;
113
} //namespace Kasten1
84
return !mParser.isNull();
115
89
#endif /* STRUCTUREDEFINITIONFILE_H_ */