diff options
author | Pixel <Pixel> | 2002-10-31 23:20:34 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2002-10-31 23:20:34 +0000 |
commit | 419a05e177eb34815d6f8fad64654376805f1552 (patch) | |
tree | 70c91766c3014bbbbfe256c1dbeff470d43d0a12 /generic/String.cpp | |
parent | 0ecc8766fc348d3c35c7a34d9695461b8a485383 (diff) |
Bleh
Diffstat (limited to 'generic/String.cpp')
-rw-r--r-- | generic/String.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/generic/String.cpp b/generic/String.cpp index d879308..4c8e399 100644 --- a/generic/String.cpp +++ b/generic/String.cpp @@ -8,10 +8,12 @@ #include "config.h" #endif +#ifdef USE_DATE extern "C" { double dateCalc(char *, char *); int isDateArgument(char *); } +#endif char String::t[BUFSIZ + 1]; @@ -302,10 +304,12 @@ int String::strchrcnt(char c) const { return cnt; } +#ifdef USE_DATE String String::to_sqldate(void) const { /* DD/MM/YYYY ==> YYYYMMMDD */ return (is_date() ? extract(6, 9) + extract(3, 4) + extract(0, 1) : ""); } +#endif String String::to_sqltime(void) const { /* h:m ==> h * 60 + m */ @@ -313,10 +317,12 @@ String String::to_sqltime(void) const { return (is_time() ? String(extract(0, p - 1).to_int() * 60 + extract(p + 1).to_int()) : ""); } +#ifdef USE_DATE String String::from_sqldate(void) const { /* YYYYMMDD ==> DD/MM/YYYY */ return ((strlen() == 8) && is_number() ? extract(6, 7) + '/' + extract(4, 5) + '/' + extract(0, 3) : ""); } +#endif String String::from_sqltime(void) const { /* t ==> (t / 60):(t % 60) */ @@ -324,6 +330,7 @@ String String::from_sqltime(void) const { return (is_number() ? String((int) (t / 60)) + ':' + (t % 60) : ""); } +#ifdef USE_DATE bool String::is_date(void) const { /* 'DD/MM/YYYY' 0123456789 */ @@ -348,6 +355,7 @@ double String::datedif(const String & s) const { return -1; } +#endif bool String::is_number(void) const { for (size_t i = ((str[0] == '-') ? 1 : 0); i < siz; i++) { |