mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: ConvertDate::Truncate, StdConvertDateTruncate
git-svn-id: svn://ultimatepp.org/upp/trunk@2048 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
bb3b1dd6c5
commit
5df7551396
2 changed files with 25 additions and 1 deletions
|
|
@ -382,12 +382,21 @@ ConvertDouble::~ConvertDouble() {}
|
|||
ConvertDate::ConvertDate(Date minval, Date maxval, bool notnull)
|
||||
: minval(minval), maxval(maxval), notnull(notnull) {
|
||||
defaultval = Null;
|
||||
truncate = false;
|
||||
}
|
||||
|
||||
ConvertDate::~ConvertDate()
|
||||
{
|
||||
}
|
||||
|
||||
Value ConvertDate::Format(const Value& q) const
|
||||
{
|
||||
if(truncate && IsDateTime(q))
|
||||
return Convert::Format((Date)q);
|
||||
return Convert::Format(q);
|
||||
}
|
||||
|
||||
|
||||
Value ConvertDate::Scan(const Value& text) const {
|
||||
Value v = UPP::Scan(DATE_V, text, defaultval);
|
||||
if(IsError(v)) return v;
|
||||
|
|
@ -473,6 +482,17 @@ GLOBAL_VARP_INIT(const ConvertTime, StdConvertTimeNotNull, (Null, Null, true))
|
|||
GLOBAL_VAR_INIT(const ConvertString, StdConvertString);
|
||||
GLOBAL_VARP_INIT(const ConvertString, StdConvertStringNotNull, (INT_MAX, true))
|
||||
|
||||
const ConvertDate& StdConvertDateTruncated()
|
||||
{
|
||||
static ConvertDate *cv;
|
||||
ONCELOCK {
|
||||
static ConvertDate cvd;
|
||||
cvd.Truncate();
|
||||
cv = &cvd;
|
||||
}
|
||||
return *cv;
|
||||
}
|
||||
|
||||
Value MapConvert::Format(const Value& q) const {
|
||||
return map.Get(q, Null);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue