Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / o3tl / qa / cow_wrapper_clients.cxx
blobf468d4306bcf76c3d6a1b8de1c51687bc1eb39d5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "cow_wrapper_clients.hxx"
22 namespace o3tltests {
24 class cow_wrapper_client2_impl
26 public:
27 cow_wrapper_client2_impl() : mnValue(0) {}
28 explicit cow_wrapper_client2_impl( int nVal ) : mnValue(nVal) {}
29 void setValue( int nVal ) { mnValue = nVal; }
30 int getValue() const { return mnValue; }
32 bool operator==( const cow_wrapper_client2_impl& rRHS ) const { return mnValue == rRHS.mnValue; }
33 bool operator!=( const cow_wrapper_client2_impl& rRHS ) const { return mnValue != rRHS.mnValue; }
34 bool operator<( const cow_wrapper_client2_impl& rRHS ) const { return mnValue < rRHS.mnValue; }
36 private:
37 int mnValue;
40 cow_wrapper_client2::cow_wrapper_client2() : maImpl()
44 cow_wrapper_client2::cow_wrapper_client2( int nVal ) :
45 maImpl( cow_wrapper_client2_impl(nVal) )
49 cow_wrapper_client2::~cow_wrapper_client2()
53 cow_wrapper_client2::cow_wrapper_client2( const cow_wrapper_client2& rSrc ) :
54 maImpl(rSrc.maImpl)
58 cow_wrapper_client2& cow_wrapper_client2::operator=( const cow_wrapper_client2& rSrc )
60 maImpl = rSrc.maImpl;
62 return *this;
65 void cow_wrapper_client2::modify( int nVal )
67 maImpl->setValue( nVal );
70 int cow_wrapper_client2::queryUnmodified() const
72 return maImpl->getValue();
75 void cow_wrapper_client2::makeUnique()
77 maImpl.make_unique();
79 bool cow_wrapper_client2::is_unique() const
81 return maImpl.is_unique();
83 oslInterlockedCount cow_wrapper_client2::use_count() const
85 return maImpl.use_count();
87 void cow_wrapper_client2::swap( cow_wrapper_client2& r )
89 o3tl::swap(maImpl, r.maImpl);
92 bool cow_wrapper_client2::operator==( const cow_wrapper_client2& rRHS ) const
94 return maImpl == rRHS.maImpl;
96 bool cow_wrapper_client2::operator!=( const cow_wrapper_client2& rRHS ) const
98 return maImpl != rRHS.maImpl;
100 bool cow_wrapper_client2::operator<( const cow_wrapper_client2& rRHS ) const
102 return maImpl < rRHS.maImpl;
105 // ---------------------------------------------------------------------------
107 cow_wrapper_client3::cow_wrapper_client3() : maImpl()
111 cow_wrapper_client3::cow_wrapper_client3( int nVal ) :
112 maImpl( cow_wrapper_client2_impl(nVal) )
116 cow_wrapper_client3::~cow_wrapper_client3()
120 cow_wrapper_client3::cow_wrapper_client3( const cow_wrapper_client3& rSrc ) :
121 maImpl(rSrc.maImpl)
125 cow_wrapper_client3& cow_wrapper_client3::operator=( const cow_wrapper_client3& rSrc )
127 maImpl = rSrc.maImpl;
129 return *this;
132 void cow_wrapper_client3::modify( int nVal )
134 maImpl->setValue( nVal );
137 int cow_wrapper_client3::queryUnmodified() const
139 return maImpl->getValue();
142 void cow_wrapper_client3::makeUnique()
144 maImpl.make_unique();
146 bool cow_wrapper_client3::is_unique() const
148 return maImpl.is_unique();
150 oslInterlockedCount cow_wrapper_client3::use_count() const
152 return maImpl.use_count();
154 void cow_wrapper_client3::swap( cow_wrapper_client3& r )
156 o3tl::swap(maImpl, r.maImpl);
159 bool cow_wrapper_client3::operator==( const cow_wrapper_client3& rRHS ) const
161 return maImpl == rRHS.maImpl;
163 bool cow_wrapper_client3::operator!=( const cow_wrapper_client3& rRHS ) const
165 return maImpl != rRHS.maImpl;
167 bool cow_wrapper_client3::operator<( const cow_wrapper_client3& rRHS ) const
169 return maImpl < rRHS.maImpl;
172 } // namespace o3tltests
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */