xref: /trunk/main/o3tl/qa/cow_wrapper_clients.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 #include "cow_wrapper_clients.hxx"
29 
30 namespace o3tltests {
31 
32 class cow_wrapper_client2_impl
33 {
34 public:
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; }
39 
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; }
43 
44 private:
45     int mnValue;
46 };
47 
48 cow_wrapper_client2::cow_wrapper_client2() : maImpl()
49 {
50 }
51 
52 cow_wrapper_client2::cow_wrapper_client2( int nVal ) :
53     maImpl( cow_wrapper_client2_impl(nVal) )
54 {
55 }
56 
57 cow_wrapper_client2::~cow_wrapper_client2()
58 {
59 }
60 
61 cow_wrapper_client2::cow_wrapper_client2( const cow_wrapper_client2& rSrc ) :
62     maImpl(rSrc.maImpl)
63 {
64 }
65 
66 cow_wrapper_client2& cow_wrapper_client2::operator=( const cow_wrapper_client2& rSrc )
67 {
68     maImpl = rSrc.maImpl;
69 
70 	return *this;
71 }
72 
73 void cow_wrapper_client2::modify( int nVal )
74 {
75     maImpl->setValue( nVal );
76 }
77 
78 int  cow_wrapper_client2::queryUnmodified() const
79 {
80     return maImpl->getValue();
81 }
82 
83 void cow_wrapper_client2::makeUnique()
84 {
85     maImpl.make_unique();
86 }
87 bool cow_wrapper_client2::is_unique() const
88 {
89     return maImpl.is_unique();
90 }
91 oslInterlockedCount cow_wrapper_client2::use_count() const
92 {
93     return maImpl.use_count();
94 }
95 void cow_wrapper_client2::swap( cow_wrapper_client2& r )
96 {
97     o3tl::swap(maImpl, r.maImpl);
98 }
99 
100 bool cow_wrapper_client2::operator==( const cow_wrapper_client2& rRHS ) const
101 {
102     return maImpl == rRHS.maImpl;
103 }
104 bool cow_wrapper_client2::operator!=( const cow_wrapper_client2& rRHS ) const
105 {
106     return maImpl != rRHS.maImpl;
107 }
108 bool cow_wrapper_client2::operator<( const cow_wrapper_client2& rRHS ) const
109 {
110     return maImpl < rRHS.maImpl;
111 }
112 
113 // ---------------------------------------------------------------------------
114 
115 cow_wrapper_client3::cow_wrapper_client3() : maImpl()
116 {
117 }
118 
119 cow_wrapper_client3::cow_wrapper_client3( int nVal ) :
120     maImpl( cow_wrapper_client2_impl(nVal) )
121 {
122 }
123 
124 cow_wrapper_client3::~cow_wrapper_client3()
125 {
126 }
127 
128 cow_wrapper_client3::cow_wrapper_client3( const cow_wrapper_client3& rSrc ) :
129     maImpl(rSrc.maImpl)
130 {
131 }
132 
133 cow_wrapper_client3& cow_wrapper_client3::operator=( const cow_wrapper_client3& rSrc )
134 {
135     maImpl = rSrc.maImpl;
136 
137 	return *this;
138 }
139 
140 void cow_wrapper_client3::modify( int nVal )
141 {
142     maImpl->setValue( nVal );
143 }
144 
145 int  cow_wrapper_client3::queryUnmodified() const
146 {
147     return maImpl->getValue();
148 }
149 
150 void cow_wrapper_client3::makeUnique()
151 {
152     maImpl.make_unique();
153 }
154 bool cow_wrapper_client3::is_unique() const
155 {
156     return maImpl.is_unique();
157 }
158 oslInterlockedCount cow_wrapper_client3::use_count() const
159 {
160     return maImpl.use_count();
161 }
162 void cow_wrapper_client3::swap( cow_wrapper_client3& r )
163 {
164     o3tl::swap(maImpl, r.maImpl);
165 }
166 
167 bool cow_wrapper_client3::operator==( const cow_wrapper_client3& rRHS ) const
168 {
169     return maImpl == rRHS.maImpl;
170 }
171 bool cow_wrapper_client3::operator!=( const cow_wrapper_client3& rRHS ) const
172 {
173     return maImpl != rRHS.maImpl;
174 }
175 bool cow_wrapper_client3::operator<( const cow_wrapper_client3& rRHS ) const
176 {
177     return maImpl < rRHS.maImpl;
178 }
179 
180 } // namespace o3tltests
181