src/misc/documentPointer.h

Tue, 07 Jan 2014 08:53:27 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 07 Jan 2014 08:53:27 +0200
changeset 603
47e7773c7841
parent 600
209e3f1f7b2c
child 607
353e418f161a
permissions
-rw-r--r--

- reformatting

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
600
209e3f1f7b2c - updated copyright year. Best wishes for 2014!
Santeri Piippo <crimsondusk64@gmail.com>
parents: 584
diff changeset
3 * Copyright (C) 2013, 2014 Santeri Piippo
584
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 #ifndef LDFORGE_DOCUMENT_POINTER_H
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #define LDFORGE_DOCUMENT_POINTER_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 #include "../main.h"
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 class LDDocument;
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 class LDDocumentPointer
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
27 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
28 PROPERTY (private, LDDocument*, Pointer, NO_OPS, STOCK_WRITE)
584
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 public:
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 LDDocumentPointer();
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 LDDocumentPointer (LDDocument* ptr);
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 LDDocumentPointer (const LDDocumentPointer& other);
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 ~LDDocumentPointer();
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 LDDocumentPointer& operator= (LDDocument* ptr);
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
37 inline LDDocumentPointer& operator= (LDDocumentPointer& other)
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
38 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
39 return operator= (other.getPointer());
584
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
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
42 inline LDDocument* operator->() const
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
43 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
44 return getPointer();
584
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
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
47 inline operator LDDocument*() const
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
48 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
49 return getPointer();
584
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 private:
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 void addReference();
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 void removeReference();
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 };
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 #endif // LDFORGE_DOCUMENT_POINTER_H

mercurial