libyui
3.10.0
YWidgetID.cc
1
/*
2
Copyright (C) 2000-2012 Novell, Inc
3
This library is free software; you can redistribute it and/or modify
4
it under the terms of the GNU Lesser General Public License as
5
published by the Free Software Foundation; either version 2.1 of the
6
License, or (at your option) version 3.0 of the License. This library
7
is distributed in the hope that it will be useful, but WITHOUT ANY
8
WARRANTY; without even the implied warranty of MERCHANTABILITY or
9
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10
License for more details. You should have received a copy of the GNU
11
Lesser General Public License along with this library; if not, write
12
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13
Floor, Boston, MA 02110-1301 USA
14
*/
15
16
17
/*-/
18
19
File: YWidgetID.cc
20
21
Author: Stefan Hundhammer <sh@suse.de>
22
23
/-*/
24
25
26
#include <iostream>
27
#include "YWidgetID.h"
28
29
using
std::string;
30
31
32
YStringWidgetID::YStringWidgetID
(
const
string
& val )
33
: _value( val )
34
{
35
// NOP
36
}
37
38
39
YStringWidgetID::~YStringWidgetID
()
40
{
41
// NOP
42
}
43
44
45
bool
46
YStringWidgetID::isEqual
(
YWidgetID
* otherID )
const
47
{
48
YStringWidgetID
* otherStringID =
49
dynamic_cast<
YStringWidgetID
*
>
(otherID);
50
51
if
( otherStringID )
52
return
( this->
valueConstRef
() == otherStringID->
valueConstRef
() );
53
else
54
return
false
;
55
}
56
57
58
string
59
YStringWidgetID::toString
()
const
60
{
61
return
_value;
62
}
63
64
65
string
66
YStringWidgetID::value
()
const
67
{
68
return
_value;
69
}
70
71
72
const
string
&
73
YStringWidgetID::valueConstRef
()
const
74
{
75
return
_value;
76
}
77
78
79
std::ostream & operator<<( std::ostream & stream,
const
YWidgetID
*
id
)
80
{
81
if
(
id
)
82
stream <<
id
->toString();
83
else
84
stream <<
"<NULL YWidgetID>"
;
85
86
return
stream;
87
}
YStringWidgetID::isEqual
virtual bool isEqual(YWidgetID *otherID) const
Check if this ID is equal to another.
Definition:
YWidgetID.cc:46
YStringWidgetID::toString
virtual std::string toString() const
Convert the ID value to string.
Definition:
YWidgetID.cc:59
YStringWidgetID::YStringWidgetID
YStringWidgetID(const std::string &value)
Constructor.
Definition:
YWidgetID.cc:32
YStringWidgetID::valueConstRef
const std::string & valueConstRef() const
Return the ID value as a const ref.
Definition:
YWidgetID.cc:73
YStringWidgetID::value
std::string value() const
Return the ID value.
Definition:
YWidgetID.cc:66
YWidgetID
Abstract base class for widget IDs.
Definition:
YWidgetID.h:37
YStringWidgetID
Simple widget ID class based on strings.
Definition:
YWidgetID.h:73
YStringWidgetID::~YStringWidgetID
virtual ~YStringWidgetID()
Destructor.
Definition:
YWidgetID.cc:39
src
YWidgetID.cc
Generated by
1.8.18