Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include "cow_wrapper_clients.hxx"
21 : :
22 : : namespace o3tltests {
23 : :
24 : : class cow_wrapper_client2_impl
25 : : {
26 : : public:
27 : 30 : cow_wrapper_client2_impl() : mnValue(0) {}
28 : 10 : explicit cow_wrapper_client2_impl( int nVal ) : mnValue(nVal) {}
29 : 20 : void setValue( int nVal ) { mnValue = nVal; }
30 : 30 : int getValue() const { return mnValue; }
31 : :
32 : 20 : bool operator==( const cow_wrapper_client2_impl& rRHS ) const { return mnValue == rRHS.mnValue; }
33 : 30 : bool operator!=( const cow_wrapper_client2_impl& rRHS ) const { return mnValue != rRHS.mnValue; }
34 : 20 : bool operator<( const cow_wrapper_client2_impl& rRHS ) const { return mnValue < rRHS.mnValue; }
35 : :
36 : : private:
37 : : int mnValue;
38 : : };
39 : :
40 : 15 : cow_wrapper_client2::cow_wrapper_client2() : maImpl()
41 : : {
42 : 15 : }
43 : :
44 : 5 : cow_wrapper_client2::cow_wrapper_client2( int nVal ) :
45 [ + - ]: 5 : maImpl( cow_wrapper_client2_impl(nVal) )
46 : : {
47 : 5 : }
48 : :
49 : 20 : cow_wrapper_client2::~cow_wrapper_client2()
50 : : {
51 : 20 : }
52 : :
53 : 0 : cow_wrapper_client2::cow_wrapper_client2( const cow_wrapper_client2& rSrc ) :
54 : 0 : maImpl(rSrc.maImpl)
55 : : {
56 : 0 : }
57 : :
58 : 15 : cow_wrapper_client2& cow_wrapper_client2::operator=( const cow_wrapper_client2& rSrc )
59 : : {
60 : 15 : maImpl = rSrc.maImpl;
61 : :
62 : 15 : return *this;
63 : : }
64 : :
65 : 10 : void cow_wrapper_client2::modify( int nVal )
66 : : {
67 : 10 : maImpl->setValue( nVal );
68 : 10 : }
69 : :
70 : 15 : int cow_wrapper_client2::queryUnmodified() const
71 : : {
72 : 15 : return maImpl->getValue();
73 : : }
74 : :
75 : 5 : void cow_wrapper_client2::makeUnique()
76 : : {
77 : 5 : maImpl.make_unique();
78 : 5 : }
79 : 25 : bool cow_wrapper_client2::is_unique() const
80 : : {
81 : 25 : return maImpl.is_unique();
82 : : }
83 : 45 : oslInterlockedCount cow_wrapper_client2::use_count() const
84 : : {
85 : 45 : return maImpl.use_count();
86 : : }
87 : 5 : void cow_wrapper_client2::swap( cow_wrapper_client2& r )
88 : : {
89 : 5 : o3tl::swap(maImpl, r.maImpl);
90 : 5 : }
91 : :
92 : 30 : bool cow_wrapper_client2::operator==( const cow_wrapper_client2& rRHS ) const
93 : : {
94 : 30 : return maImpl == rRHS.maImpl;
95 : : }
96 : 15 : bool cow_wrapper_client2::operator!=( const cow_wrapper_client2& rRHS ) const
97 : : {
98 : 15 : return maImpl != rRHS.maImpl;
99 : : }
100 : 10 : bool cow_wrapper_client2::operator<( const cow_wrapper_client2& rRHS ) const
101 : : {
102 : 10 : return maImpl < rRHS.maImpl;
103 : : }
104 : :
105 : : // ---------------------------------------------------------------------------
106 : :
107 : 15 : cow_wrapper_client3::cow_wrapper_client3() : maImpl()
108 : : {
109 : 15 : }
110 : :
111 : 5 : cow_wrapper_client3::cow_wrapper_client3( int nVal ) :
112 [ + - ]: 5 : maImpl( cow_wrapper_client2_impl(nVal) )
113 : : {
114 : 5 : }
115 : :
116 : 20 : cow_wrapper_client3::~cow_wrapper_client3()
117 : : {
118 : 20 : }
119 : :
120 : 0 : cow_wrapper_client3::cow_wrapper_client3( const cow_wrapper_client3& rSrc ) :
121 : 0 : maImpl(rSrc.maImpl)
122 : : {
123 : 0 : }
124 : :
125 : 15 : cow_wrapper_client3& cow_wrapper_client3::operator=( const cow_wrapper_client3& rSrc )
126 : : {
127 : 15 : maImpl = rSrc.maImpl;
128 : :
129 : 15 : return *this;
130 : : }
131 : :
132 : 10 : void cow_wrapper_client3::modify( int nVal )
133 : : {
134 : 10 : maImpl->setValue( nVal );
135 : 10 : }
136 : :
137 : 15 : int cow_wrapper_client3::queryUnmodified() const
138 : : {
139 : 15 : return maImpl->getValue();
140 : : }
141 : :
142 : 5 : void cow_wrapper_client3::makeUnique()
143 : : {
144 : 5 : maImpl.make_unique();
145 : 5 : }
146 : 25 : bool cow_wrapper_client3::is_unique() const
147 : : {
148 : 25 : return maImpl.is_unique();
149 : : }
150 : 45 : oslInterlockedCount cow_wrapper_client3::use_count() const
151 : : {
152 : 45 : return maImpl.use_count();
153 : : }
154 : 5 : void cow_wrapper_client3::swap( cow_wrapper_client3& r )
155 : : {
156 : 5 : o3tl::swap(maImpl, r.maImpl);
157 : 5 : }
158 : :
159 : 30 : bool cow_wrapper_client3::operator==( const cow_wrapper_client3& rRHS ) const
160 : : {
161 : 30 : return maImpl == rRHS.maImpl;
162 : : }
163 : 15 : bool cow_wrapper_client3::operator!=( const cow_wrapper_client3& rRHS ) const
164 : : {
165 : 15 : return maImpl != rRHS.maImpl;
166 : : }
167 : 10 : bool cow_wrapper_client3::operator<( const cow_wrapper_client3& rRHS ) const
168 : : {
169 : 10 : return maImpl < rRHS.maImpl;
170 : : }
171 : :
172 : : } // namespace o3tltests
173 : :
174 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|