QGpCoreTools/PackageInfo.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of QGpCoreTools.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2007-02-08
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef PACKAGEINFO_H
00029 #define PACKAGEINFO_H
00030 
00031 #include <QtCore>
00032 
00033 #include "QGpCoreToolsDLLExport.h"
00034 
00035 namespace QGpCoreTools {
00036 
00037 class QGPCORETOOLS_EXPORT PackageInfo
00038 {
00039 public:
00040   PackageInfo(QString package,
00041               QString binDir,
00042               QString libDir,
00043               QString includeDir,
00044               QString shareDir,
00045               QString version,
00046               QString versionTime,
00047               QString versionType,
00048               QString distribtion,
00049               QString authors);
00050   PackageInfo(const PackageInfo& o);
00051 
00052   const QString & package() const {return _package;}
00053   const QString & binDir() const {return _binDir;}
00054   const QString & libDir() const {return _libDir;}
00055   const QString & includeDir() const {return _includeDir;}
00056   const QString & shareDir() const {return _shareDir;}
00057 #ifdef Q_WS_WIN
00058   const QString & dllDir() const {return binDir();}
00059 #else
00060   const QString & dllDir() const {return libDir();}
00061 #endif
00062   const QString & version() const {return _version;}
00063   const QString & versionTime() const {return _versionTime;}
00064   const QString & versionType() const {return _versionType;}
00065   const QString & distribution() const {return _distribution;}
00066   const QString & authors() const {return _authors;}
00067 
00068   static QString getInstallDir(QString organization, QString package, QString dir, QString defaultDir);
00069   static const PackageInfo * package(QString package);
00070   static QList<PackageInfo> * list();
00071 private:
00072   QString _package;
00073   QString _binDir;
00074   QString _libDir;
00075   QString _includeDir;
00076   QString _shareDir;
00077   QString _version;
00078   QString _versionTime;
00079   QString _versionType;
00080   QString _distribution;
00081   QString _authors;
00082 
00083   static QList<PackageInfo> * _list;
00084 };
00085 
00086 #define PACKAGE_INFO(package, PACKAGE) \
00087   class package##InfoInit \
00088   { \
00089   public: \
00090     package##InfoInit() { \
00091       PackageInfo::list()->append(PackageInfo(# package, \
00092             PackageInfo::getInstallDir("geopsy", # package, "binDir", QString::fromUtf8(PACKAGE##_BINDIR)), \
00093             PackageInfo::getInstallDir("geopsy", # package, "libDir", QString::fromUtf8(PACKAGE##_LIBDIR)), \
00094             PackageInfo::getInstallDir("geopsy", # package, "includeDir", QString::fromUtf8(PACKAGE##_INCDIR)), \
00095             PackageInfo::getInstallDir("geopsy", # package, "shareDir", QString::fromUtf8(PACKAGE##_SHAREDIR)), \
00096             PACKAGE##_VERSION, \
00097             PACKAGE##_VERSION_TIME, \
00098             PACKAGE##_VERSION_TYPE, \
00099             PACKAGE##_DISTRIBUTION, \
00100             QString::fromUtf8(PACKAGE##_AUTHORS))); \
00101     } \
00102   }; \
00103   package##InfoInit autoInit##package;
00104 
00105 } // namespace QGpCoreTools
00106 
00107 #endif // PACKAGEINFO_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines