src/misc/documentPointer.h

Wed, 08 Jan 2014 13:43:39 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Wed, 08 Jan 2014 13:43:39 +0200
changeset 607
353e418f161a
parent 603
47e7773c7841
permissions
-rw-r--r--

- corrected relationships between documents: opening a main file with the same name as another document is to overload it and editing the document is to invalidate its cache so that it gets rendered properly in other documents possibly referencing it.

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
607
353e418f161a - corrected relationships between documents: opening a main file with the same name as another document is to overload it and editing the document is to invalidate its cache so that it gets rendered properly in other documents possibly referencing it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
24 class LDSubfile;
584
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 class LDDocument;
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 class LDDocumentPointer
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
28 {
607
353e418f161a - corrected relationships between documents: opening a main file with the same name as another document is to overload it and editing the document is to invalidate its cache so that it gets rendered properly in other documents possibly referencing it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
29 PROPERTY (private, LDDocument*, Pointer, NO_OPS, STOCK_WRITE)
584
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 public:
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 LDDocumentPointer();
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 LDDocumentPointer (LDDocument* ptr);
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 LDDocumentPointer (const LDDocumentPointer& other);
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 ~LDDocumentPointer();
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 LDDocumentPointer& operator= (LDDocument* ptr);
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
38 inline LDDocumentPointer& operator= (LDDocumentPointer& other)
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
39 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
40 return operator= (other.getPointer());
584
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 }
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
43 inline LDDocument* operator->() const
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
44 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
45 return getPointer();
584
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
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
48 inline operator LDDocument*() const
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
49 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
50 return getPointer();
584
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 private:
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 void addReference();
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 void removeReference();
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
12caa4e7b874 - forgot these new files out...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 #endif // LDFORGE_DOCUMENT_POINTER_H

mercurial