GpCoreTools/PackageInfo.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of GpCoreTools.
00004 **
00005 **  This file may be distributed and/or modified under the terms of the
00006 **  GNU General Public License version 2 or 3 as published by the Free
00007 **  Software Foundation and appearing in the file LICENSE.GPL included
00008 **  in the packaging of this file.
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 General Public License for
00013 **  more details.
00014 **
00015 **  You should have received a copy of the GNU General Public License
00016 **  along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 **
00018 **  See http://www.geopsy.org for more information.
00019 **
00020 **  Created: 2009-07-01
00021 **  Authors:
00022 **    Marc Wathelet
00023 **    Marc Wathelet (LGIT, Grenoble, France)
00024 **
00025 ***************************************************************************/
00026 
00027 #ifndef PACKAGEINFO_H
00028 #define PACKAGEINFO_H
00029 
00030 #include <string>
00031 #include <list>
00032 
00033 #include "GpCoreToolsDLLExport.h"
00034 
00035 namespace GpCoreTools {
00036 
00037 class GPCORETOOLS_EXPORT PackageInfo
00038 {
00039 public:
00040   PackageInfo(const char * package,
00041                       const char * binDir,
00042                       const char * libDir,
00043                       const char * includeDir,
00044                       const char * shareDir,
00045                       const char * version,
00046                       const char * versionTime,
00047                       const char * versionType,
00048                       const char * distribtion,
00049                       const char * authors);
00050   PackageInfo(const PackageInfo& o);
00051 
00052   const std::string & package() const {return _package;}
00053   const std::string & binDir() const {return _binDir;}
00054   const std::string & libDir() const {return _libDir;}
00055   const std::string & includeDir() const {return _includeDir;}
00056   const std::string & shareDir() const {return _shareDir;}
00057 #ifdef Q_WS_WIN
00058   const std::string & dllDir() const {return binDir();}
00059 #else
00060   const std::string & dllDir() const {return libDir();}
00061 #endif
00062   const std::string & version() const {return _version;}
00063   const std::string & versionTime() const {return _versionTime;}
00064   const std::string & versionType() const {return _versionType;}
00065   const std::string & distribution() const {return _distribution;}
00066   const std::string & authors() const {return _authors;}
00067 
00068   static std::string getInstallDir(std::string organization, std::string package, std::string dir, std::string defaultDir);
00069   static const PackageInfo * package(std::string package);
00070   static std::list<PackageInfo> * list();
00071 private:
00072   std::string _package;
00073   std::string _binDir;
00074   std::string _libDir;
00075   std::string _includeDir;
00076   std::string _shareDir;
00077   std::string _version;
00078   std::string _versionTime;
00079   std::string _versionType;
00080   std::string _distribution;
00081   std::string _authors;
00082 
00083   static std::list<PackageInfo> * _list;
00084 };
00085 
00086 #define PACKAGE_INFO(package, PACKAGE) \
00087   class package##InfoInit \
00088   { \
00089   public: \
00090     package##InfoInit() { \
00091       PackageInfo::list()->push_back(PackageInfo( # package, \
00092             PackageInfo::getInstallDir("geopsy", # package, "binDir", PACKAGE##_BINDIR).data(), \
00093             PackageInfo::getInstallDir("geopsy", # package, "libDir", PACKAGE##_LIBDIR).data(), \
00094             PackageInfo::getInstallDir("geopsy", # package, "includeDir", PACKAGE##_INCDIR).data(), \
00095             PackageInfo::getInstallDir("geopsy", # package, "shareDir", PACKAGE##_SHAREDIR).data(), \
00096             PACKAGE##_VERSION, \
00097             PACKAGE##_VERSION_TIME, \
00098             PACKAGE##_VERSION_TYPE, \
00099             PACKAGE##_DISTRIBUTION, \
00100             PACKAGE##_AUTHORS)); \
00101     } \
00102   }; \
00103   package##InfoInit autoInit##package;
00104 
00105 
00106 } // namespace GpCoreTools
00107 
00108 #endif // PACKAGEINFO_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines