00001 #include "type.h"
00002
00003 #include <tools/invaliddataexception.h>
00004
00005 namespace domain
00006 {
00007
00008 struct TypePrivate
00009 {
00010 QString id;
00011 QString name;
00012 };
00013
00014 Type::Type(const QString& id, const QString& name) : d(new TypePrivate())
00015 {
00016 if (id == "")
00017 throw tools::InvalidDataException("The id of a type cannot be empty");
00018 if (name == "")
00019 throw tools::InvalidDataException("The name of a type cannot be empty");
00020
00021 d->id = id;
00022 d->name = name;
00023 }
00024
00025 Type::~Type()
00026 {
00027 delete d;
00028 }
00029
00030 const QString& Type::id() const
00031 {
00032 return d->id;
00033 }
00034
00035 const QString& Type::name() const
00036 {
00037 return d->name;
00038 }
00039
00040 }