nss: upgrade to release 3.73
[LibreOffice.git] / sd / inc / helper / simplereferencecomponent.hxx
blob153d8573da4267bd6a91b8795f076e3e1c266437
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 #ifndef INCLUDED_SD_INC_HELPER_SIMPLEREFERENCECOMPONENT_HXX
21 #define INCLUDED_SD_INC_HELPER_SIMPLEREFERENCECOMPONENT_HXX
23 #include <osl/interlck.h>
25 #include <sddllapi.h>
27 namespace sd
29 /** A simple base implementation for reference-counted components.
30 acts like sal::SimpleReferenceObject but calls the virtual disposing()
31 methods before the ref count switches from 1 to zero.
33 class SimpleReferenceComponent
35 public:
36 SimpleReferenceComponent();
38 /** @ATTENTION
39 The results are undefined if, for any individual instance of
40 SimpleReferenceComponent, the total number of calls to acquire() exceeds
41 the total number of calls to release() by a platform dependent amount
42 (which, hopefully, is quite large).
44 void acquire();
45 void release();
47 void Dispose();
49 bool isDisposed() const { return mbDisposed; }
51 protected:
52 virtual void disposing();
54 virtual ~SimpleReferenceComponent();
56 private:
57 oslInterlockedCount m_nCount;
59 SimpleReferenceComponent(SimpleReferenceComponent const&) = delete;
60 void operator=(SimpleReferenceComponent const&) = delete;
62 bool mbDisposed;
66 #endif // _SALHELPER_SimpleReferenceComponent_HXX_
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */