mirror of
https://github.com/dlang/phobos.git
synced 2025-05-06 11:07:39 +03:00
Various adjustments to the documentation in std.datetime and std.file.
This should fix the current ddoc build errors or Windows.
This commit is contained in:
parent
a474a386d4
commit
11f2899ab5
2 changed files with 10470 additions and 10642 deletions
20976
std/datetime.d
20976
std/datetime.d
File diff suppressed because it is too large
Load diff
120
std/file.d
120
std/file.d
|
@ -145,73 +145,81 @@ version (Posix)
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
/***********************************
|
|
||||||
* Exception thrown for file I/O errors.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/++
|
||||||
|
Exception thrown for file I/O errors.
|
||||||
|
+/
|
||||||
class FileException : Exception
|
class FileException : Exception
|
||||||
{
|
{
|
||||||
/**
|
/++
|
||||||
OS error code.
|
OS error code.
|
||||||
*/
|
+/
|
||||||
immutable uint errno;
|
immutable uint errno;
|
||||||
|
|
||||||
/**
|
/++
|
||||||
Constructor taking the name of the file where error happened and a
|
Constructor which takes an error message.
|
||||||
message describing the error.
|
|
||||||
*/
|
Params:
|
||||||
this(in char[] name, in char[] message)
|
name = Name of file for which the error occurred.
|
||||||
|
msg = Message describing the error.
|
||||||
|
file = The file where the error occurred.
|
||||||
|
line = The line where the error occurred.
|
||||||
|
+/
|
||||||
|
this(in char[] name, in char[] msg, string file = __FILE__, size_t line = __LINE__)
|
||||||
{
|
{
|
||||||
super(text(name, ": ", message));
|
if(msg.empty)
|
||||||
|
super(name.idup, file, line);
|
||||||
|
else
|
||||||
|
super(text(name, ": ", msg), file, line);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this(in char[] name, in char[] message, string sourceFile, int sourceLine)
|
/++
|
||||||
{
|
Constructor which takes the error number ($(LUCKY GetLastError)
|
||||||
super(text(name, ": ", message), sourceFile, sourceLine);
|
in Windows, $(D_PARAM getErrno) in Posix).
|
||||||
errno = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
Params:
|
||||||
Constructor taking the name of the file where error happened and the
|
name = Name of file for which the error occurred.
|
||||||
error number ($(LUCKY GetLastError) in Windows, $(D getErrno) in
|
msg = Message describing the error.
|
||||||
Posix).
|
file = The file where the error occurred.
|
||||||
*/
|
line = The line where the error occurred.
|
||||||
version(Windows) this(in char[] name, uint errno = GetLastError)
|
+/
|
||||||
|
version(Windows) this(in char[] name,
|
||||||
|
uint errno = GetLastError,
|
||||||
|
string file = __FILE__,
|
||||||
|
size_t line = __LINE__)
|
||||||
{
|
{
|
||||||
this(name, sysErrorString(errno));
|
this(name, sysErrorString(errno), file, line);
|
||||||
this.errno = errno;
|
this.errno = errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
version(Posix) this(in char[] name, uint errno = .getErrno)
|
/++
|
||||||
|
Constructor which takes the error number ($(LUCKY GetLastError)
|
||||||
|
in Windows, $(D_PARAM getErrno) in Posix).
|
||||||
|
|
||||||
|
Params:
|
||||||
|
name = Name of file for which the error occurred.
|
||||||
|
msg = Message describing the error.
|
||||||
|
file = The file where the error occurred.
|
||||||
|
line = The line where the error occurred.
|
||||||
|
+/
|
||||||
|
version(Posix) this(in char[] name,
|
||||||
|
uint errno = .getErrno,
|
||||||
|
string file = __FILE__,
|
||||||
|
size_t line = __LINE__)
|
||||||
{
|
{
|
||||||
auto s = strerror(errno);
|
auto s = strerror(errno);
|
||||||
this(name, to!string(s));
|
this(name, to!string(s), file, line);
|
||||||
this.errno = errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
version(Windows) this(in char[] name, string sourceFile, int sourceLine,
|
|
||||||
uint errno = GetLastError)
|
|
||||||
{
|
|
||||||
this(name, sysErrorString(errno), sourceFile, sourceLine);
|
|
||||||
this.errno = errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
version(Posix) this(in char[] name, string sourceFile, int sourceLine,
|
|
||||||
uint errno = .getErrno)
|
|
||||||
{
|
|
||||||
auto s = strerror(errno);
|
|
||||||
this(name, to!string(s), sourceFile, sourceLine);
|
|
||||||
this.errno = errno;
|
this.errno = errno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private T cenforce(T, string file = __FILE__, uint line = __LINE__)
|
private T cenforce(T)(T condition, lazy const(char)[] name, string file = __FILE__, size_t line = __LINE__)
|
||||||
(T condition, lazy const(char)[] name)
|
|
||||||
{
|
{
|
||||||
if (!condition)
|
if (!condition)
|
||||||
{
|
{
|
||||||
throw new FileException(name, file, line);
|
throw new FileException(name, "", file, line);
|
||||||
}
|
}
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
@ -632,7 +640,7 @@ else
|
||||||
version(D_Ddoc)
|
version(D_Ddoc)
|
||||||
{
|
{
|
||||||
/++
|
/++
|
||||||
$(YELLOW This function is Windows-Only.)
|
$(BLUE This function is Windows-Only.)
|
||||||
|
|
||||||
Get creation/access/modified times of file $(D name).
|
Get creation/access/modified times of file $(D name).
|
||||||
|
|
||||||
|
@ -656,7 +664,7 @@ version(D_Ddoc)
|
||||||
|
|
||||||
|
|
||||||
/++
|
/++
|
||||||
$(YELLOW This function is Posix-Only.)
|
$(BLUE This function is Posix-Only.)
|
||||||
|
|
||||||
Get file status change time, acces time, and modification times
|
Get file status change time, acces time, and modification times
|
||||||
of file $(D name).
|
of file $(D name).
|
||||||
|
@ -1794,7 +1802,7 @@ assert(!de2.isFile);
|
||||||
@property d_time creationTime() const;
|
@property d_time creationTime() const;
|
||||||
|
|
||||||
/++
|
/++
|
||||||
$(YELLOW This function is Windows-Only.)
|
$(BLUE This function is Windows-Only.)
|
||||||
|
|
||||||
Returns the creation time of the file represented by this DirEntry.
|
Returns the creation time of the file represented by this DirEntry.
|
||||||
+/
|
+/
|
||||||
|
@ -1802,7 +1810,7 @@ assert(!de2.isFile);
|
||||||
|
|
||||||
|
|
||||||
/++
|
/++
|
||||||
$(YELLOW This function is Posix-Only.)
|
$(BLUE This function is Posix-Only.)
|
||||||
|
|
||||||
Returns the last time that the status of file represented by this DirEntry
|
Returns the last time that the status of file represented by this DirEntry
|
||||||
was changed (i.e. owner, group, link count, mode, etc.).
|
was changed (i.e. owner, group, link count, mode, etc.).
|
||||||
|
@ -1863,8 +1871,10 @@ assert(!de2.isFile);
|
||||||
+/
|
+/
|
||||||
@property uint linkAttributes();
|
@property uint linkAttributes();
|
||||||
|
|
||||||
|
version(Windows) alias void* struct_stat64;
|
||||||
|
|
||||||
/++
|
/++
|
||||||
$(YELLOW This function is Posix-Only.)
|
$(BLUE This function is Posix-Only.)
|
||||||
|
|
||||||
The stat struct gotten from calling stat.
|
The stat struct gotten from calling stat.
|
||||||
+/
|
+/
|
||||||
|
@ -2458,16 +2468,18 @@ version(Posix) void copy(in char[] from, in char[] to)
|
||||||
|
|
||||||
version(D_Ddoc)
|
version(D_Ddoc)
|
||||||
{
|
{
|
||||||
/*************************
|
/++
|
||||||
$(RED Scheduled for deprecation. Please use the version which takes
|
$(RED Scheduled for deprecation. Please use the version which takes
|
||||||
std.datetime.SysTime instead).
|
std.datetime.SysTime instead).
|
||||||
|
|
||||||
Set access/modified times of file $(D name).
|
Set access/modified times of file $(D_PARAM name).
|
||||||
Throws: $(D FileException) on error.
|
|
||||||
*/
|
Throws:
|
||||||
|
$(D_PARAM FileException) on error.
|
||||||
|
+/
|
||||||
void setTimes(in char[] name, d_time fta, d_time ftm);
|
void setTimes(in char[] name, d_time fta, d_time ftm);
|
||||||
}
|
}
|
||||||
version(Windows)
|
else
|
||||||
{
|
{
|
||||||
void setTimes(C)(in C[] name, d_time fta, d_time ftm)
|
void setTimes(C)(in C[] name, d_time fta, d_time ftm)
|
||||||
if(is(Unqual!C == char))
|
if(is(Unqual!C == char))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue