home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kabc / secrecy.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.3 KB  |  101 lines

  1. /*
  2.     This file is part of libkabc.
  3.     Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.     Boston, MA 02110-1301, USA.
  19. */
  20.  
  21. #ifndef KABC_SECRECY_H
  22. #define KABC_SECRECY_H
  23.  
  24. #include <qvaluelist.h>
  25.  
  26. #include <kdelibs_export.h>
  27.  
  28. namespace KABC {
  29.  
  30. class KABC_EXPORT Secrecy
  31. {
  32.     friend KABC_EXPORT QDataStream &operator<<( QDataStream &, const Secrecy & );
  33.     friend KABC_EXPORT QDataStream &operator>>( QDataStream &, Secrecy & );
  34.  
  35. public:
  36.   typedef QValueList<int> TypeList;  
  37.  
  38.   /**
  39.    * Secrecy types
  40.    *
  41.    * @li Public       - for public access
  42.    * @li Private      - only private access
  43.    * @li Confidential - access for confidential persons
  44.    */
  45.   enum Types {
  46.     Public,
  47.     Private,
  48.     Confidential,
  49.     Invalid
  50.   };
  51.  
  52.   /**
  53.    * Constructor.
  54.    *
  55.    * @param type  The secrecy type, see Types.
  56.    */
  57.   Secrecy( int type = Invalid );
  58.  
  59.   bool operator==( const Secrecy & ) const;
  60.   bool operator!=( const Secrecy & ) const;
  61.  
  62.   /**
  63.     Returns if the Secrecy object has a valid value.
  64.   */
  65.   bool isValid() const;
  66.  
  67.   /**
  68.    * Sets the type, see Types.
  69.    */
  70.   void setType( int type );
  71.  
  72.   /**
  73.    * Returns the type, see Types.
  74.    */
  75.   int type() const;
  76.  
  77.   /**
  78.    * Returns a list of all available secrecy types.
  79.    */
  80.   static TypeList typeList();
  81.   
  82.   /**
  83.    * Returns a translated label for a given secrecy type.
  84.    */
  85.   static QString typeLabel( int type );
  86.  
  87.   /**
  88.    * For debug.
  89.    */
  90.   QString asString() const;
  91.  
  92. private:
  93.   int mType;
  94. };
  95.  
  96. KABC_EXPORT QDataStream& operator<<( QDataStream &s, const Secrecy &secrecy );
  97. KABC_EXPORT QDataStream& operator>>( QDataStream &s, Secrecy &secrecy );
  98.  
  99. }
  100. #endif
  101.