~ubuntu-branches/ubuntu/vivid/kdesdk/vivid

« back to all changes in this revision

Viewing changes to okteta/kasten/controllers/view/structures/structuredefinitionfile.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-06-06 11:49:54 UTC
  • mfrom: (0.4.21)
  • Revision ID: package-import@ubuntu.com-20120606114954-rdls73fzlpzxglbx
Tags: 4:4.8.80-0ubuntu1
* New uptream beta release
* Update dont_export_private_classes.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *   This file is part of the Okteta Kasten Framework, made within the KDE community.
3
3
 *
4
 
 *   Copyright 2009, 2010 Alex Richardson <alex.richardson@gmx.de>
 
4
 *   Copyright 2009, 2010, 2012 Alex Richardson <alex.richardson@gmx.de>
5
5
 *
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
23
23
#define STRUCTUREDEFINITIONFILE_H_
24
24
 
25
25
#include <QString>
26
 
#include <QList>
 
26
#include <QVector>
27
27
#include <QDir>
28
28
#include <QStringList>
29
29
#include <QDomNodeList>
35
35
class TopLevelDataInformation;
36
36
class AbstractStructureParser;
37
37
 
38
 
namespace Kasten1
 
38
namespace Kasten2
39
39
{
40
40
/**
41
41
 *  This class takes care of all the XML parsing and stores the result.
42
42
 */
43
43
class StructureDefinitionFile
44
44
{
 
45
    Q_DISABLE_COPY(StructureDefinitionFile)
45
46
public:
46
47
    /**
47
48
     * This class uses lazy parsing
52
53
    StructureDefinitionFile(StructureDefinitionFile& f);
53
54
    virtual ~StructureDefinitionFile();
54
55
 
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
59
 
     */
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;
63
59
 
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;
68
 
 
69
 
    bool isParsed() const;
70
 
    bool isParsedCompletely() const;
71
64
    bool isValid() const;
72
65
private:
73
66
    KPluginInfo mPluginInfo;
74
67
    /** the directory the plugin is saved in */
75
68
    QDir mDir;
76
 
    QList<const TopLevelDataInformation*> mTopLevelStructures;
77
 
    QStringList mStructureNames;
78
 
 
79
 
    AbstractStructureParser* mParser;
80
 
    bool mValid :1;
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;
86
70
};
87
71
 
88
72
inline const KPluginInfo& StructureDefinitionFile::pluginInfo() const
97
81
 
98
82
inline bool StructureDefinitionFile::isValid() const
99
83
{
100
 
    return mValid;
101
 
}
102
 
 
103
 
inline bool StructureDefinitionFile::isParsed() const
104
 
{
105
 
    return mStructureNamesParsed;
106
 
}
107
 
 
108
 
inline bool StructureDefinitionFile::isParsedCompletely() const
109
 
{
110
 
    return mStructuresParsedCompletely;
111
 
}
112
 
 
113
 
} //namespace Kasten1
 
84
    return !mParser.isNull();
 
85
}
 
86
 
 
87
} //namespace Kasten2
114
88
 
115
89
#endif /* STRUCTUREDEFINITIONFILE_H_ */