diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/cpp/includepathresolver.h | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/cpp/includepathresolver.h')
-rw-r--r-- | languages/cpp/includepathresolver.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/languages/cpp/includepathresolver.h b/languages/cpp/includepathresolver.h new file mode 100644 index 00000000..c182d52e --- /dev/null +++ b/languages/cpp/includepathresolver.h @@ -0,0 +1,76 @@ +/*************************************************************************** + copyright : (C) 2007 by David Nolden + email : david.nolden.kdevelop@art-master.de +***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef INCLUDEPATHRESOLVER_H +#define INCLUDEPATHRESOLVER_H +#include <qstring.h> /* defines QString */ +#include <qmap.h> + +namespace CppTools { + class FileModificationTimeWrapper; + + struct PathResolutionResult { + PathResolutionResult( bool _success = false, const QString& _errorMessage = QString(), const QString& _longErrorMessage = QString() ) : success( _success ), errorMessage( _errorMessage ), longErrorMessage( _longErrorMessage ) { + } + bool success; + QString errorMessage; + QString longErrorMessage; + + QStringList path; + + operator bool() const { + return success; + }; + }; + + class SourcePathInformation; + + ///One resolution-try can issue up to 4 make-calls in worst case + class IncludePathResolver { + public: + ///Whether the Qt event-loop should be continued(using BlockingKProcess). This crashes if enabled in a non-foreground thread. + IncludePathResolver( bool continueEventLoop = false ); + ///Same as below, but uses the directory of the file as working-directory. The argument must be absolute. + PathResolutionResult resolveIncludePath( const QString& file ); + ///The include-path is only computed once for a whole directory, then it is cached using the modification-time of the Makefile. + PathResolutionResult resolveIncludePath( const QString& file, const QString& workingDirectory ); + ///source and build must be absolute paths + void setOutOfSourceBuildSystem( const QString& source, const QString& build ); + private: + bool m_isResolving; + bool m_continueEventLoop; + struct CacheEntry { + CacheEntry() : failed(false) { + } + QDateTime modificationTime; + QStringList path; + QString errorMessage, longErrorMessage; + bool failed; + QMap<QString,bool> failedFiles; + QDateTime failTime; + }; + typedef QMap<QString, CacheEntry> Cache; + Cache m_cache; + + ///Executes the command, either using popen or BlockingKProcess + PathResolutionResult getFullOutput( const QString& command, const QString& workingDirectory, QString& output ) const; + bool executeCommandPopen ( const QString& command, const QString& workingDirectory, QString& result ) const; + ///file should be the name of the target, without extension(because that may be different) + PathResolutionResult resolveIncludePathInternal( const QString& file, const QString& workingDirectory, const QString& makeParameters, const SourcePathInformation& source ); + bool m_outOfSource; + QString m_source; + QString m_build; + }; +}; + +#endif |