QuasselClient/src/qtshit/write.zig

16 lines
397 B
Zig
Raw Normal View History

2021-06-01 11:18:21 +01:00
pub fn add_int(writer: anytype, number: u32) !void {
try writer.writeIntBig(u32, number);
}
2021-06-01 10:38:42 +01:00
2021-06-01 11:18:21 +01:00
pub fn add_short(writer: anytype, number: u16) !void {
try writer.writeIntBig(u16, number);
}
2021-06-01 10:38:42 +01:00
2021-06-01 11:18:21 +01:00
pub fn add_byte(writer: anytype, byte: u8) !void {
try writer.writeByte(byte);
}
2021-06-01 11:22:56 +01:00
pub fn add_string(writer: anytype, str: []const u8) !void {
2021-06-01 11:18:21 +01:00
try writer.writeAll(str);
2021-06-01 11:22:56 +01:00
try writer.writeByte('\x00');
2021-06-01 10:38:42 +01:00
}