libyui
3.3.2
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
30
31
YStringWidgetID::YStringWidgetID
(
const
std::string & val )
32
: _value( val )
33
{
34
// NOP
35
}
36
37
38
YStringWidgetID::~YStringWidgetID
()
39
{
40
// NOP
41
}
42
43
44
bool
45
YStringWidgetID::isEqual
(
YWidgetID
* otherID )
const
46
{
47
YStringWidgetID
* otherStringID =
48
dynamic_cast<
YStringWidgetID
*
>
(otherID);
49
50
if
( otherStringID )
51
return
( this->
valueConstRef
() == otherStringID->
valueConstRef
() );
52
else
53
return
false
;
54
}
55
56
57
std::string
58
YStringWidgetID::toString
()
const
59
{
60
return
_value;
61
}
62
63
64
std::string
65
YStringWidgetID::value
()
const
66
{
67
return
_value;
68
}
69
70
71
const
std::string &
72
YStringWidgetID::valueConstRef
()
const
73
{
74
return
_value;
75
}
76
77
78
std::ostream & operator<<( std::ostream & stream,
const
YWidgetID
*
id
)
79
{
80
if
(
id
)
81
stream <<
id
->toString();
82
else
83
stream <<
"<NULL YWidgetID>"
;
84
85
return
stream;
86
}
YStringWidgetID::valueConstRef
const std::string & valueConstRef() const
Return the ID value as a const ref.
Definition:
YWidgetID.cc:72
YStringWidgetID::~YStringWidgetID
virtual ~YStringWidgetID()
Destructor.
Definition:
YWidgetID.cc:38
YStringWidgetID::value
std::string value() const
Return the ID value.
Definition:
YWidgetID.cc:65
YStringWidgetID
Simple widget ID class based on strings.
Definition:
YWidgetID.h:72
YStringWidgetID::YStringWidgetID
YStringWidgetID(const std::string &value)
Constructor.
Definition:
YWidgetID.cc:31
YStringWidgetID::toString
virtual std::string toString() const
Convert the ID value to string.
Definition:
YWidgetID.cc:58
YWidgetID
Abstract base class for widget IDs.
Definition:
YWidgetID.h:36
YStringWidgetID::isEqual
virtual bool isEqual(YWidgetID *otherID) const
Check if this ID is equal to another.
Definition:
YWidgetID.cc:45
src
YWidgetID.cc
Generated by
1.8.13