1
0

draw.d,systemvariable.dを追加

This commit is contained in:
otya128
2015-08-20 15:30:34 +09:00
parent b589766d47
commit e02fd58838
2 changed files with 137 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
module otya.smilebasic.systemvariable;
import otya.smilebasic.type;
import otya.smilebasic.error;
class SystemVariable
{
@property
abstract Value value();
@property
void value(Value value)
{
throw new TypeMismatch();
}
}
import std.datetime;
import std.string;
import std.conv;
class Date : SystemVariable
{
@property
override Value value()
{
auto currentTime = Clock.currTime();
wstring timeString = format("%04d/%02d/%02d", currentTime.year, currentTime.month, currentTime.day).to!wstring;
return Value(timeString);
}
}
class Time : SystemVariable
{
@property
override Value value()
{
auto currentTime = Clock.currTime();
wstring timeString = format("%02d:%02d:%02d", currentTime.hour, currentTime.minute, currentTime.second).to!wstring;
return Value(timeString);
}
}