3
Copyright (C) 2000 CoreLinux Consortium
5
The CoreLinux++ Library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public License as
7
published by the Free Software Foundation; either version 2 of the
8
License, or (at your option) any later version.
10
The CoreLinux++ Library Library is distributed in the hope that it will
11
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
15
You should have received a copy of the GNU Library General Public
16
License along with the GNU C Library; see the file COPYING.LIB. If not,
17
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
Boston, MA 02111-1307, USA.
22
#if !defined(__COMMON_HPP)
23
#include <corelinux/Common.hpp>
26
#if !defined(__UPPERCASECOMMAND_HPP)
27
#include <UpperCaseCommand.hpp>
30
#if !defined(__RESTORECASECOMMAND_HPP)
31
#include <RestoreCaseCommand.hpp>
34
using namespace corelinux;
36
// Default constructor
38
UpperCaseCommand::UpperCaseCommand( void )
42
theOriginalValue( NULLPTR ),
43
theNewValue( NULLPTR )
50
UpperCaseCommand::UpperCaseCommand( const std::string & aValue )
53
theOriginalValue( new std::string(aValue) ),
54
theNewValue( new std::string("") )
61
UpperCaseCommand::UpperCaseCommand( UpperCaseCommandCref aUpCaseCmd )
63
Command( aUpCaseCmd ),
64
theOriginalValue( new std::string(aUpCaseCmd.getOriginalValue()) ),
65
theNewValue( new std::string("") )
72
UpperCaseCommand::~UpperCaseCommand( void )
74
if( theOriginalValue != NULLPTR )
76
delete theOriginalValue;
77
theOriginalValue = NULLPTR;
84
if( theNewValue != NULLPTR )
87
theNewValue = NULLPTR;
95
// Assignment operator
97
UpperCaseCommandRef UpperCaseCommand::operator=
99
UpperCaseCommandCref aUpCaseCmd
102
if( *this == aUpCaseCmd )
104
; // do nothing, its us
108
*theOriginalValue = aUpCaseCmd.getOriginalValue() ;
117
bool UpperCaseCommand::operator==( UpperCaseCommandCref aUpCaseCmd ) const
119
return ( this == &aUpCaseCmd );
122
// Access for original
124
const std::string & UpperCaseCommand::getOriginalValue( void ) const
126
return *theOriginalValue;
129
// Access for results
131
const std::string & UpperCaseCommand::getNewValue( void ) const
136
void UpperCaseCommand::setReverseCommand( AbstractCommandPtr aCmdPtr )
138
if( dynamic_cast<RestoreCaseCommandPtr>(aCmdPtr) != NULLPTR )
140
dynamic_cast<RestoreCaseCommandPtr>(aCmdPtr)->setValues
151
Command::setReverseCommand( aCmdPtr );
156
void UpperCaseCommand::execute( void )
158
size_t len = theOriginalValue->length();
163
for( size_t x = 0; x < len; ++x )
165
*theNewValue += toupper((*theOriginalValue)[x]);
175
Common rcs information do not modify
178
$Date: 2000/05/04 05:41:59 $