draw.d,systemvariable.dを追加
This commit is contained in:
37
SMILEBASIC/systemvariable.d
Normal file
37
SMILEBASIC/systemvariable.d
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user