oopapidocs  2.0
preference.cpp
00001 #include "preference.h"
00002 #include <qmap.h>
00003 
00004 /*  This is an instantiation of an ooEnum class.
00005   We implement the bidirectional int-string mapping through
00006   the use of static variables. */
00007 
00010 static const QString NAMESSTR = "Undefined=0,Bad Taste=1,Poor=2,Lousy=3,Fair=4,None=5,Good=6,Better=7,Very Good=8,Perfect=9,Excellent=10";
00011 static const QStringList NAMELIST(NAMESSTR.split(","));
00012 
00013 static NameMap s_nameMap;
00014 static bool initialized = false;
00015 
00016 const NameMap& Preference::nameMap() const {
00017     return Enum::initMap(s_nameMap, NAMELIST, initialized);
00018 }
00019 
00020 /* Normally it is not ok to call a virtual function from a
00021     ctor, but we are calling this one non-virtually -
00022     the compiler can resolve the call */
00023 
00024 Preference::Preference(QString prefstr) {
00025     fromString(prefstr);
00026 }
00027 
00028 
00029 Preference::Preference(int value) : Enum(value) {    
00030 }
00031 
00032 
 All Classes Namespaces Functions Enumerations