forked from bruderstein/PythonScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDepthCounter.cpp
More file actions
31 lines (25 loc) · 689 Bytes
/
DepthCounter.cpp
File metadata and controls
31 lines (25 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "stdafx.h"
#include "DepthCounter.h"
namespace NppPythonScript
{
DepthLevel::~DepthLevel() {
if (NULL != m_depthCounter) {
m_depthCounter->decrease();
}
}
DepthLevel& DepthLevel::operator=(const DepthLevel& rhs) {
m_depthCounter = rhs.m_depthCounter;
if (NULL != m_depthCounter) {
m_depthCounter->increaseAsCopy();
}
return *this;
}
DepthLevel::DepthLevel(const DepthLevel& copy)
: m_depthCounter(copy.m_depthCounter)
{
// The copy will also decrement the counter when destroyed, so we need to increase the counter to compensate
if (m_depthCounter) {
m_depthCounter->increaseAsCopy();
}
}
}