Initial Implementation of the Taml, Asset and Modules systems.

Only has example and shape assets currently.
This commit is contained in:
Areloch 2015-10-13 15:19:36 -05:00
parent 2044b2691e
commit 7a3b40a86d
123 changed files with 30435 additions and 181 deletions

View file

@ -123,6 +123,19 @@ void Stream::writeString(const char *string, S32 maxLen)
write(len, string);
}
bool Stream::writeFormattedBuffer(const char *format, ...)
{
char buffer[4096];
va_list args;
va_start(args, format);
const S32 length = vsprintf(buffer, format, args);
// Sanity!
AssertFatal(length <= sizeof(buffer), "writeFormattedBuffer - String format exceeded buffer size. This will cause corruption.");
return write(length, buffer);
}
void Stream::readString(char buf[256])
{
U8 len;

View file

@ -29,7 +29,9 @@
#ifndef _ENDIAN_H_
#include "core/util/endian.h"
#endif
#ifndef _STRINGFUNCTIONS_H_
#include "core/strings/stringFunctions.h"
#endif
/// @defgroup stream_overload Primitive Type Stream Operation Overloads
/// These macros declare the read and write functions for all primitive types.
@ -130,12 +132,21 @@ public:
/// writeString is safer.
void writeLongString(U32 maxStringLen, const char *string);
inline bool Put(char character) { return write(character); }
/// Write raw text to the stream
void writeText(const char *text);
/// Writes a string to the stream.
virtual void writeString(const char *stringBuf, S32 maxLen=255);
/// Writes a formatted buffer to the stream.
/// NOTE: A maximum string length of 4K is allowed.
bool writeFormattedBuffer(const char *format, ...);
/// Writes a NULL terminated string buffer.
bool writeStringBuffer(const char* buffer) { return write(dStrlen(buffer), buffer); }
// read/write real strings
void write(const String & str) { _write(str); }
void read(String * str) { _read(str); }