Nebula
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//------------------------------------------------------------------------------
20namespace Db
21{
22class Column
23{
24public:
26 enum Type
27 {
28 Default, // a default column
29 Primary, // the primary column
30 Indexed, // an indexed column
31 };
33 Column();
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;
50 void SetType(Type t);
52 Type GetType() const;
54 void SetCommitted(bool b);
56 bool IsCommitted() const;
57
58private:
62};
63
64//------------------------------------------------------------------------------
67inline void
69{
70 this->attrId = id;
71}
72
73//------------------------------------------------------------------------------
76inline const Attr::AttrId&
78{
79 return this->attrId;
80}
81
82//------------------------------------------------------------------------------
85inline const Util::String&
87{
88 return this->attrId.GetName();
89}
90
91//------------------------------------------------------------------------------
94inline const Util::FourCC&
96{
97 return this->attrId.GetFourCC();
98}
99
100//------------------------------------------------------------------------------
103inline Attr::ValueType
105{
106 return this->attrId.GetValueType();
107}
108
109//------------------------------------------------------------------------------
112inline Attr::AccessMode
114{
115 return this->attrId.GetAccessMode();
116}
117
118//------------------------------------------------------------------------------
121inline void
123{
124 this->type = t;
125}
126
127//------------------------------------------------------------------------------
130inline Column::Type
132{
133 return this->type;
134}
135
136//------------------------------------------------------------------------------
139inline void
141{
142 this->committed = b;
143}
144
145//------------------------------------------------------------------------------
148inline bool
150{
151 return this->committed;
152}
153
154} // namespace Db
155//------------------------------------------------------------------------------
156#endif
157
An attribute ID is used to carry attribute types (no values) around.
Definition attrid.h:20
AccessMode GetAccessMode() const
get access type
Definition attrid.h:304
const Util::FourCC & GetFourCC() const
get fourcc code
Definition attrid.h:293
const Util::String & GetName() const
get attribute name
Definition attrid.h:271
ValueType GetValueType() const
get value type
Definition attrid.h:315
Describes a column in a database table.
Definition column.h:23
Attr::AttrId attrId
Definition column.h:59
Type type
Definition column.h:60
bool committed
Definition column.h:61
bool IsCommitted() const
return true if the column has been sync'd with the database
Definition column.h:149
void SetAttrId(const Attr::AttrId &attrId)
set attribute id (overrides name, fourcc, type and access mode)
Definition column.h:68
Attr::AccessMode GetAccessMode() const
get column access mode
Definition column.h:113
Type
column types
Definition column.h:27
@ Primary
Definition column.h:29
@ Default
Definition column.h:28
@ Indexed
Definition column.h:30
void SetType(Type t)
set column type
Definition column.h:122
Column()
default constructor
Definition column.cc:14
void SetCommitted(bool b)
set to true when the column is in-sync with the database
Definition column.h:140
const Attr::AttrId & GetAttrId() const
get attribute id
Definition column.h:77
Type GetType() const
get column type
Definition column.h:131
const Util::FourCC & GetFourCC() const
get column fourcc
Definition column.h:95
const Util::String & GetName() const
get column name
Definition column.h:86
Attr::ValueType GetValueType() const
get column value type
Definition column.h:104
A four-character-code is a quasi-human-readable 32-bit-id.
Definition fourcc.h:19
ValueType
Definition valuetype.h:20
Definition column.cc:10
Nebula's universal string class.
Definition string.h:50