00001 /* 00002 * Copyright (C) 2003-2009 Olivier Boudeville 00003 * 00004 * This file is part of the Ceylan library. 00005 * 00006 * The Ceylan library is free software: you can redistribute it and/or modify 00007 * it under the terms of either the GNU Lesser General Public License or 00008 * the GNU General Public License, as they are published by the Free Software 00009 * Foundation, either version 3 of these Licenses, or (at your option) 00010 * any later version. 00011 * 00012 * The Ceylan library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License and the GNU General Public License 00016 * for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License and the GNU General Public License along with the Ceylan library. 00020 * If not, see <http://www.gnu.org/licenses/>. 00021 * 00022 * Author: Olivier Boudeville (olivier.boudeville@esperide.com) 00023 * 00024 */ 00025 00026 00027 #ifndef CEYLAN_IDENTIFIER_OWNER_H_ 00028 #define CEYLAN_IDENTIFIER_OWNER_H_ 00029 00030 00031 #include "CeylanException.h" // for Ceylan::Exception 00032 #include "CeylanTextDisplayable.h" // for inheritance 00033 00034 #include <string> 00035 00036 00037 00038 namespace Ceylan 00039 { 00040 00041 00042 00043 // An IdentifierOwner owns an Identifier. 00044 class Identifier ; 00045 00046 00048 class CEYLAN_DLL IdentifierNotAvailableException: public Ceylan::Exception 00049 { 00050 00051 public: 00052 00053 explicit IdentifierNotAvailableException( 00054 const std::string & reason ) ; 00055 00056 virtual ~IdentifierNotAvailableException() throw() ; 00057 00058 } ; 00059 00060 00061 00077 class CEYLAN_DLL IdentifierOwner : public TextDisplayable 00078 { 00079 00080 00081 public: 00082 00083 00084 00089 IdentifierOwner() ; 00090 00091 00097 explicit IdentifierOwner( const Identifier & id ) ; 00098 00099 00100 00106 virtual ~IdentifierOwner() throw() ; 00107 00108 00109 00116 Identifier & getIdentifier() const ; 00117 00118 00119 00129 void setIdentifier( Identifier & id ) ; 00130 00131 00132 00134 bool hasIdentifier() const ; 00135 00136 00137 00139 void deleteIdentifier() ; 00140 00141 00142 00155 virtual const std::string toString( 00156 Ceylan::VerbosityLevels level = Ceylan::high ) const ; 00157 00158 00159 00160 private: 00161 00162 00163 00165 Identifier * _id ; 00166 00167 00176 IdentifierOwner( const IdentifierOwner & source ) ; 00177 00178 00179 00188 IdentifierOwner & operator = ( const IdentifierOwner & source ) ; 00189 00190 00191 00192 } ; 00193 00194 } 00195 00196 00197 00198 #endif // CEYLAN_IDENTIFIER_OWNER_H_ 00199