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