View source code Display the source code in std/datetime.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

std.datetime.enforce_valid - multiple declarations

Function enforceValid

Prototype

void enforceValid(string units)(
  int value,
  string file = __FILE__,
  size_t line = __LINE__
) pure @safe
if (units == "months" || units == "hours" || units == "minutes" || units == "seconds");

Parameters

NameDescription
units The units of time to validate.
value The number to validate.
file The file that the DateTimeException will list if thrown.
line The line number that the DateTimeException will list if thrown.

Throws

DateTimeException if valid!units(value) is false.

Function enforceValid

Prototype

void enforceValid(string units)(
  int year,
  Month month,
  int day,
  string file = __FILE__,
  size_t line = __LINE__
) pure @safe
if (units == "days");

Parameters

NameDescription
units The units of time to validate.
year The year of the day to validate.
month The month of the day to validate.
day The day to validate.
file The file that the DateTimeException will list if thrown.
line The line number that the DateTimeException will list if thrown.

Throws

DateTimeException if valid!"days"(year, month, day) is false.

Authors

Jonathan M Davis and Kato Shoichi

License

Boost License 1.0.

Comments