Nebula
Toggle main menu visibility
Loading...
Searching...
No Matches
column.h
Go to the documentation of this file.
1
#pragma once
2
#ifndef DB_COLUMN_H
3
#define DB_COLUMN_H
4
//------------------------------------------------------------------------------
16
#include "
core/types.h
"
17
#include "
attr/attrid.h
"
18
19
//------------------------------------------------------------------------------
20
namespace
Db
21
{
22
class
Column
23
{
24
public
:
26
enum
Type
27
{
28
Default
,
// a default column
29
Primary
,
// the primary column
30
Indexed
,
// an indexed column
31
};
32
33
Column
();
35
Column
(
const
Attr::AttrId
&
attrId
,
Type
=
Default
);
36
38
void
SetAttrId
(
const
Attr::AttrId
&
attrId
);
40
const
Attr::AttrId
&
GetAttrId
()
const
;
42
const
Util::String
&
GetName
()
const
;
44
const
Util::FourCC
&
GetFourCC
()
const
;
46
Attr::ValueType
GetValueType
()
const
;
48
Attr::AccessMode
GetAccessMode
()
const
;
50
void
SetType
(
Type
t);
52
Type
GetType
()
const
;
54
void
SetCommitted
(
bool
b);
56
bool
IsCommitted
()
const
;
57
58
private
:
59
Attr::AttrId
attrId
;
60
Type
type
;
61
bool
committed
;
62
};
63
64
//------------------------------------------------------------------------------
67
inline
void
68
Column::SetAttrId
(
const
Attr::AttrId
&
id
)
69
{
70
this->
attrId
= id;
71
}
72
73
//------------------------------------------------------------------------------
76
inline
const
Attr::AttrId
&
77
Column::GetAttrId
()
const
78
{
79
return
this->
attrId
;
80
}
81
82
//------------------------------------------------------------------------------
85
inline
const
Util::String
&
86
Column::GetName
()
const
87
{
88
return
this->
attrId
.GetName();
89
}
90
91
//------------------------------------------------------------------------------
94
inline
const
Util::FourCC
&
95
Column::GetFourCC
()
const
96
{
97
return
this->
attrId
.GetFourCC();
98
}
99
100
//------------------------------------------------------------------------------
103
inline
Attr::ValueType
104
Column::GetValueType
()
const
105
{
106
return
this->
attrId
.GetValueType();
107
}
108
109
//------------------------------------------------------------------------------
112
inline
Attr::AccessMode
113
Column::GetAccessMode
()
const
114
{
115
return
this->
attrId
.GetAccessMode();
116
}
117
118
//------------------------------------------------------------------------------
121
inline
void
122
Column::SetType
(
Type
t)
123
{
124
this->
type
= t;
125
}
126
127
//------------------------------------------------------------------------------
130
inline
Column::Type
131
Column::GetType
()
const
132
{
133
return
this->
type
;
134
}
135
136
//------------------------------------------------------------------------------
139
inline
void
140
Column::SetCommitted
(
bool
b)
141
{
142
this->
committed
= b;
143
}
144
145
//------------------------------------------------------------------------------
148
inline
bool
149
Column::IsCommitted
()
const
150
{
151
return
this->
committed
;
152
}
153
154
}
// namespace Db
155
//------------------------------------------------------------------------------
156
#endif
157
attrid.h
Attr::AttrId
An attribute ID is used to carry attribute types (no values) around.
Definition
attrid.h:20
Db::Column::attrId
Attr::AttrId attrId
Definition
column.h:59
Db::Column::type
Type type
Definition
column.h:60
Db::Column::committed
bool committed
Definition
column.h:61
Db::Column::IsCommitted
bool IsCommitted() const
return true if the column has been sync'd with the database
Definition
column.h:149
Db::Column::SetAttrId
void SetAttrId(const Attr::AttrId &attrId)
set attribute id (overrides name, fourcc, type and access mode)
Definition
column.h:68
Db::Column::GetAccessMode
Attr::AccessMode GetAccessMode() const
get column access mode
Definition
column.h:113
Db::Column::Type
Type
column types
Definition
column.h:27
Db::Column::Primary
@ Primary
Definition
column.h:29
Db::Column::Default
@ Default
Definition
column.h:28
Db::Column::Indexed
@ Indexed
Definition
column.h:30
Db::Column::SetType
void SetType(Type t)
set column type
Definition
column.h:122
Db::Column::Column
Column()
default constructor
Definition
column.cc:14
Db::Column::SetCommitted
void SetCommitted(bool b)
set to true when the column is in-sync with the database
Definition
column.h:140
Db::Column::GetAttrId
const Attr::AttrId & GetAttrId() const
get attribute id
Definition
column.h:77
Db::Column::GetType
Type GetType() const
get column type
Definition
column.h:131
Db::Column::GetFourCC
const Util::FourCC & GetFourCC() const
get column fourcc
Definition
column.h:95
Db::Column::GetName
const Util::String & GetName() const
get column name
Definition
column.h:86
Db::Column::GetValueType
Attr::ValueType GetValueType() const
get column value type
Definition
column.h:104
Util::FourCC
A four-character-code is a quasi-human-readable 32-bit-id.
Definition
fourcc.h:19
Attr::ValueType
ValueType
Definition
valuetype.h:20
Attr::AccessMode
AccessMode
Definition
accessmode.h:15
Db
Definition
column.cc:10
Util.String
Nebula's universal string class.
Definition
String.cs:8
types.h
code
addons
db
column.h
Generated on
for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.