LCOV - code coverage report
Current view: top level - lang/qt/src - dn.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 9 0.0 %
Date: 2016-12-01 18:45:36 Functions: 0 5 0.0 %

          Line data    Source code
       1             : /*
       2             :     dn.h
       3             : 
       4             :     This file is part of qgpgme, the Qt API binding for gpgme
       5             :     Copyright (c) 2004 Klarälvdalens Datakonsult AB
       6             :     Copyright (c) 2016 Intevation GmbH
       7             : 
       8             :     QGpgME is free software; you can redistribute it and/or
       9             :     modify it under the terms of the GNU General Public License as
      10             :     published by the Free Software Foundation; either version 2 of the
      11             :     License, or (at your option) any later version.
      12             : 
      13             :     QGpgME is distributed in the hope that it will be useful,
      14             :     but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16             :     General Public License for more details.
      17             : 
      18             :     You should have received a copy of the GNU General Public License
      19             :     along with this program; if not, write to the Free Software
      20             :     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
      21             : 
      22             :     In addition, as a special exception, the copyright holders give
      23             :     permission to link the code of this program with any edition of
      24             :     the Qt library by Trolltech AS, Norway (or with modified versions
      25             :     of Qt that use the same license as Qt), and distribute linked
      26             :     combinations including the two.  You must obey the GNU General
      27             :     Public License in all respects for all of the code used other than
      28             :     Qt.  If you modify this file, you may extend this exception to
      29             :     your version of the file, but you are not obligated to do so.  If
      30             :     you do not wish to do so, delete this exception statement from
      31             :     your version.
      32             : */
      33             : #ifndef QGPGME_DN_H
      34             : #define QGPGME_DN_H
      35             : 
      36             : #include "qgpgme_export.h"
      37             : 
      38             : #include <QString>
      39             : #include <QStringList>
      40             : 
      41             : #include <QVector>
      42             : 
      43             : namespace QGpgME
      44             : {
      45             : 
      46             : /**
      47             :    @short DN parser and reorderer
      48             : */
      49             : class QGPGME_EXPORT DN
      50             : {
      51             : public:
      52             :     class Attribute;
      53             :     typedef QVector<Attribute> AttributeList;
      54             :     typedef AttributeList::const_iterator const_iterator;
      55             : 
      56             :     DN();
      57             :     explicit DN(const QString &dn);
      58             :     explicit DN(const char *utf8DN);
      59             :     DN(const DN &other);
      60             :     ~DN();
      61             : 
      62             :     const DN &operator=(const DN &other);
      63             : 
      64             :     /** @return the value in rfc-2253-escaped form */
      65             :     static QString escape(const QString &value);
      66             : 
      67             :     /** @return the DN in a reordered form, according to the settings in
      68             :         the [DN] group of the application's config file */
      69             :     QString prettyDN() const;
      70             :     /** @return the DN in the original form */
      71             :     QString dn() const;
      72             :     /**
      73             :        \overload
      74             :        Uses \a sep as separator (default: ,)
      75             :     */
      76             :     QString dn(const QString &sep) const;
      77             : 
      78             :     QString operator[](const QString &attr) const;
      79             : 
      80             :     void append(const Attribute &attr);
      81             : 
      82             :     const_iterator begin() const;
      83             :     const_iterator end() const;
      84             : 
      85             :     /** Set the order in which prettyDN will reorder the Attirbutes. */
      86             :     void setAttributeOrder(const QStringList &order) const;
      87             : 
      88             :     /** Get the used attribute order. */
      89             :     const QStringList & attributeOrder() const;
      90             : 
      91             : private:
      92             :     void detach();
      93             : private:
      94             :     class Private;
      95             :     Private *d;
      96             : };
      97             : 
      98           0 : class QGPGME_EXPORT DN::Attribute
      99             : {
     100             : public:
     101             :     typedef DN::AttributeList List;
     102             : 
     103           0 :     explicit Attribute(const QString &name = QString(), const QString &value = QString())
     104           0 :         : mName(name.toUpper()), mValue(value) {}
     105           0 :     Attribute(const Attribute &other)
     106           0 :         : mName(other.name()), mValue(other.value()) {}
     107             : 
     108             :     const Attribute &operator=(const Attribute &other)
     109             :     {
     110             :         if (this != &other) {
     111             :             mName = other.name();
     112             :             mValue = other.value();
     113             :         }
     114             :         return *this;
     115             :     }
     116             : 
     117           0 :     const QString &name() const
     118             :     {
     119           0 :         return mName;
     120             :     }
     121           0 :     const QString &value() const
     122             :     {
     123           0 :         return mValue;
     124             :     }
     125             : 
     126             :     void setValue(const QString &value)
     127             :     {
     128             :         mValue = value;
     129             :     }
     130             : 
     131             : private:
     132             :     QString mName;
     133             :     QString mValue;
     134             : };
     135             : } // namespace QGpgME
     136             : #endif // QGPGME_DN_H

Generated by: LCOV version 1.11