We are working with signed long (made this explicit) so use fromLong instead of fromInt.
[UnsignedByte.git] / src / Resource / Types.h
blobf72e9926776c3a5d2415e4210795e4c0a020a216
1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #pragma once
23 /**
24 * @file Types.h
25 * This file contains all type definitions.
26 */
28 #include <string>
29 #include <vector>
30 #include <map>
31 #include <stdexcept>
32 #include <set>
34 #include <sqlite3.h>
36 /** The type used to store database keys. */
37 typedef unsigned long value_type;
39 /** The type to store multiple database keys with. */
40 typedef std::set<value_type> value_types;
42 /** The type of a constant string reference. */
43 typedef const std::string& cstring;
45 /** The type of multiple non-const strings. */
46 typedef std::vector<std::string> Strings;
48 #include "smart_ptr.h"
49 #include "singleton.h"
50 #include "Exceptions.h"
51 #include "Assert.h"
53 class Table;
54 typedef SmartPtr<Table> TablePtr; /**< The type of a pointer to a table. */
55 typedef std::vector<TablePtr> TableVector; /**< The type of multiple table pointers. */
57 class TableDef;
58 typedef SmartPtr<TableDef> TableDefPtr; /**< The type of a pointer to a table def. */
59 typedef std::vector<TableDefPtr> TableDefVector; /**< The type of multiple table def pointers. */
61 class TableImpl;
62 typedef SmartPtr<TableImpl> TableImplPtr; /**< The type of a pointer to a table impl. */
63 typedef std::vector<TableImplPtr> TableImplVector; /**< The type of multiple table impl pointers. */
65 class KeyDef;
66 typedef SmartPtr<KeyDef> KeyDefPtr; /**< The type of a pointer to a key def. */
67 typedef std::vector<KeyDefPtr> KeyDefs; /**< The type of multiple key def pointers. */
69 class KeyImpl;
70 typedef SmartPtr<KeyImpl> KeyImplPtr; /**< The type of a pointer to a key impl. */
71 typedef std::vector<KeyImplPtr> KeyImpls; /**< The type of multiple key impl pointers. */
73 class KeyValue;
74 typedef SmartPtr<KeyValue> KeyValuePtr; /**< The type of a pointer to a key value. */
76 class Field;
77 typedef SmartPtr<Field> FieldPtr; /**< The type of a pointer to a field. */
78 typedef std::vector<FieldPtr> FieldVector; /**< The type multiple field pointers. */
80 class FieldDef;
81 typedef SmartPtr<FieldDef> FieldDefPtr; /**< The type of a pointer to a field def. */
82 typedef std::vector<FieldDefPtr> FieldDefVector; /**< The type of multiple field def pointers. */
84 class FieldImpl;
85 typedef SmartPtr<FieldImpl> FieldImplPtr; /**< The type of a pointer to a field impl. */
86 typedef std::vector<FieldImplPtr> FieldImplVector; /**< The type of multiple field impl pointers. */
88 class FieldValue;
89 typedef SmartPtr<FieldValue> ValuePtr; /**< The type of a pointer to a value. */
90 typedef SmartPtr<FieldValue> FieldValuePtr; /**< A more descriptive name of of the type of a pointer to a value. */
93 /**
94 * The type of a map from foreign key name to Table.
96 * @deprecated Use KeyDefs instead.
97 * @see KeyDefs
98 */
99 typedef std::map<std::string, TablePtr> TableMap;
101 /** The type of a map from KeyImpl pointers to KeyValue pointers. */
102 typedef std::map<KeyImpl*, KeyValuePtr> KeyImplMap;
104 /** The type of a map from FieldImpl pointers to Value pointers. */
105 typedef std::map<FieldImpl*, ValuePtr> FieldValueMap;
107 /** The type of a map from FieldImpl poinntiers to Value pointers. */
108 typedef std::map<FieldImpl*, ValuePtr> ValueMap;
111 class Keys;
112 typedef SmartPtr<Keys> KeysPtr; /**< The type of a pointer to a keys bucket. */
114 class FieldValues;
115 typedef SmartPtr<FieldValues> ValuesPtr; /**< The type of a pointer to a values bucket. */
116 typedef SmartPtr<FieldValues> FieldValuesPtr; /**< A more precise name for the type of a pointer to a values bucket. */
118 class SavableManagers;
119 typedef SmartPtr<SavableManagers> SavableManagersPtr; /**< The type of a pointer to a savable managers bucket. */
122 class SavableManager;
123 typedef SmartPtr<SavableManager> SavableManagerPtr; /**< The type of a pointer to a savable manager. */
124 typedef std::vector<SavableManagerPtr> SavableManagerVector; /**< The type of multiple savable manager pointers. */
126 class SelectionMask;
127 typedef SmartPtr<SelectionMask> SelectionMaskPtr; /**< The type of a pointer to a selection mask. */
129 class Relation;
130 typedef SmartPtr<Relation> RelationPtr; /**< The type of a pointer to a relation. */
131 typedef std::vector<RelationPtr> Relations; /**< The type of multiple relation pointers. */
133 class Join;
134 typedef SmartPtr<Join> JoinPtr; /**< The type of a pointer to a join. */
135 typedef std::vector<JoinPtr> Joins; /**< The type of multiple join pointers. */
137 class Actor;
138 typedef SmartPtr<Actor> ActorPtr; /**< The type of a pointer to an actor. */
140 class UBSocket;
142 class Savable;
143 typedef SmartPtr<Savable> SavablePtr; /**< The type of a pointer to a Savable. */