libUTL++
DBfield.h
1 #pragma once
2 
4 
5 #include <libutl/String.h>
6 
8 
9 UTL_NS_BEGIN;
10 
12 
18 {
27 };
28 
30 
38 
40 class DBfield : public Object
41 {
43 
44 public:
46  DBfield(const String& name, db_field_t type, uint_t size = uint_t_max);
47 
48  virtual void copy(const Object& rhs);
49 
50  virtual int compare(const Object& rhs) const;
51 
52  virtual void serialize(Stream& stream, uint_t io, uint_t mode = ser_default);
53 
55  void clear();
56 
58  const String&
59  name() const
60  {
61  return _name;
62  }
63 
65  String&
66  name()
67  {
68  return _name;
69  }
70 
73  type() const
74  {
75  return _type;
76  }
77 
79  db_field_t&
80  type()
81  {
82  return _type;
83  }
84 
86  uint_t
87  size() const
88  {
89  return _size;
90  }
91 
93  uint_t&
94  size()
95  {
96  return _size;
97  }
98 
99 private:
100  void
101  init()
102  {
103  _type = dbf_undefined;
104  }
105  void
106  deInit()
107  {
108  }
109 
110 private:
111  String _name;
112  db_field_t _type;
113  uint_t _size;
114 };
115 
117 
118 UTL_NS_END;
signed 64-bit integer.
Definition: DBfield.h:22
uint_t & size()
Get the size.
Definition: DBfield.h:94
const String & name() const
Get the name.
Definition: DBfield.h:59
void serialize(bool &b, Stream &stream, uint_t io, uint_t mode=ser_default)
Serialize a boolean.
void deInit()
De-initialize UTL++.
boolean.
Definition: DBfield.h:20
default representation (via getSerializeMode())
Definition: util.h:75
#define UTL_CLASS_DECL(DC, BC)
Declaration of standard UTL++ functionality for a non-template class.
Definition: macros.h:688
Character string.
Definition: String.h:31
String & name()
Get the name.
Definition: DBfield.h:66
void copy(T *dest, const T *src, size_t len)
Copy one array of objects to another.
Definition: util_inl.h:690
64-bit float.
Definition: DBfield.h:23
arbitrary-precision decimal.
Definition: DBfield.h:24
signed 32-bit integer.
Definition: DBfield.h:21
db_field_t type() const
Get the type.
Definition: DBfield.h:73
date and time.
Definition: DBfield.h:25
unsigned int uint_t
Unsigned integer.
Definition: types.h:59
const uint_t uint_t_max
Maximum uint_t value.
Stream I/O abstraction.
Definition: Stream.h:68
db_field_t & type()
Get the type.
Definition: DBfield.h:80
Field in a DBresult tuple.
Definition: DBfield.h:40
string
Definition: DBfield.h:19
undefined type.
Definition: DBfield.h:26
Root of UTL++ class hierarchy.
Definition: Object.h:52
int compare(bool lhs, bool rhs)
Compare two boolean values.
void init()
Initialize UTL++.
uint_t size() const
Get the size.
Definition: DBfield.h:87
db_field_t
Database field type.
Definition: DBfield.h:17