全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド ページ
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 
22 #include <bzs/env/compiler.h>
23 #include <bzs/env/crosscompile.h>
24 
25 namespace bzs
26 {
27 namespace db
28 {
29 namespace protocol
30 {
31 namespace tdap
32 {
33 
34 #pragma pack(push, 1)
36 
37 #ifdef SWIG
38 /* For swig interface
39  export field names.
40 */
41 union btrDate
42 {
43  char dd;
44  char mm;
45  short yy;
46  int i;
47 };
48 
49 union btrTime
50 {
51  char uu;
52  char ss;
53  char nn;
54  char hh;
55  int i;
56 };
57 
58 union btrDateTime
59 {
60  btrTime time;
61  btrDate date;
62  __int64 i64;
63 };
64 
65 #else
66 
67 union btrDate
68 {
69  struct
70  {
71  char dd;
72  char mm;
73  short yy;
74  };
75 
76  int i;
77 };
78 
79 union btrTime
80 {
81  struct
82  {
83  char uu;
84  char ss;
85  char nn;
86  char hh;
87  };
88 
89  int i;
90 };
91 
93 {
94  struct
95  {
98  };
99 
100  __int64 i64;
101 };
102 
103 #endif // SWIG
104 
105 #pragma pack(pop)
107 
108 class PACKAGE btrTimeStamp
109 {
110 
111  __int64 getDateTimeInt(int& time);
112 
113 public:
114  unsigned __int64 i64;
115 
116  explicit btrTimeStamp(unsigned __int64 i);
117  explicit btrTimeStamp(const char* p);
119 #ifdef _WIN32
120  explicit btrTimeStamp(const wchar_t* p);
121  wchar_t* toString(wchar_t* retbuf);
122  void fromString(const wchar_t* p);
123 #endif
124  char* toString(char* retbuf);
125  void fromString(const char* p);
126 };
127 
128 // Class bdate is for btrDate
129 
130 class PACKAGE bdate
131 {
132  btrDate m_date;
133 
134 public:
135  explicit bdate(int btrDate);
136  explicit bdate(const _TCHAR* date);
137  const _TCHAR* year_str();
138  const _TCHAR* month_str();
139  const _TCHAR* date_str();
140 
141  int year() { return m_date.yy; };
142 
143  int date() { return m_date.dd; };
144 
145  int month() { return m_date.mm; };
146 
147  btrDate btr_date() { return m_date; };
148  const _TCHAR* c_str();
149 };
150 
151 PACKAGE btrDate atobtrd(const char* date);
152 
153 PACKAGE const char* btrdtoa(const btrDate& d, char* retbuf,
154  bool type_vb = false);
155 
156 PACKAGE const char* btrttoa(const btrTime& t, char* retbuf,
157  bool type_vb = false);
158 
159 PACKAGE btrTime atobtrt(const char* p);
160 
161 inline const char* btrdtoa(int date, char* retbuf, bool type_vb = false)
162 {
163  btrDate d;
164  d.i = date;
165  return btrdtoa(d, retbuf, type_vb);
166 }
167 
168 inline const char* btrttoa(int time, char* retbuf, bool type_vb = false)
169 {
170  btrTime t;
171  t.i = time;
172  return btrttoa(t, retbuf, type_vb);
173 }
174 
175 #ifdef _WIN32
176 PACKAGE btrDate atobtrd(const wchar_t* date);
177 
178 PACKAGE const wchar_t* btrdtoa(const btrDate& d, wchar_t* retbuf,
179  bool type_vb = false);
180 
181 PACKAGE const wchar_t* btrttoa(const btrTime& t, wchar_t* retbuf,
182  bool type_vb = false);
183 
184 PACKAGE btrTime atobtrt(const wchar_t* p);
185 
186 inline const wchar_t* btrdtoa(int date, wchar_t* retbuf, bool type_vb = false)
187 {
188  btrDate d;
189  d.i = date;
190  return btrdtoa(d, retbuf, type_vb);
191 }
192 
193 inline const wchar_t* btrttoa(int time, wchar_t* retbuf, bool type_vb = false)
194 {
195  btrTime t;
196  t.i = time;
197  return btrttoa(t, retbuf, type_vb);
198 }
199 
200 #endif
201 
202 PACKAGE const _TCHAR* btrstoa(const btrDateTime& d, _TCHAR* retbuf = NULL,
203  bool type_vb = false);
204 
205 PACKAGE btrDateTime atobtrs(const _TCHAR* p);
206 
207 inline const _TCHAR* c_str(const btrDate& d)
208 {
209  return btrdtoa(d, (_TCHAR*)NULL);
210 }
211 
212 inline const _TCHAR* c_str(const btrTime& d)
213 {
214  return btrttoa(d, (_TCHAR*)NULL);
215 }
216 
217 inline const _TCHAR* c_str(const btrDateTime& d, bool type_vb = false)
218 {
219  return btrstoa(d, (_TCHAR*)NULL, type_vb);
220 }
221 
222 PACKAGE int getNowDate();
223 PACKAGE int getNowTime();
224 
225 } // namespace tdap
226 } // namespace protocol
227 } // namespace db
228 } // namespace bzs
229 #endif // BZS_DB_PROTOCOL_TDAP_BTRDATE_H
int date()
Definition: btrDate.h:143
const _TCHAR * protocol(const _TCHAR *uri)
Definition: uri.h:42
char uu
Definition: btrDate.h:83
int i
Definition: btrDate.h:76
pragma_pop
Definition: btrDate.h:106
short yy
Definition: btrDate.h:73
PACKAGE const char * btrdtoa(const btrDate &d, char *retbuf, bool type_vb=false)
btrDate btr_date()
Definition: btrDate.h:147
PACKAGE const _TCHAR * btrstoa(const btrDateTime &d, _TCHAR *retbuf=NULL, bool type_vb=false)
char ss
Definition: btrDate.h:84
char dd
Definition: btrDate.h:71
int year()
Definition: btrDate.h:141
__int64 i64
Definition: btrDate.h:100
PSQL形式の時刻型の共用体
Definition: btrDate.h:79
PSQL形式のタイムスタンプ型クラス
Definition: btrDate.h:108
PACKAGE btrDateTime atobtrs(const _TCHAR *p)
PACKAGE btrDate atobtrd(const char *date)
int i
Definition: btrDate.h:89
PACKAGE const char * btrttoa(const btrTime &t, char *retbuf, bool type_vb=false)
PSQL形式の日付型の共用体
Definition: btrDate.h:67
btrDate date
Definition: btrDate.h:97
char mm
Definition: btrDate.h:72
unsigned __int64 i64
Definition: btrDate.h:114
PACKAGE int getNowTime()
char hh
Definition: btrDate.h:86
btrTime time
Definition: btrDate.h:96
int month()
Definition: btrDate.h:145
char nn
Definition: btrDate.h:85
pragma_pack1
Definition: btrDate.h:35
const _TCHAR * c_str(const btrDate &d)
Definition: btrDate.h:207
PACKAGE int getNowDate()
PSQL形式の日時型の共用体
Definition: btrDate.h:92
btrDate型の変換クラス
Definition: btrDate.h:130
PACKAGE btrTime atobtrt(const char *p)

Transactd SDK 2015年09月08日(火) 19時13分35秒 doxygen