Sourceutils.d
Documentationhttps://dlang.org/phobos/dmd_utils.html
toWinPath(const(char)*src);const(char)*src | Source path, using unix-style ('/') path separators |
readFile(Locloc, const(char)[]filename, ref OutBufferbuf);Locloc | The line number information from where the call originates |
const(char)[]filename | Path to file |
OutBufferbuf | append contents of file to |
writeFile(Locloc, const(char)[]filename, const void[]data);Locloc | The line number information from where the call originates |
const(char)[]filename | Path to file |
void[]data | Full content of the file to be written |
ensurePathToNameExists(Locloc, const(char)[]name);Locloc | The line number information from where the call originates |
const(char)[]name | a path to check (the name is stripped) |
escapePath(OutBuffer*buf, const(char)*fname);OutBuffer*buf | Buffer to write the escaped path to |
const(char)*fname | Path to escape |
parseDigits(T)(ref Tval, const(char)[]p, const Tmax = T.max);| T | Type of integer to parse |
Tval | Variable to store the result in |
const(char)[]p | slice to start of string digits |
Tmax | max allowable value (inclusive), defaults toT.max |
byte b;ubyte ub;short s;ushort us;int i;uint ui;long l;ulong ul;assert(b.parseDigits("42") && b == 42);assert(ub.parseDigits("42") && ub == 42);assert(s.parseDigits("420") && s == 420);assert(us.parseDigits("42000") && us == 42_000);assert(i.parseDigits("420000") && i == 420_000);assert(ui.parseDigits("420000") && ui == 420_000);assert(l.parseDigits("42000000000") && l == 42_000_000_000);assert(ul.parseDigits("82000000000") && ul == 82_000_000_000);assert(!b.parseDigits(ubyte.max.stringof));assert(!b.parseDigits("WYSIWYG"));assert(!b.parseDigits("-42"));assert(!b.parseDigits("200"));assert(ub.parseDigits("200") && ub == 200);assert(i.parseDigits(int.max.stringof) && i ==int.max);assert(i.parseDigits("420", 500) && i == 420);assert(!i.parseDigits("420", 400));
arrayCastBigEndian(const ubyte[]data, size_tsize);ubyte[]data | array with big endian data |
size_tsize | 1 for ubyte[], 2 for ushort[], 4 for uint[], 8 for ulong[] |
data, with bytes shuffled if compiled forversion(LittleEndian)