- TAML now supports writing and reading JSON. By default it will use a schema that is strictly compatible with JSON RFC4627 (specifically the part about member names must be unique) however TAML does not care about this and it can be turned off with the console variable "$pref::T2D::JSONStrict" (set it to false). - TAML adheres to unique member names by adding a suffix. The member names that do this are the ones that represent children types or custom node names. The JSON writer has a unique serial number which is increments during writing however you are free to configure the actual format by changing the following in the "tamlJSONWriter.cc" file (at the top): StringTableEntry JSON_RFC4627_NAME_MANGLING_FORMAT = StringTable->insert( "%s[%d]" ); - Taml also allows you to configure which characters are used to separate the type/node-name from the index again using an entry in the "tamlJSONWriter.cc": StringTableEntry JSON_RFC4627_NAME_MANGLING_CHARACTERS = StringTable->insert(" !$%^&*()-+{}[]@:~#|\\/?<>,.\n\r\t");
- TAML already will auto-detects the file type by extension (the defaults are XML is ".taml", BINARY is ".baml") and JSON now has a default of ".json". As always, you are free to changes these defaults in the C++ code or on a TAML per-instance basis.
+ \brief Concept for allocating, resizing and freeing memory block.
+
+ Note that Malloc() and Realloc() are non-static but Free() is static.
+
+ So if an allocator need to support Free(), it needs to put its pointer in
+ the header of memory block.
+
+\code
+concept Allocator {
+ static const bool kNeedFree; //!< Whether this allocator needs to call Free().
+
+ // Allocate a memory block.
+ // \param size of the memory block in bytes.
+ // \returns pointer to the memory block.
+ void* Malloc(size_t size);
+
+ // Resize a memory block.
+ // \param originalPtr The pointer to current memory block. Null pointer is permitted.
+ // \param originalSize The current size in bytes. (Design issue: since some allocator may not book-keep this, explicitly pass to it can save memory.)
+//! (Depreciated) Wrapper of C file stream for input or output.
+/*!
+ This simple wrapper does not check the validity of the stream.
+ \implements Stream
+ \deprecated { This was only for basic testing in version 0.1, it is found that the performance is very low by using fgetc(). Use FileReadStream instead. }
+*/
+class FileStream {
+public:
+ typedef char Ch; //!< Character type. Only support char.
+Rapidjson is a JSON parser and generator for C++. It was inspired by rapidxml http://rapidxml.sourceforge.net/
+Rapidjson is small but complete. It supports both SAX and DOM style API. The SAX parser is only a half thousand lines of code.
+Rapidjson is fast. Its performance can be comparable to strlen(). It also optionally supports SSE2/SSE4.1 for acceleration.
+Rapidjson is self-contained. It does not depend on external libraries such as BOOST. It even does not depend on STL.
+Rapidjson is memory friendly. Each JSON value costs exactly 16/20 bytes for 32/64-bit machines (excluding text string). By default it uses a fast memory allocator, and the parser allocates memory compactly during parsing.
+
+For the full features please refer to the user guide.
+
+JSON(JavaScript Object Notation) is a light-weight data exchange format.
+More information about JSON can be obtained at
+http://json.org/
+http://www.ietf.org/rfc/rfc4627.txt
+
+2. Installation
+
+Rapidjson is a header-only C++ library. Just copy the rapidjson/include/rapidjson folder to system or project's include path.