libyui  3.0.10
/usr/src/RPM/BUILD/libyui-3.0.10/src/YWidgetID.cc
00001 /*
00002   Copyright (C) 2000-2012 Novell, Inc
00003   This library is free software; you can redistribute it and/or modify
00004   it under the terms of the GNU Lesser General Public License as
00005   published by the Free Software Foundation; either version 2.1 of the
00006   License, or (at your option) version 3.0 of the License. This library
00007   is distributed in the hope that it will be useful, but WITHOUT ANY
00008   WARRANTY; without even the implied warranty of MERCHANTABILITY or 
00009   FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00010   License for more details. You should have received a copy of the GNU
00011   Lesser General Public License along with this library; if not, write
00012   to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
00013   Floor, Boston, MA 02110-1301 USA
00014 */
00015 
00016 
00017 /*-/
00018 
00019   File:         YWidgetID.cc
00020 
00021   Author:       Stefan Hundhammer <sh@suse.de>
00022 
00023 /-*/
00024 
00025 
00026 #include <iostream>
00027 #include "YWidgetID.h"
00028 
00029 
00030 
00031 YStringWidgetID::YStringWidgetID( const std::string & val )
00032     : _value( val )
00033 {
00034     // NOP
00035 }
00036 
00037 
00038 YStringWidgetID::~YStringWidgetID()
00039 {
00040     // NOP
00041 }
00042 
00043 
00044 bool
00045 YStringWidgetID::isEqual( YWidgetID * otherID ) const
00046 {
00047     YStringWidgetID * otherStringID =
00048         dynamic_cast<YStringWidgetID *> (otherID);
00049 
00050     if ( otherStringID )
00051         return ( this->valueConstRef() == otherStringID->valueConstRef() );
00052     else
00053         return false;
00054 }
00055 
00056 
00057 std::string
00058 YStringWidgetID::toString() const
00059 {
00060     return _value;
00061 }
00062 
00063 
00064 std::string
00065 YStringWidgetID::value() const
00066 {
00067     return _value;
00068 }
00069 
00070 
00071 const std::string &
00072 YStringWidgetID::valueConstRef() const
00073 {
00074     return _value;
00075 }
00076 
00077 
00078 std::ostream & operator<<( std::ostream & stream, const YWidgetID * id )
00079 {
00080     if ( id )
00081         stream << id->toString();
00082     else
00083         stream << "<NULL YWidgetID>";
00084 
00085     return stream;
00086 }
 All Classes Functions Variables Enumerations Friends