[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r3362: Add a PackageInfo class that can be used to represent inform (vidalia/branches/auto-updates/src/vidalia)



Author: edmanm
Date: 2008-12-06 19:16:11 -0500 (Sat, 06 Dec 2008)
New Revision: 3362

Added:
   vidalia/branches/auto-updates/src/vidalia/packageinfo.cpp
   vidalia/branches/auto-updates/src/vidalia/packageinfo.h
Log:
Add a PackageInfo class that can be used to represent information
about an available software update.


Added: vidalia/branches/auto-updates/src/vidalia/packageinfo.cpp
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/packageinfo.cpp	                        (rev 0)
+++ vidalia/branches/auto-updates/src/vidalia/packageinfo.cpp	2008-12-07 00:16:11 UTC (rev 3362)
@@ -0,0 +1,92 @@
+/*
+**  This file is part of Vidalia, and is subject to the license terms in the
+**  LICENSE file, found in the top level directory of this distribution. If you
+**  did not receive the LICENSE file with this file, you may obtain it from the
+**  Vidalia source package distributed by the Vidalia Project at
+**  http://www.vidalia-project.net/. No part of Vidalia, including this file,
+**  may be copied, modified, propagated, or distributed except according to the
+**  terms described in the LICENSE file.
+*/
+
+/*
+** \file packageinfo.cpp
+** \version $Id$
+** \brief Contains information about a single available updated software
+** package.
+*/
+
+#include "packageinfo.h"
+
+
+PackageInfo::PackageInfo()
+{
+}
+
+bool
+PackageInfo::isValid() const
+{
+  return (! _name.isEmpty() && ! _version.isEmpty());
+}
+
+void
+PackageInfo::setName(const QString &name)
+{
+  _name = name;
+}
+
+QString
+PackageInfo::name() const
+{
+  return _name;
+}
+
+void
+PackageInfo::setVersion(const QString &version)
+{
+  _version = version;
+}
+
+QString
+PackageInfo::version() const
+{
+  return _version;
+}
+
+void
+PackageInfo::setLongDescription(const QString &lang, const QString &desc)
+{
+  _longDescription.insert(lang, desc);
+}
+
+QString
+PackageInfo::longDescription(const QString &lang) const
+{
+  return _longDescription.value(lang);
+}
+
+bool
+PackageInfo::hasLongDescription(const QString &lang) const
+{
+  return _longDescription.contains(lang);
+}
+
+void
+PackageInfo::setShortDescription(const QString &lang, const QString &desc)
+{
+  _shortDescription.insert(lang, desc);
+}
+
+
+QString
+PackageInfo::shortDescription(const QString &lang) const
+{
+  return _shortDescription.value(lang);
+}
+
+
+bool
+PackageInfo::hasShortDescription(const QString &lang) const
+{
+  return _shortDescription.contains(lang);
+}
+


Property changes on: vidalia/branches/auto-updates/src/vidalia/packageinfo.cpp
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: vidalia/branches/auto-updates/src/vidalia/packageinfo.h
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/packageinfo.h	                        (rev 0)
+++ vidalia/branches/auto-updates/src/vidalia/packageinfo.h	2008-12-07 00:16:11 UTC (rev 3362)
@@ -0,0 +1,97 @@
+/*
+**  This file is part of Vidalia, and is subject to the license terms in the
+**  LICENSE file, found in the top level directory of this distribution. If you
+**  did not receive the LICENSE file with this file, you may obtain it from the
+**  Vidalia source package distributed by the Vidalia Project at
+**  http://www.vidalia-project.net/. No part of Vidalia, including this file,
+**  may be copied, modified, propagated, or distributed except according to the
+**  terms described in the LICENSE file.
+*/
+
+/*
+** \file packageinfo.h
+** \version $Id$
+** \brief Contains information about a single available updated software
+** package.
+*/
+
+#ifndef _PACKAGEINFO_H
+#define _PACKAGEINFO_H
+
+#include <QHash>
+#include <QList>
+#include <QString>
+
+
+class PackageInfo
+{
+public:
+  /** Default constructor. */
+  PackageInfo();
+
+  /** Returns true if this PackageInfo object is valid. A valid PackageInfo
+   * object must have a name and a version number set. All other fields are
+   * optional.
+   */
+  bool isValid() const;
+
+  /** Sets the name of this software package to <b>name</b>.
+   */
+  void setName(const QString &name);
+
+  /** Returns the name of this software package.
+   */
+  QString name() const;
+
+  /** Sets the version of this software package to <b>version</b>.
+   */
+  void setVersion(const QString &version);
+
+  /** Returns the version of this software package.
+   */
+  QString version() const;
+
+  /** Sets the long description of this software package to <b>desc</b> for
+   * the language <b>lang</b>.
+   */
+  void setLongDescription(const QString &lang, const QString &desc);
+
+  /** Returns true if there is a long description for this software package
+   * currently set for language <b>lang</b>.
+   */
+  bool hasLongDescription(const QString &lang) const;
+
+  /** Returns long description of this software package for language
+   * <b>lang</b>. If a description is not currently set for the specified
+   * language, a null QString object is returned.
+   */
+  QString longDescription(const QString &lang) const;
+
+  /** Sets the short description of this software package to <b>desc</b> for
+   * the language <b>lang</b>.
+   */
+  void setShortDescription(const QString &lang, const QString &desc);
+  
+  /** Returns true if there is a short description of this software package
+   * currently set for language <b>lang</b>.
+   */
+  bool hasShortDescription(const QString &lang) const;
+
+  /** Returns the short description of this software package for language
+   * <b>lang</b>. If a description is not currently set for the specified
+   * language, a null QString object is returned.
+   */
+  QString shortDescription(const QString &lang) const;
+
+private:
+  QString _name;
+  QString _version;
+  QHash<QString,QString> _longDescription;
+  QHash<QString,QString> _shortDescription;
+};
+
+/** An unordered collection of PackageInfo objects. */
+typedef QList<PackageInfo> PackageList;
+
+#endif
+


Property changes on: vidalia/branches/auto-updates/src/vidalia/packageinfo.h
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native