Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
observed_ptr.cpp
Go to the documentation of this file.
1
// Copyright 2019 The PDFium Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#
include
"core/fxcrt/observed_ptr.h"
6
7
#
include
"third_party/base/check.h"
8
#
include
"third_party/base/containers/contains.h"
9
10
namespace
fxcrt
{
11
12
Observable
::
Observable
() =
default
;
13
14
Observable
::~
Observable
() {
15
NotifyObservers
(
)
;
16
}
17
18
void
Observable
::
AddObserver
(
ObserverIface
* pObserver) {
19
DCHECK(!pdfium::Contains(m_Observers, pObserver));
20
m_Observers.insert(pObserver);
21
}
22
23
void
Observable
::
RemoveObserver
(
ObserverIface
* pObserver) {
24
DCHECK(pdfium::Contains(m_Observers, pObserver));
25
m_Observers.erase(pObserver);
26
}
27
28
void
Observable
::
NotifyObservers
() {
29
for
(
auto
* pObserver : m_Observers)
30
pObserver->OnObservableDestroyed();
31
m_Observers.clear();
32
}
33
34
}
// namespace fxcrt
fxcrt::Observable::ObserverIface
Definition
observed_ptr.h:20
fxcrt::Observable
Definition
observed_ptr.h:17
fxcrt::Observable::AddObserver
void AddObserver(ObserverIface *pObserver)
Definition
observed_ptr.cpp:18
fxcrt::Observable::NotifyObservers
void NotifyObservers()
Definition
observed_ptr.cpp:28
fxcrt::Observable::RemoveObserver
void RemoveObserver(ObserverIface *pObserver)
Definition
observed_ptr.cpp:23
fxcrt::Observable::~Observable
~Observable()
Definition
observed_ptr.cpp:14
fxcrt::Observable::Observable
Observable()
fxcrt
Definition
span_util.h:14
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
observed_ptr.cpp
Generated on Sat Sep 21 2024 00:55:38 for Qt by
1.12.0