Importance.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* Importance.h
00003  *
00004  * Copyright (C) 2000-2002 Ximian, Inc.
00005  * Copyright (C) 2005 SUSE Linux Products GmbH
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License,
00009  * version 2, as published by the Free Software Foundation.
00010  *
00011  * This program is distributed in the hope that it will be useful, but
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019  * 02111-1307, USA.
00020  */
00021 
00022 #ifndef ZYPP_SOLVER_DETAIL_IMPORTANCE_H
00023 #define ZYPP_SOLVER_DETAIL_IMPORTANCE_H
00024 
00025 #include <iosfwd>
00026 #include <string>
00027 
00029 namespace zypp
00030 { 
00031 
00032   namespace solver
00033   { 
00034 
00035     namespace detail
00036     { 
00037 
00039 //
00040 //      CLASS NAME : Importance
00044 class Importance {
00045 
00046   private:
00047 
00048     typedef enum {
00049         IMPORTANCE_INVALID = -1,
00050 
00051         IMPORTANCE_NECESSARY,
00052         IMPORTANCE_URGENT,
00053         IMPORTANCE_SUGGESTED,
00054         IMPORTANCE_FEATURE,
00055         IMPORTANCE_MINOR,
00056         IMPORTANCE_UNDEFINED,
00057 
00058         // Not a real importance
00059         IMPORTANCE_LAST
00060     } importance_t;
00061 
00062     importance_t _importance;
00063 
00064   private:
00065     importance_t importance () const { return _importance; }
00066     Importance(importance_t importance);
00067 
00068   public:
00069     static const Importance parse (const std::string & str);
00070     virtual ~Importance();
00071 
00072     static const Importance Undefined;
00073     static const Importance Invalid;
00074     static const Importance Necessary;
00075     static const Importance Urgent;
00076     static const Importance Suggested;
00077     static const Importance Feature;
00078     static const Importance Minor;
00079 
00080     // ---------------------------------- I/O
00081 
00082     static std::string toString ( const Importance & importance);
00083 
00084     virtual std::ostream & dumpOn( std::ostream & str ) const;
00085 
00086     friend std::ostream& operator<<( std::ostream&, const Importance & importance);
00087 
00088     std::string asString ( void ) const;
00089 
00090     // ---------------------------------- accessors
00091 
00092     // equality
00093     bool operator==( const Importance & importance) const {
00094         return _importance == importance.importance();
00095     }
00096 
00097     // inequality
00098     bool operator!=( const Importance & importance) const {
00099         return !(*this == importance);
00100     }
00101 
00102 };
00103 
00105     };// namespace detail
00108   };// namespace solver
00111 };// namespace zypp
00113 
00114 #endif // ZYPP_SOLVER_DETAIL_IMPORTANCE_H

Generated on Thu Jul 6 00:07:22 2006 for zypp by  doxygen 1.4.6