Vidalia 0.2.10
|
00001 /* 00002 ** This file is part of Vidalia, and is subject to the license terms in the 00003 ** LICENSE file, found in the top level directory of this distribution. If you 00004 ** did not receive the LICENSE file with this file, you may obtain it from the 00005 ** Vidalia source package distributed by the Vidalia Project at 00006 ** http://www.vidalia-project.net/. No part of Vidalia, including this file, 00007 ** may be copied, modified, propagated, or distributed except according to the 00008 ** terms described in the LICENSE file. 00009 */ 00010 00011 /* 00012 ** \file PackageInfo.h 00013 ** \version $Id: PackageInfo.h 3735 2009-04-28 20:28:01Z edmanm $ 00014 ** \brief Contains information about a single available updated software 00015 ** package. 00016 */ 00017 00018 #ifndef _PACKAGEINFO_H 00019 #define _PACKAGEINFO_H 00020 00021 #include <QHash> 00022 #include <QList> 00023 #include <QString> 00024 00025 00026 class PackageInfo 00027 { 00028 public: 00029 /** Default constructor. */ 00030 PackageInfo(); 00031 00032 /** Returns true if this PackageInfo object is valid. A valid PackageInfo 00033 * object must have a name and a version number set. All other fields are 00034 * optional. 00035 */ 00036 bool isValid() const; 00037 00038 /** Sets the name of this software package to <b>name</b>. 00039 */ 00040 void setName(const QString &name); 00041 00042 /** Returns the name of this software package. 00043 */ 00044 QString name() const; 00045 00046 /** Sets the version of this software package to <b>version</b>. 00047 */ 00048 void setVersion(const QString &version); 00049 00050 /** Returns the version of this software package. 00051 */ 00052 QString version() const; 00053 00054 /** Sets the long description of this software package to <b>desc</b> for 00055 * the language <b>lang</b>. 00056 */ 00057 void setLongDescription(const QString &lang, const QString &desc); 00058 00059 /** Returns true if there is a long description for this software package 00060 * currently set for language <b>lang</b>. 00061 */ 00062 bool hasLongDescription(const QString &lang) const; 00063 00064 /** Returns long description of this software package for language 00065 * <b>lang</b>. If a description is not currently set for the specified 00066 * language, a null QString object is returned. 00067 */ 00068 QString longDescription(const QString &lang) const; 00069 00070 /** Sets the short description of this software package to <b>desc</b> for 00071 * the language <b>lang</b>. 00072 */ 00073 void setShortDescription(const QString &lang, const QString &desc); 00074 00075 /** Returns true if there is a short description of this software package 00076 * currently set for language <b>lang</b>. 00077 */ 00078 bool hasShortDescription(const QString &lang) const; 00079 00080 /** Returns the short description of this software package for language 00081 * <b>lang</b>. If a description is not currently set for the specified 00082 * language, a null QString object is returned. 00083 */ 00084 QString shortDescription(const QString &lang) const; 00085 00086 private: 00087 QString _name; 00088 QString _version; 00089 QHash<QString,QString> _longDescription; 00090 QHash<QString,QString> _shortDescription; 00091 }; 00092 00093 /** An unordered collection of PackageInfo objects. */ 00094 typedef QList<PackageInfo> PackageList; 00095 00096 #endif 00097