Vidalia 0.3.1
PackageInfo.h
Go to the documentation of this file.
1/*
2** This file is part of Vidalia, and is subject to the license terms in the
3** LICENSE file, found in the top level directory of this distribution. If you
4** did not receive the LICENSE file with this file, you may obtain it from the
5** Vidalia source package distributed by the Vidalia Project at
6** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7** including this file, may be copied, modified, propagated, or distributed
8** except according to the terms described in the LICENSE file.
9*/
10
11/*
12** \file PackageInfo.h
13** \brief Contains information about a single available updated software
14** package.
15*/
16
17#ifndef _PACKAGEINFO_H
18#define _PACKAGEINFO_H
19
20#include <QHash>
21#include <QList>
22#include <QString>
23
24
26{
27public:
28 /** Default constructor. */
30
31 /** Returns true if this PackageInfo object is valid. A valid PackageInfo
32 * object must have a name and a version number set. All other fields are
33 * optional.
34 */
35 bool isValid() const;
36
37 /** Sets the name of this software package to <b>name</b>.
38 */
39 void setName(const QString &name);
40
41 /** Returns the name of this software package.
42 */
43 QString name() const;
44
45 /** Sets the version of this software package to <b>version</b>.
46 */
47 void setVersion(const QString &version);
48
49 /** Returns the version of this software package.
50 */
51 QString version() const;
52
53 /** Sets the long description of this software package to <b>desc</b> for
54 * the language <b>lang</b>.
55 */
56 void setLongDescription(const QString &lang, const QString &desc);
57
58 /** Returns true if there is a long description for this software package
59 * currently set for language <b>lang</b>.
60 */
61 bool hasLongDescription(const QString &lang) const;
62
63 /** Returns long description of this software package for language
64 * <b>lang</b>. If a description is not currently set for the specified
65 * language, a null QString object is returned.
66 */
67 QString longDescription(const QString &lang) const;
68
69 /** Sets the short description of this software package to <b>desc</b> for
70 * the language <b>lang</b>.
71 */
72 void setShortDescription(const QString &lang, const QString &desc);
73
74 /** Returns true if there is a short description of this software package
75 * currently set for language <b>lang</b>.
76 */
77 bool hasShortDescription(const QString &lang) const;
78
79 /** Returns the short description of this software package for language
80 * <b>lang</b>. If a description is not currently set for the specified
81 * language, a null QString object is returned.
82 */
83 QString shortDescription(const QString &lang) const;
84
85private:
86 QString _name;
87 QString _version;
88 QHash<QString,QString> _longDescription;
89 QHash<QString,QString> _shortDescription;
90};
91
92/** An unordered collection of PackageInfo objects. */
93typedef QList<PackageInfo> PackageList;
94
95#endif
96
QList< PackageInfo > PackageList
Definition: PackageInfo.h:93
void setShortDescription(const QString &lang, const QString &desc)
Definition: PackageInfo.cpp:73
QString longDescription(const QString &lang) const
Definition: PackageInfo.cpp:61
void setName(const QString &name)
Definition: PackageInfo.cpp:31
void setLongDescription(const QString &lang, const QString &desc)
Definition: PackageInfo.cpp:55
QString name() const
Definition: PackageInfo.cpp:37
QString _version
Definition: PackageInfo.h:87
void setVersion(const QString &version)
Definition: PackageInfo.cpp:43
bool hasLongDescription(const QString &lang) const
Definition: PackageInfo.cpp:67
QString shortDescription(const QString &lang) const
Definition: PackageInfo.cpp:80
bool hasShortDescription(const QString &lang) const
Definition: PackageInfo.cpp:87
QString _name
Definition: PackageInfo.h:86
QHash< QString, QString > _longDescription
Definition: PackageInfo.h:88
QHash< QString, QString > _shortDescription
Definition: PackageInfo.h:89
bool isValid() const
Definition: PackageInfo.cpp:25
QString version() const
Definition: PackageInfo.cpp:49