xref: /AOO41X/main/o3tl/qa/cow_wrapper_clients.cxx (revision 6da5f31158a7dd09f46f041b4f15bb7ae3eb92a4)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "cow_wrapper_clients.hxx"
25 
26 namespace o3tltests {
27 
28 class cow_wrapper_client2_impl
29 {
30 public:
31     cow_wrapper_client2_impl() : mnValue(0) {}
32     explicit cow_wrapper_client2_impl( int nVal ) : mnValue(nVal) {}
33     void setValue( int nVal ) { mnValue = nVal; }
34     int  getValue() const { return mnValue; }
35 
36     bool operator==( const cow_wrapper_client2_impl& rRHS ) const { return mnValue == rRHS.mnValue; }
37     bool operator!=( const cow_wrapper_client2_impl& rRHS ) const { return mnValue != rRHS.mnValue; }
38     bool operator<( const cow_wrapper_client2_impl& rRHS ) const { return mnValue < rRHS.mnValue; }
39 
40 private:
41     int mnValue;
42 };
43 
44 cow_wrapper_client2::cow_wrapper_client2() : maImpl()
45 {
46 }
47 
48 cow_wrapper_client2::cow_wrapper_client2( int nVal ) :
49     maImpl( cow_wrapper_client2_impl(nVal) )
50 {
51 }
52 
53 cow_wrapper_client2::~cow_wrapper_client2()
54 {
55 }
56 
57 cow_wrapper_client2::cow_wrapper_client2( const cow_wrapper_client2& rSrc ) :
58     maImpl(rSrc.maImpl)
59 {
60 }
61 
62 cow_wrapper_client2& cow_wrapper_client2::operator=( const cow_wrapper_client2& rSrc )
63 {
64     maImpl = rSrc.maImpl;
65 
66 	return *this;
67 }
68 
69 void cow_wrapper_client2::modify( int nVal )
70 {
71     maImpl->setValue( nVal );
72 }
73 
74 int  cow_wrapper_client2::queryUnmodified() const
75 {
76     return maImpl->getValue();
77 }
78 
79 void cow_wrapper_client2::makeUnique()
80 {
81     maImpl.make_unique();
82 }
83 bool cow_wrapper_client2::is_unique() const
84 {
85     return maImpl.is_unique();
86 }
87 oslInterlockedCount cow_wrapper_client2::use_count() const
88 {
89     return maImpl.use_count();
90 }
91 void cow_wrapper_client2::swap( cow_wrapper_client2& r )
92 {
93     o3tl::swap(maImpl, r.maImpl);
94 }
95 
96 bool cow_wrapper_client2::operator==( const cow_wrapper_client2& rRHS ) const
97 {
98     return maImpl == rRHS.maImpl;
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 
109 // ---------------------------------------------------------------------------
110 
111 cow_wrapper_client3::cow_wrapper_client3() : maImpl()
112 {
113 }
114 
115 cow_wrapper_client3::cow_wrapper_client3( int nVal ) :
116     maImpl( cow_wrapper_client2_impl(nVal) )
117 {
118 }
119 
120 cow_wrapper_client3::~cow_wrapper_client3()
121 {
122 }
123 
124 cow_wrapper_client3::cow_wrapper_client3( const cow_wrapper_client3& rSrc ) :
125     maImpl(rSrc.maImpl)
126 {
127 }
128 
129 cow_wrapper_client3& cow_wrapper_client3::operator=( const cow_wrapper_client3& rSrc )
130 {
131     maImpl = rSrc.maImpl;
132 
133 	return *this;
134 }
135 
136 void cow_wrapper_client3::modify( int nVal )
137 {
138     maImpl->setValue( nVal );
139 }
140 
141 int  cow_wrapper_client3::queryUnmodified() const
142 {
143     return maImpl->getValue();
144 }
145 
146 void cow_wrapper_client3::makeUnique()
147 {
148     maImpl.make_unique();
149 }
150 bool cow_wrapper_client3::is_unique() const
151 {
152     return maImpl.is_unique();
153 }
154 oslInterlockedCount cow_wrapper_client3::use_count() const
155 {
156     return maImpl.use_count();
157 }
158 void cow_wrapper_client3::swap( cow_wrapper_client3& r )
159 {
160     o3tl::swap(maImpl, r.maImpl);
161 }
162 
163 bool cow_wrapper_client3::operator==( const cow_wrapper_client3& rRHS ) const
164 {
165     return maImpl == rRHS.maImpl;
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 
176 } // namespace o3tltests
177