Example #1
0
size_t writeString(WriteStream &stream, const Common::UString &str, Encoding encoding, bool terminate) {
	ScopedPtr<MemoryReadStream> data(convertString(str, encoding, terminate));

	const size_t n = stream.writeStream(*data);

	return n;
}
Example #2
0
void writeStringFixed(WriteStream &stream, const Common::UString &str, Encoding encoding, size_t length) {
	if (length == 0)
		return;

	ScopedPtr<MemoryReadStream> data(convertString(str, encoding, false));

	size_t n = stream.writeStream(*data, length);
	while (n++ < length)
		stream.writeByte(0);
}
Example #3
0
void writeStringFixed(WriteStream &stream, const Common::UString &str, Encoding encoding, size_t length) {
	MemoryReadStream *data = 0;
	try {
		data = convertString(str, encoding, false);

		size_t n = stream.writeStream(*data, length);
		while (n++ < length)
			stream.writeByte(0);

	} catch (...) {
		delete data;
		throw;
	}

	delete data;
}
Example #4
0
size_t writeString(WriteStream &stream, const Common::UString &str, Encoding encoding, bool terminate) {
	size_t n = 0;

	MemoryReadStream *data = 0;
	try {
		data = convertString(str, encoding, terminate);

		n = stream.writeStream(*data);
	} catch (...) {
		delete data;
		throw;
	}

	delete data;

	return n;
}