1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #include "cow_wrapper_clients.hxx"
32 class cow_wrapper_client2_impl
35 cow_wrapper_client2_impl() : mnValue(0) {}
36 explicit cow_wrapper_client2_impl( int nVal
) : mnValue(nVal
) {}
37 void setValue( int nVal
) { mnValue
= nVal
; }
38 int getValue() const { return mnValue
; }
40 bool operator==( const cow_wrapper_client2_impl
& rRHS
) const { return mnValue
== rRHS
.mnValue
; }
41 bool operator!=( const cow_wrapper_client2_impl
& rRHS
) const { return mnValue
!= rRHS
.mnValue
; }
42 bool operator<( const cow_wrapper_client2_impl
& rRHS
) const { return mnValue
< rRHS
.mnValue
; }
48 cow_wrapper_client2::cow_wrapper_client2() : maImpl()
52 cow_wrapper_client2::cow_wrapper_client2( int nVal
) :
53 maImpl( cow_wrapper_client2_impl(nVal
) )
57 cow_wrapper_client2::~cow_wrapper_client2()
61 cow_wrapper_client2::cow_wrapper_client2( const cow_wrapper_client2
& rSrc
) :
66 cow_wrapper_client2
& cow_wrapper_client2::operator=( const cow_wrapper_client2
& rSrc
)
73 void cow_wrapper_client2::modify( int nVal
)
75 maImpl
->setValue( nVal
);
78 int cow_wrapper_client2::queryUnmodified() const
80 return maImpl
->getValue();
83 void cow_wrapper_client2::makeUnique()
87 bool cow_wrapper_client2::is_unique() const
89 return maImpl
.is_unique();
91 oslInterlockedCount
cow_wrapper_client2::use_count() const
93 return maImpl
.use_count();
95 void cow_wrapper_client2::swap( cow_wrapper_client2
& r
)
97 o3tl::swap(maImpl
, r
.maImpl
);
100 bool cow_wrapper_client2::operator==( const cow_wrapper_client2
& rRHS
) const
102 return maImpl
== rRHS
.maImpl
;
104 bool cow_wrapper_client2::operator!=( const cow_wrapper_client2
& rRHS
) const
106 return maImpl
!= rRHS
.maImpl
;
108 bool cow_wrapper_client2::operator<( const cow_wrapper_client2
& rRHS
) const
110 return maImpl
< rRHS
.maImpl
;
113 // ---------------------------------------------------------------------------
115 cow_wrapper_client3::cow_wrapper_client3() : maImpl()
119 cow_wrapper_client3::cow_wrapper_client3( int nVal
) :
120 maImpl( cow_wrapper_client2_impl(nVal
) )
124 cow_wrapper_client3::~cow_wrapper_client3()
128 cow_wrapper_client3::cow_wrapper_client3( const cow_wrapper_client3
& rSrc
) :
133 cow_wrapper_client3
& cow_wrapper_client3::operator=( const cow_wrapper_client3
& rSrc
)
135 maImpl
= rSrc
.maImpl
;
140 void cow_wrapper_client3::modify( int nVal
)
142 maImpl
->setValue( nVal
);
145 int cow_wrapper_client3::queryUnmodified() const
147 return maImpl
->getValue();
150 void cow_wrapper_client3::makeUnique()
152 maImpl
.make_unique();
154 bool cow_wrapper_client3::is_unique() const
156 return maImpl
.is_unique();
158 oslInterlockedCount
cow_wrapper_client3::use_count() const
160 return maImpl
.use_count();
162 void cow_wrapper_client3::swap( cow_wrapper_client3
& r
)
164 o3tl::swap(maImpl
, r
.maImpl
);
167 bool cow_wrapper_client3::operator==( const cow_wrapper_client3
& rRHS
) const
169 return maImpl
== rRHS
.maImpl
;
171 bool cow_wrapper_client3::operator!=( const cow_wrapper_client3
& rRHS
) const
173 return maImpl
!= rRHS
.maImpl
;
175 bool cow_wrapper_client3::operator<( const cow_wrapper_client3
& rRHS
) const
177 return maImpl
< rRHS
.maImpl
;
180 } // namespace o3tltests