User Manual, Developers Guide and API Documentation

Version.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 16, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #ifndef WNS_MODULE_VERSION_HPP
00029 #define WNS_MODULE_VERSION_HPP
00030 
00031 #include <WNS/module/DateTime.hpp>
00032 #include <WNS/module/Release.hpp>
00033 
00034 namespace wns { namespace module {
00039     class Version
00040     {
00041     public:
00056         Version(const Release bRelease, const DateTime bTime = DateTime(),
00057             const std::string bUser = "", const std::string bHost = "",
00058             const std::string bFlags = "", const DateTime mTime = DateTime(),
00059             const std::string mFile = "");
00060 
00071         Version(const std::string s);
00072 
00081         bool operator==(const Version b) const;
00085         bool operator!=(const Version b) const;
00089         bool operator<(const Version b) const;
00093         bool operator>(const Version b) const;
00097         bool operator<=(const Version b) const;
00101         bool operator>=(const Version b) const;
00102 
00106         DateTime getBuildTime() const;
00110         std::string getBuildUser() const;
00114         std::string getBuildHost() const;
00118         Release getBuildRelease() const;
00122         std::string getBuildFlags() const;
00126         DateTime getModificationTime() const;
00130         std::string getModifiedFile() const;
00131 
00135         void setBuildTime(const DateTime bTime);
00139         void setBuildUser(const std::string bUser);
00143         void setBuildHost(const std::string bHost);
00147         void setBuildRelease(const Release bRelease);
00151         void setBuildFlags(const std::string bFlags);
00155         void setModificationTime(const DateTime mTime);
00159         void setModifiedFile(const std::string mFile);
00160 
00174         std::string getString() const;
00175 
00181         std::string getNiceString(bool verbose, std::string offset) const;
00182 
00183     private:
00184         DateTime buildTime;
00185         std::string buildUser;
00186         std::string buildHost;
00187         std::string buildFlags;
00188         Release buildRelease;
00189         DateTime modificationTime;
00190         std::string modifiedFile;
00191 
00192         static bool stringEqualOrEmpty(const std::string s1, const std::string s2) { return ((s1=="") || (s2=="") || (s1==s2)); }
00193         static std::string cutAt(const std::string s, const std::string pattern, const int n);
00194 
00202         class Syntax {
00203         public:
00204             static std::string extractRelease(const std::string s);
00205             static std::string extractTime(const std::string s);
00206             static std::string extractUser(const std::string s);
00207             static std::string extractHost(const std::string s);
00208             static std::string extractModificationTime(const std::string s);
00209             static std::string extractModifiedFile(const std::string s);
00210             static std::string extractFlags(const std::string s);
00211         };
00212     };
00213 
00214 } // module
00215 } // wns
00216 
00217 #endif // NOT defined WNS_MODULE_VERSION_HPP

Generated on Sat May 26 03:31:45 2012 for openWNS by  doxygen 1.5.5