/klopdataRW

the Reading and Writing portion of the klop::data class in the klop namespace

Primary LanguageC++

currently XML is supported, with the use of irrXML
(http://www.ambiera.com/irrxml/) which is under the zlib license.

XML format needs to look like the following


<root>
<physics>
    <mass type="int" value="10" />
    <dimensions>
        <width type="float" value="11" />
        <height type="float" value="12.2" />
        <depth type="float" value="13.14159" />
    </dimensions>
    <description>
        Some text here.
    </description>
    <list type="list">
        <item type="float" value="423.3543" />
        <item type="int" value="324" />
        <item>
        This should happen first.    
        </item>
        <item>
        This should happen second.    
        </item>
        <item>
        This should happen third.    
        </item>
    </list>
</physics>
</root>

Basically, don't specify a type if it is a string. If it holds more children,
and is a list, then specify the type is a list. Otherwise, use self-terminating
XML elements, which have a specified type(options: float, int) and a value.
The <root> element doesn't actually need to be called <root>, but the logic is
set up so it ignores the first element creation so we don't have to do something
silly like data["root"]["physics"], but just data["physics"].
to access the text that says "This should happen first", it should look like
data["physics"]["list"][2].asString()
When it is saved, the elements that are not in a list form are stored in what 
ever order the STL Map uses, which is a Red-Black based Tree, so it usually
ends up somewhat alphabetically sorted, though not guaranteed.



This project is under the zlib/libpng license as follows:
Copyright (c) <2011> <Levi (kloplop321.com)>

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyomakne to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

   1. The origin of this software must not be misrepresented; you must not
   claim that you wrote the original software. If you use this software
   in a product, an acknowledgment in the product documentation would be
   appreciated but is not required.

   2. Altered source versions must be plainly marked as such, and must not be
   misrepresented as being the original software.

   3. This notice may not be removed or altered from any source
   distribution.

Feel free to fork this project and to improve it.

There is a netbeans project included with all the tools such as testing and 
building configured.