1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cow_wrapper_clients.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "cow_wrapper_clients.hxx"
35 class cow_wrapper_client2_impl
38 cow_wrapper_client2_impl() : mnValue(0) {}
39 explicit cow_wrapper_client2_impl( int nVal
) : mnValue(nVal
) {}
40 void setValue( int nVal
) { mnValue
= nVal
; }
41 int getValue() const { return mnValue
; }
43 bool operator==( const cow_wrapper_client2_impl
& rRHS
) const { return mnValue
== rRHS
.mnValue
; }
44 bool operator!=( const cow_wrapper_client2_impl
& rRHS
) const { return mnValue
!= rRHS
.mnValue
; }
45 bool operator<( const cow_wrapper_client2_impl
& rRHS
) const { return mnValue
< rRHS
.mnValue
; }
51 cow_wrapper_client2::cow_wrapper_client2() : maImpl()
55 cow_wrapper_client2::cow_wrapper_client2( int nVal
) :
56 maImpl( cow_wrapper_client2_impl(nVal
) )
60 cow_wrapper_client2::~cow_wrapper_client2()
64 cow_wrapper_client2::cow_wrapper_client2( const cow_wrapper_client2
& rSrc
) :
69 cow_wrapper_client2
& cow_wrapper_client2::operator=( const cow_wrapper_client2
& rSrc
)
76 void cow_wrapper_client2::modify( int nVal
)
78 maImpl
->setValue( nVal
);
81 int cow_wrapper_client2::queryUnmodified() const
83 return maImpl
->getValue();
86 void cow_wrapper_client2::makeUnique()
90 bool cow_wrapper_client2::is_unique() const
92 return maImpl
.is_unique();
94 oslInterlockedCount
cow_wrapper_client2::use_count() const
96 return maImpl
.use_count();
98 void cow_wrapper_client2::swap( cow_wrapper_client2
& r
)
100 o3tl::swap(maImpl
, r
.maImpl
);
103 bool cow_wrapper_client2::operator==( const cow_wrapper_client2
& rRHS
) const
105 return maImpl
== rRHS
.maImpl
;
107 bool cow_wrapper_client2::operator!=( const cow_wrapper_client2
& rRHS
) const
109 return maImpl
!= rRHS
.maImpl
;
111 bool cow_wrapper_client2::operator<( const cow_wrapper_client2
& rRHS
) const
113 return maImpl
< rRHS
.maImpl
;
116 // ---------------------------------------------------------------------------
118 cow_wrapper_client3::cow_wrapper_client3() : maImpl()
122 cow_wrapper_client3::cow_wrapper_client3( int nVal
) :
123 maImpl( cow_wrapper_client2_impl(nVal
) )
127 cow_wrapper_client3::~cow_wrapper_client3()
131 cow_wrapper_client3::cow_wrapper_client3( const cow_wrapper_client3
& rSrc
) :
136 cow_wrapper_client3
& cow_wrapper_client3::operator=( const cow_wrapper_client3
& rSrc
)
138 maImpl
= rSrc
.maImpl
;
143 void cow_wrapper_client3::modify( int nVal
)
145 maImpl
->setValue( nVal
);
148 int cow_wrapper_client3::queryUnmodified() const
150 return maImpl
->getValue();
153 void cow_wrapper_client3::makeUnique()
155 maImpl
.make_unique();
157 bool cow_wrapper_client3::is_unique() const
159 return maImpl
.is_unique();
161 oslInterlockedCount
cow_wrapper_client3::use_count() const
163 return maImpl
.use_count();
165 void cow_wrapper_client3::swap( cow_wrapper_client3
& r
)
167 o3tl::swap(maImpl
, r
.maImpl
);
170 bool cow_wrapper_client3::operator==( const cow_wrapper_client3
& rRHS
) const
172 return maImpl
== rRHS
.maImpl
;
174 bool cow_wrapper_client3::operator!=( const cow_wrapper_client3
& rRHS
) const
176 return maImpl
!= rRHS
.maImpl
;
178 bool cow_wrapper_client3::operator<( const cow_wrapper_client3
& rRHS
) const
180 return maImpl
< rRHS
.maImpl
;
183 } // namespace o3tltests