Home Site map Contacts CZ

Jan Ringoš, Tringi.TRIMCORE.cz

Papers & C++  »  Libraries and sources  » 

Brace C++ Library

Brace is a comprehensive C++ template library that parse, organize and serialize string-based human-readable hierarchical data. The contained format itself is easier to edit and maintain than XML, yet similar in philosophy and already in widespread use.

Please note that this project is hosted on SourceForge.net [link leads out of this web] and the download and documentation links lead there.
Download

Download: brace-beta-3.zip

ZIP archive with the library sources. Version Beta 3
File size: 27 kB

Details

The current version of The Brace library is thorough yet very basic parser and tokenizer. It goes only as far as to serializing and reconstructing trees of token blocks. Still it provides different storage options and different methods for loading parsed files. The templates can be specialized for different character types and configured through traits structures.

Installation and use of this library is no different than use of any other C++ library. Actually it can be even easier since the implementation is completely templated and thus just within header files.

Two simple examples are included within the distribution package but don't expect any documentation above comments in the source files.

Definition

[token [token […]]] [\n] {
    [token [token […]]] [;|\n]
}[;]

Sample brace file

setup {
    window {
        topmost: false;
        noclose: false;
    }
    resolution {
        width: 320
        height: 240
        bpp: 32
        freq: 75
    }
    control {
        horizontal {
            sensitivity: "10.0";
            reverse: false;
        };
        vertical {
            sensitivity: "10.0";
            reverse: false;
        };
    }
    renderer {
        ratio: "1.333333";
        depth: 200.0; // far Z plane
    }
}

Future development

The priority issue to solve is the Brace tokenizer taking fixed character set for a token. Some kind of munch function needs to be introduced, that will correctly parse decimal numbers in every syntax. Also an optional UTF-8 (and perhaps UTF-16) layer needs to be added (below the tokenizer) that will address necessary conversions and BOM.

The ultimate goal of a final version of the Brace C++ Library is to provide an efficient mapping. That is, setting variables in hierarchy of structures with values parsed from brace::block tree (either pre-read or read on fly) as specified in a definition tree.

Requirements

  • C++99 conforming compiler

Verified compatibility

  • MinGW (GCC 4.2)

License

The Brace C++ Library is a free software available under the zlib license.
For detailed text of the license see The zlib License.

Relevant links

exertion of the imagination, portfolio library and software repository