全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 ページ
btrDate.h
1 #ifndef BZS_DB_PROTOCOL_TDAP_BTRDATE_H
2 #define BZS_DB_PROTOCOL_TDAP_BTRDATE_H
3 /* =================================================================
4  Copyright (C) 2000-2013 BizStation Corp All rights reserved.
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19  02111-1307, USA.
20  ================================================================= */
21 #include <tchar.h>
22 #include <cstddef>
23 #include <bzs/env/compiler.h>
24 
25 
26 namespace bzs
27 {
28 namespace db
29 {
30 namespace protocol
31 {
32 namespace tdap
33 {
34 
35 #pragma pack(push, 1)
37 
38 #ifdef SWIG
39 /* For swig interface
40  export field names.
41 */
42 union btrDate
43 {
44  char dd;
45  char mm;
46  short yy;
47  int i;
48 };
49 
50 union btrTime
51 {
52  char uu;
53  char ss;
54  char nn;
55  char hh;
56  int i;
57 };
58 
59 union btrDateTime
60 {
61  btrTime time;
62  btrDate date;
63  __int64 i64;
64 };
65 
66 #else
67 
68 union btrDate
69 {
70  struct
71  {
72  char dd;
73  char mm;
74  short yy;
75  };
76 
77  int i;
78 };
79 
80 union btrTime
81 {
82  struct
83  {
84  char uu;
85  char ss;
86  char nn;
87  char hh;
88  };
89 
90  int i;
91 };
92 
94 {
95  struct
96  {
99  };
100 
101  __int64 i64;
102 };
103 
104 #endif // SWIG
105 
106 #pragma pack(pop)
108 
109 class PACKAGE btrTimeStamp
110 {
111 
112  __int64 getDateTimeInt(int& time);
113 
114 public:
115  unsigned __int64 i64;
116 
117  explicit btrTimeStamp(unsigned __int64 i);
118  explicit btrTimeStamp(const char* p);
120 #ifdef _WIN32
121  explicit btrTimeStamp(const wchar_t* p);
122  wchar_t* toString(wchar_t* retbuf);
123  void fromString(const wchar_t* p);
124 #endif
125  char* toString(char* retbuf);
126  void fromString(const char* p);
127 };
128 
129 // Class bdate is for btrDate
130 
131 class PACKAGE bdate
132 {
133  btrDate m_date;
134 
135 public:
136  explicit bdate(int btrDate);
137  explicit bdate(const _TCHAR* date);
138  const _TCHAR* year_str();
139  const _TCHAR* month_str();
140  const _TCHAR* date_str();
141 
142  int year() { return m_date.yy; };
143 
144  int date() { return m_date.dd; };
145 
146  int month() { return m_date.mm; };
147 
148  btrDate btr_date() { return m_date; };
149  const _TCHAR* c_str();
150 };
151 
152 PACKAGE btrDate atobtrd(const char* date);
153 
154 PACKAGE const char* btrdtoa(const btrDate& d, char* retbuf,
155  bool w3_format = false);
156 
157 PACKAGE const char* btrttoa(const btrTime& t, char* retbuf/*,
158  bool w3_format = false*/);
159 
160 PACKAGE btrTime atobtrt(const char* p);
161 
162 PACKAGE btrDateTime atobtrs(const char* p);
163 
164 PACKAGE const char* btrstoa(const btrDateTime& d, char* retbuf,
165  bool w3_format = false);
166 
167 inline const char* btrdtoa(int date, char* retbuf, bool w3_format = false)
168 {
169  btrDate d;
170  d.i = date;
171  return btrdtoa(d, retbuf, w3_format);
172 }
173 
174 inline const char* btrttoa(int time, char* retbuf/*, bool w3_format = false*/)
175 {
176  btrTime t;
177  t.i = time;
178  return btrttoa(t, retbuf/*, w3_format*/);
179 }
180 
181 inline const char* btrstoa(__int64 datetime, char* retbuf, bool w3_format = false)
182 {
183  btrDateTime t;
184  t.i64 = datetime;
185  return btrstoa(t, retbuf, w3_format);
186 }
187 
188 #ifndef SWIG
189 #ifdef _WIN32
190 PACKAGE btrDate atobtrd(const wchar_t* date);
191 
192 PACKAGE const wchar_t* btrdtoa(const btrDate& d, wchar_t* retbuf,
193  bool w3_format = false);
194 
195 PACKAGE const wchar_t* btrttoa(const btrTime& t, wchar_t* retbuf/*,
196  bool w3_format = false*/);
197 
198 PACKAGE btrTime atobtrt(const wchar_t* p);
199 
200 PACKAGE btrDateTime atobtrs(const wchar_t* p);
201 
202 PACKAGE const wchar_t* btrstoa(const btrDateTime& d, wchar_t* retbuf,
203  bool w3_format = false);
204 
205 inline const wchar_t* btrdtoa(int date, wchar_t* retbuf, bool w3_format = false)
206 {
207  btrDate d;
208  d.i = date;
209  return btrdtoa(d, retbuf, w3_format);
210 }
211 
212 inline const wchar_t* btrttoa(int time, wchar_t* retbuf/*, bool w3_format = false*/)
213 {
214  btrTime t;
215  t.i = time;
216  return btrttoa(t, retbuf/*, w3_format*/);
217 }
218 
219 inline const wchar_t* btrstoa(__int64 datetime, wchar_t* retbuf, bool w3_format = false)
220 {
221  btrDateTime t;
222  t.i64 = datetime;
223  return btrstoa(t, retbuf, w3_format);
224 }
225 
226 #endif
227 #endif
228 
229 
230 
231 
232 inline const _TCHAR* c_str(const btrDate& d)
233 {
234  return btrdtoa(d, (_TCHAR*)NULL);
235 }
236 
237 inline const _TCHAR* c_str(const btrTime& d)
238 {
239  return btrttoa(d, (_TCHAR*)NULL);
240 }
241 
242 inline const _TCHAR* c_str(const btrDateTime& d, bool w3_format = false)
243 {
244  return btrstoa(d, (_TCHAR*)NULL, w3_format);
245 }
246 
247 PACKAGE int getNowDate();
248 PACKAGE int getNowTime();
249 
250 } // namespace tdap
251 } // namespace protocol
252 } // namespace db
253 } // namespace bzs
254 #endif // BZS_DB_PROTOCOL_TDAP_BTRDATE_H
int date()
Definition: btrDate.h:144
char uu
Definition: btrDate.h:84
int i
Definition: btrDate.h:77
pragma_pop
Definition: btrDate.h:107
short yy
Definition: btrDate.h:74
btrDate btr_date()
Definition: btrDate.h:148
PACKAGE btrDateTime atobtrs(const char *p)
char ss
Definition: btrDate.h:85
char dd
Definition: btrDate.h:72
int year()
Definition: btrDate.h:142
__int64 i64
Definition: btrDate.h:101
PACKAGE const char * btrstoa(const btrDateTime &d, char *retbuf, bool w3_format=false)
PSQL形式の時刻型の共用体
Definition: btrDate.h:80
PSQL形式のタイムスタンプ型クラス
Definition: btrDate.h:109
PACKAGE const char * btrdtoa(const btrDate &d, char *retbuf, bool w3_format=false)
PACKAGE btrDate atobtrd(const char *date)
int i
Definition: btrDate.h:90
PSQL形式の日付型の共用体
Definition: btrDate.h:68
btrDate date
Definition: btrDate.h:98
char mm
Definition: btrDate.h:73
unsigned __int64 i64
Definition: btrDate.h:115
PACKAGE int getNowTime()
char hh
Definition: btrDate.h:87
btrTime time
Definition: btrDate.h:97
int month()
Definition: btrDate.h:146
char nn
Definition: btrDate.h:86
pragma_pack1
Definition: btrDate.h:36
PACKAGE const char * btrttoa(const btrTime &t, char *retbuf)
const _TCHAR * c_str(const btrDate &d)
Definition: btrDate.h:232
PACKAGE int getNowDate()
PSQL形式の日時型の共用体
Definition: btrDate.h:93
btrDate型の変換クラス
Definition: btrDate.h:131
PACKAGE btrTime atobtrt(const char *p)

Transactd SDK 2018年07月31日(火) 19時40分20秒 doxygen