Sun, 22 Dec 2013 20:45:56 +0200
- forgot these new files out...
584
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013 Santeri Piippo |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #include "documentPointer.h" |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include "../document.h" |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | LDDocumentPointer::LDDocumentPointer() : m_Pointer (null) {} |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | // ============================================================================= |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | // ----------------------------------------------------------------------------- |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | LDDocumentPointer::LDDocumentPointer (LDDocument* ptr) : |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | m_Pointer (ptr) |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | { addReference (); |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | } |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | // ============================================================================= |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | // ----------------------------------------------------------------------------- |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | LDDocumentPointer::LDDocumentPointer (const LDDocumentPointer& other) : |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | m_Pointer (other.getPointer()) |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | { addReference (); |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | } |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | // ============================================================================= |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | // ----------------------------------------------------------------------------- |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | LDDocumentPointer::~LDDocumentPointer() |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | { removeReference(); |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | } |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | // ============================================================================= |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | // ----------------------------------------------------------------------------- |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | void LDDocumentPointer::addReference() |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | { if (getPointer() != null) |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | getPointer()->addReference (this); |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | } |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | // ============================================================================= |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | // ----------------------------------------------------------------------------- |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | void LDDocumentPointer::removeReference() |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | { if (getPointer() != null) |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | getPointer()->removeReference (this); |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | } |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | // ============================================================================= |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | // ----------------------------------------------------------------------------- |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | LDDocumentPointer& LDDocumentPointer::operator= (LDDocument* ptr) |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | { if (ptr != getPointer()) |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | { removeReference(); |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | setPointer (ptr); |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | addReference(); |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | } |
12caa4e7b874
- forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | } |