29 #if !defined(MYSQLPP_DATETIME_H) 
   30 #define MYSQLPP_DATETIME_H 
   72         DateTime(
unsigned short y, 
unsigned char mon, 
unsigned char d,
 
   73                         unsigned char h, 
unsigned char min, 
unsigned char s) :
 
   92         minute_(other.minute_),
 
   93         second_(other.second_),
 
  103         explicit DateTime(
const char* str) { convert(str); }
 
  115                 convert(str.c_str());
 
  125         int compare(
const DateTime& other) 
const;
 
  128         const char* convert(
const char*);
 
  131         unsigned char day()
 const { 
return day_; }
 
  134         void day(
unsigned char d) { day_ = d; now_ = 
false; }
 
  137         unsigned char hour()
 const { 
return hour_; }
 
  140         void hour(
unsigned char h) { hour_ = h; now_ = 
false; }
 
  147         unsigned char minute()
 const { 
return minute_; }
 
  150         void minute(
unsigned char m) { minute_ = m; now_ = 
false; }
 
  153         unsigned char month()
 const { 
return month_; }
 
  156         void month(
unsigned char m) { month_ = m; now_ = 
false; }
 
  165         operator std::string() 
const;
 
  168         operator time_t() 
const;
 
  171         unsigned char second()
 const { 
return second_; }
 
  174         void second(
unsigned char s) { second_ = s; now_ = 
false; }
 
  177         std::string 
str()
 const { 
return *
this; }
 
  184         unsigned short year()
 const { 
return year_; }
 
  190         void year(
unsigned short y) { year_ = y; now_ = 
false; }
 
  193         unsigned short year_;   
 
  194         unsigned char month_;   
 
  197         unsigned char minute_;  
 
  198         unsigned char second_;  
 
  206 inline DateTime NOW() { 
return DateTime(); }
 
  217 MYSQLPP_EXPORT std::ostream& operator <<(std::ostream& os,
 
  229         Date() : year_(0), month_(0), day_(0) { }
 
  236         Date(
unsigned short y, 
unsigned char m, 
unsigned char d) :
 
  248         month_(other.month_),
 
  257         month_(other.month()),
 
  266         explicit Date(
const char* str) { convert(str); }
 
  275         explicit Date(
const Str& str) { convert(str.c_str()); }
 
  281         explicit Date(time_t t);
 
  287         int compare(
const Date& other) 
const;
 
  290         const char* convert(
const char*);
 
  293         unsigned char day()
 const { 
return day_; }
 
  296         void day(
unsigned char d) { day_ = d; }
 
  299         unsigned char month()
 const { 
return month_; }
 
  302         void month(
unsigned char m) { month_ = m; }
 
  305         operator std::string() 
const;
 
  310         operator time_t() 
const;
 
  313         std::string 
str()
 const { 
return *
this; }
 
  319         unsigned short year()
 const { 
return year_; }
 
  325         void year(
unsigned short y) { year_ = y; }
 
  328         unsigned short year_;   
 
  329         unsigned char month_;   
 
  339 MYSQLPP_EXPORT std::ostream& operator <<(std::ostream& os,
 
  351         Time() : hour_(0), minute_(0), second_(0) { }
 
  357         Time(
unsigned char h, 
unsigned char m, 
unsigned char s) :
 
  368         minute_(other.minute_),
 
  369         second_(other.second_)
 
  377         minute_(other.minute()),
 
  378         second_(other.second())
 
  387         explicit Time(
const char* str) { convert(str); }
 
  397         explicit Time(
const Str& str) { convert(str.c_str()); }
 
  403         explicit Time(time_t t);
 
  409         int compare(
const Time& other) 
const;
 
  412         const char* convert(
const char*);
 
  415         unsigned char hour()
 const { 
return hour_; }
 
  418         void hour(
unsigned char h) { hour_ = h; }
 
  421         unsigned char minute()
 const { 
return minute_; }
 
  424         void minute(
unsigned char m) { minute_ = m; }
 
  427         operator std::string() 
const;
 
  432         operator time_t() 
const;
 
  435         unsigned char second()
 const { 
return second_; }
 
  438         void second(
unsigned char s) { second_ = s; }
 
  441         std::string 
str()
 const { 
return *
this; }
 
  445         unsigned char minute_;  
 
  446         unsigned char second_;  
 
  456 MYSQLPP_EXPORT std::ostream& operator <<(std::ostream& os,
 
  462 #endif // !defined(MYSQLPP_DATETIME_H) 
Time(const Str &str)
Initialize object from a C++ string containing a SQL time string. 
Definition: datetime.h:397
std::string str() const 
Return our value in std::string form. 
Definition: datetime.h:313
void hour(unsigned char h)
Change the date/time value's hour part, 0-23. 
Definition: datetime.h:140
Time(const Time &other)
Initialize object as a copy of another Time. 
Definition: datetime.h:365
Time(const char *str)
Initialize object from a C string containing a SQL time string. 
Definition: datetime.h:387
void day(unsigned char d)
Change the date's day part, 1-31. 
Definition: datetime.h:296
DateTime(unsigned short y, unsigned char mon, unsigned char d, unsigned char h, unsigned char min, unsigned char s)
Initialize object from discrete y/m/d h:m:s values. 
Definition: datetime.h:72
Date(const Str &str)
Initialize object from a C++ string containing a date. 
Definition: datetime.h:275
Time(const DateTime &other)
Initialize object from time part of date/time object. 
Definition: datetime.h:374
Declares the Comparable<T> mixin. 
unsigned char month() const 
Get the date's month part, 1-12. 
Definition: datetime.h:299
DateTime(const DateTime &other)
Initialize object as a copy of another Date. 
Definition: datetime.h:86
C++ form of SQL's TIME type. 
Definition: datetime.h:347
C++ form of SQL's DATETIME type. 
Definition: datetime.h:48
unsigned char hour() const 
Get the date/time value's hour part, 0-23. 
Definition: datetime.h:137
Time(unsigned char h, unsigned char m, unsigned char s)
Initialize object. 
Definition: datetime.h:357
void year(unsigned short y)
Change the date/time value's year part. 
Definition: datetime.h:190
Date(unsigned short y, unsigned char m, unsigned char d)
Initialize object. 
Definition: datetime.h:236
Date(const DateTime &other)
Initialize object from date part of date/time object. 
Definition: datetime.h:254
Mix-in that gives its subclass a full set of comparison operators. 
Definition: comparable.h:40
void second(unsigned char s)
Change the date/time value's second part, 0-59. 
Definition: datetime.h:174
unsigned char second() const 
Get the date/time value's second part, 0-59. 
Definition: datetime.h:171
unsigned char day() const 
Get the date's day part, 1-31. 
Definition: datetime.h:293
unsigned char minute() const 
Get the date/time value's minute part, 0-59. 
Definition: datetime.h:147
void month(unsigned char m)
Change the date/time value's month part, 1-12. 
Definition: datetime.h:156
bool is_now() const 
Returns true if object will evaluate to SQL "NOW()" on conversion to string. 
Definition: datetime.h:144
DateTime(const Str &str)
Initialize object from a C++ string containing a SQL date-and-time string. 
Definition: datetime.h:113
void second(unsigned char s)
Change the time's second part, 0-59. 
Definition: datetime.h:438
std::string str() const 
Return our value in std::string form. 
Definition: datetime.h:177
Time()
Default constructor. 
Definition: datetime.h:351
void day(unsigned char d)
Change the date/time value's day part, 1-31. 
Definition: datetime.h:134
Date()
Default constructor. 
Definition: datetime.h:229
void year(unsigned short y)
Change the date's year part. 
Definition: datetime.h:325
unsigned char day() const 
Get the date/time value's day part, 1-31. 
Definition: datetime.h:131
unsigned short year() const 
Get the date's year part. 
Definition: datetime.h:319
unsigned char month() const 
Get the date/time value's month part, 1-12. 
Definition: datetime.h:153
C++ form of SQL's DATE type. 
Definition: datetime.h:225
void minute(unsigned char m)
Change the date/time value's minute part, 0-59. 
Definition: datetime.h:150
unsigned short year() const 
Get the date/time value's year part. 
Definition: datetime.h:184
void month(unsigned char m)
Change the date's month part, 1-12. 
Definition: datetime.h:302
This file includes top-level definitions for use both internal to the library, and outside it...
unsigned char minute() const 
Get the time's minute part, 0-59. 
Definition: datetime.h:421
unsigned char hour() const 
Get the time's hour part, 0-255. 
Definition: datetime.h:415
void minute(unsigned char m)
Change the time's minute part, 0-59. 
Definition: datetime.h:424
unsigned char second() const 
Get the time's second part, 0-59. 
Definition: datetime.h:435
void hour(unsigned char h)
Change the time's hour part, 0-255. 
Definition: datetime.h:418
Date(const char *str)
Initialize object from a C string containing a date. 
Definition: datetime.h:266
DateTime(const char *str)
Initialize object from a C string containing a SQL date-and-time string. 
Definition: datetime.h:103
DateTime()
Default constructor. 
Definition: datetime.h:52
std::string str() const 
Return our value in std::string form. 
Definition: datetime.h:441
Date(const Date &other)
Initialize object as a copy of another Date. 
Definition: datetime.h:245
static DateTime now()
Factory to create an object instance that will convert to SQL "NOW()" on insertion into a query...
Definition: datetime.h:162