Whitespace changes.
This commit is contained in:
parent
7af0292fd4
commit
1d81148aef
|
@ -29,6 +29,58 @@ import dyaml.exception;
|
||||||
|
|
||||||
package:
|
package:
|
||||||
|
|
||||||
|
//XXX VIM STUFF:
|
||||||
|
//XXX THE f/t COLORING PLUGIN, AND TRY TO REMOVE THE f/t AUTOREPEAT PLUGIN
|
||||||
|
// (AND MAYBE DO THE REPEAT WITH ALT-T/ALT-F
|
||||||
|
//XXX DDOC snippets such as $D, $BIGOH, anything else
|
||||||
|
// OR MAYBE JUST $ - EXPANDING TO $(${1} ${2})
|
||||||
|
// WHERE DEFAULT ${1} IS 'D' AND SPECIAL SNIPPETS FOR SPECIFIC DDOC MACROS
|
||||||
|
// (E.G. XREF HAS 2 ARGS)
|
||||||
|
// XXX DON'T FORGET TO COMMIT DSNIPS CHANGES
|
||||||
|
// XXX SNIPPETS: WHY CAN'T WE USE NEW IN NEW? FIX!
|
||||||
|
// XXX ALSO WRITELN VISUAL! (print whatever we have selected)
|
||||||
|
// XXX AND ``fun`` VISUAL TOO!
|
||||||
|
// XXX snippet to print variable along its name AND
|
||||||
|
// OR MULTIPLE VARS - USE std.format!
|
||||||
|
|
||||||
|
|
||||||
|
// XXX XXX XXX START COMMITTING STUFF HERE
|
||||||
|
|
||||||
|
/+5: /// Description+/
|
||||||
|
ubyte[] streamToBytesGC(Stream stream) @trusted
|
||||||
|
{
|
||||||
|
ubyte[] storage = new ubyte[stream.available];
|
||||||
|
return stream.streamToBytes(storage);
|
||||||
|
}
|
||||||
|
/+5: /// Description+/
|
||||||
|
///
|
||||||
|
/// Params:
|
||||||
|
///
|
||||||
|
/// stream =
|
||||||
|
/// memory = Memory to use. Must be long enough to store the entire stream
|
||||||
|
/// (memory.length >= stream.available).
|
||||||
|
///
|
||||||
|
/// Returns: A slice of memory containing all contents of the stream on success.
|
||||||
|
/// NULL if unable to read the entire stream.
|
||||||
|
ubyte[] streamToBytes(Stream stream, ubyte[] memory) @system
|
||||||
|
{
|
||||||
|
assert(memory.length >= stream.available, "Not enough memory passed to streamToBytes");
|
||||||
|
auto buffer = memory[0 .. stream.available];
|
||||||
|
size_t bytesRead = 0;
|
||||||
|
for(; bytesRead < buffer.length;)
|
||||||
|
{
|
||||||
|
// Returns 0 on eof
|
||||||
|
const bytes = stream.readBlock(&buffer[bytesRead], buffer.length - bytesRead);
|
||||||
|
// Reached EOF before reading buffer.length bytes.
|
||||||
|
if(bytes == 0) { return null; }
|
||||||
|
bytesRead += bytes;
|
||||||
|
}
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///Exception thrown at Reader errors.
|
///Exception thrown at Reader errors.
|
||||||
class ReaderException : YAMLException
|
class ReaderException : YAMLException
|
||||||
{
|
{
|
||||||
|
@ -471,7 +523,7 @@ struct UTFBlockDecoder(size_t bufferSize_) if (bufferSize_ % 2 == 0)
|
||||||
@property size_t maxChars() const pure @safe nothrow @nogc { return maxChars_; }
|
@property size_t maxChars() const pure @safe nothrow @nogc { return maxChars_; }
|
||||||
|
|
||||||
/// Get encoding we're decoding from.
|
/// Get encoding we're decoding from.
|
||||||
@property Encoding encoding() const pure @safe nothrow @nogc { return encoding_; }
|
@property UTFEncoding encoding() const pure @safe nothrow @nogc { return encoding_; }
|
||||||
|
|
||||||
/// Are we done decoding?
|
/// Are we done decoding?
|
||||||
@property bool done() const pure @safe nothrow @nogc
|
@property bool done() const pure @safe nothrow @nogc
|
||||||
|
|
Loading…
Reference in a new issue