1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00

Comentários em BinaryWriter

This commit is contained in:
Danilo 2024-05-28 21:24:27 -03:00
parent ebcb31d9a7
commit 0f9c710b71

View File

@ -84,11 +84,21 @@ namespace xna {
//A simplified port of the BinaryWriter class.
class BinaryWriter {
public:
BinaryWriter(sptr<Stream> const& stream) : _stream(stream), _buffer(16) {
BinaryWriter(sptr<Stream> const& stream) {
if (!stream)
throw std::invalid_argument("stream is null.");
_stream = stream;
_buffer = std::vector<Byte>(16);
}
//Sets the position within the current stream.
Long Seek(Int offset, SeekOrigin origin);
//
// Writes a value to the current stream.
//
void Write(bool value);
void Write(Byte value);
void Write(Sbyte value);
@ -108,12 +118,14 @@ namespace xna {
void Write(std::string const& value);
void Write(const char* _string, size_t stringLength);
public:
sptr<Stream> _stream = nullptr;
//Writes a 32-bit integer in a compressed format.
void Write7BitEncodedInt(Int value);
//void Write7BitEncodedInt64(Long value);
private:
sptr<Stream> _stream = nullptr;
std::vector<Byte> _buffer;
void Write7BitEncodedInt(Int value);
};
}