~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to qmake/generators/makefiledeps.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the qmake application of the Qt Toolkit.
 
6
**
 
7
** This file may be distributed under the terms of the Q Public License
 
8
** as defined by Trolltech AS of Norway and appearing in the file
 
9
** LICENSE.QPL included in the packaging of this file.
 
10
**
 
11
** This file may be distributed and/or modified under the terms of the
 
12
** GNU General Public License version 2 as published by the Free Software
 
13
** Foundation and appearing in the file LICENSE.GPL included in the
 
14
** packaging of this file.
 
15
**
 
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
17
**   information about Qt Commercial License Agreements.
 
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
 
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
#ifndef __MAKEFILEDEPS_H__
 
30
#define __MAKEFILEDEPS_H__
 
31
 
 
32
#include "qstringlist.h"
 
33
#include "qfileinfo.h"
 
34
 
 
35
struct SourceFile;
 
36
struct SourceDependChildren;
 
37
class SourceFiles;
 
38
 
 
39
class QMakeLocalFileName {
 
40
    uint is_null : 1;
 
41
    mutable QString real_name, local_name;
 
42
public:
 
43
    QMakeLocalFileName() : is_null(1) { }
 
44
    QMakeLocalFileName(const QString &);
 
45
    bool isNull() const { return is_null; }
 
46
    inline const QString &real() const { return real_name; }
 
47
    const QString &local() const;
 
48
};
 
49
 
 
50
class QMakeSourceFileInfo
 
51
{
 
52
private:
 
53
    //quick project lookups
 
54
    SourceFiles *files, *includes;
 
55
    bool files_changed;
 
56
    QList<QMakeLocalFileName> depdirs;
 
57
 
 
58
    //sleezy buffer code
 
59
    char *spare_buffer;
 
60
    int   spare_buffer_size;
 
61
    char *getBuffer(int s);
 
62
 
 
63
    //actual guts
 
64
    bool findMocs(SourceFile *);
 
65
    bool findDeps(SourceFile *);
 
66
    void dependTreeWalker(SourceFile *, SourceDependChildren *);
 
67
 
 
68
    //cache
 
69
    QString cachefile;
 
70
 
 
71
protected:
 
72
    virtual QMakeLocalFileName fixPathForFile(const QMakeLocalFileName &, bool forOpen=false);
 
73
    virtual QMakeLocalFileName findFileForDep(const QMakeLocalFileName &, const QMakeLocalFileName &);
 
74
    virtual QFileInfo findFileInfo(const QMakeLocalFileName &);
 
75
 
 
76
public:
 
77
    QMakeSourceFileInfo(const QString &cachefile="");
 
78
    virtual ~QMakeSourceFileInfo();
 
79
 
 
80
    QList<QMakeLocalFileName> dependencyPaths() const { return depdirs; }
 
81
    void setDependencyPaths(const QList<QMakeLocalFileName> &);
 
82
 
 
83
    enum DependencyMode { Recursive, NonRecursive };
 
84
    inline void setDependencyMode(DependencyMode mode) { dep_mode = mode; }
 
85
    inline DependencyMode dependencyMode() const { return dep_mode; }
 
86
 
 
87
    enum SourceFileType { TYPE_UNKNOWN, TYPE_C, TYPE_UI, TYPE_QRC };
 
88
    enum SourceFileSeek { SEEK_DEPS=0x01, SEEK_MOCS=0x02 };
 
89
    void addSourceFiles(const QStringList &, uchar seek, SourceFileType type=TYPE_C);
 
90
    void addSourceFile(const QString &, uchar seek, SourceFileType type=TYPE_C);
 
91
    bool containsSourceFile(const QString &, SourceFileType type=TYPE_C);
 
92
 
 
93
    int included(const QString &file);
 
94
    QStringList dependencies(const QString &file);
 
95
 
 
96
    bool mocable(const QString &file);
 
97
 
 
98
    virtual QMap<QString, QStringList> getCacheVerification();
 
99
    virtual bool verifyCache(const QMap<QString, QStringList> &);
 
100
    void setCacheFile(const QString &cachefile); //auto caching
 
101
    void loadCache(const QString &cf);
 
102
    void saveCache(const QString &cf);
 
103
 
 
104
private:
 
105
    DependencyMode dep_mode;
 
106
};
 
107
 
 
108
#endif /* __MAKEFILEDEPS_H__ */