reorganize sources

This commit is contained in:
Eduardo Bart
2011-08-15 11:06:15 -03:00
parent 4e03b15b27
commit d8cc37afdb
113 changed files with 621 additions and 3437 deletions

View File

@@ -1,7 +1,7 @@
#ifndef OTMLDECLARATIONS_H
#define OTMLDECLARATIONS_H
#ifndef FRAMEWORK_OTML_DECLARATIONS_H
#define FRAMEWORK_OTML_DECLARATIONS_H
#include <global.h>
#include <framework/global.h>
class OTMLNode;
class OTMLDocument;

View File

@@ -2,7 +2,7 @@
#include "otmlparser.h"
#include "otmlemitter.h"
#include <core/resourcemanager.h>
#include <framework/core/resourcemanager.h>
OTMLDocumentPtr OTMLDocument::create()
{

View File

@@ -1,7 +1,7 @@
#ifndef OTMLEMITTER_H
#define OTMLEMITTER_H
#include "otmldeclarations.h"
#include "declarations.h"
class OTMLEmitter
{

View File

@@ -1,7 +1,7 @@
#ifndef OTMLEXCEPTION_H
#define OTMLEXCEPTION_H
#include "otmldeclarations.h"
#include "declarations.h"
/// All OTML errors throw this exception
class OTMLException : public std::exception

View File

@@ -16,7 +16,7 @@ std::string OTMLNode::value() const
{
// ~ is an alias for no value
if(m_value == "~")
return aux::empty_string;
return fw::empty_string;
return m_value;
}
@@ -109,7 +109,7 @@ OTMLNodePtr OTMLNode::at(const std::string& childTag)
if(child->tag() == childTag)
return child;
}
throw OTMLException(shared_from_this(), aux::make_string("child node with tag '", childTag, "' not found"));
throw OTMLException(shared_from_this(), fw::mkstr("child node with tag '", childTag, "' not found"));
return nullptr;
}
@@ -117,7 +117,7 @@ OTMLNodePtr OTMLNode::at(int childIndex)
{
if(childIndex < size() && childIndex >= 0)
return m_childNodes[childIndex];
throw OTMLException(shared_from_this(), aux::make_string("child node at index '", childIndex, "' not found"));
throw OTMLException(shared_from_this(), fw::mkstr("child node at index '", childIndex, "' not found"));
return nullptr;
}

View File

@@ -1,7 +1,7 @@
#ifndef OTMLNODE_H
#define OTMLNODE_H
#include "otmldeclarations.h"
#include "declarations.h"
#include "otmlexception.h"
class OTMLNode : public std::enable_shared_from_this<OTMLNode>
@@ -90,7 +90,7 @@ T OTMLNode::read() {
T v;
if(!from_otmlnode(shared_from_this(), v))
throw OTMLException(shared_from_this(),
aux::make_string("failed to cast node value to type '", aux::demangle_type<T>(), "'"));
fw::mkstr("failed to cast node value to type '", fw::demangle_type<T>(), "'"));
return v;
}
@@ -147,7 +147,7 @@ void OTMLNode::writeIn(const T& v) {
// templates for casting a node to another type
template<typename T>
bool from_otmlnode(OTMLNodePtr node, T& v) {
return aux::cast(node->value(), v);
return fw::cast(node->value(), v);
}
template<typename T>
@@ -169,7 +169,7 @@ template <typename K, typename T>
bool from_otmlnode(OTMLNodePtr node, std::map<K, T>& m) {
for(int i=0;i<node->size();++i) {
K k;
if(!aux::cast(node->at(i)->tag(), k))
if(!fw::cast(node->at(i)->tag(), k))
return false;
m[k] = node->at(i)->read<T>();
}
@@ -179,7 +179,7 @@ bool from_otmlnode(OTMLNodePtr node, std::map<K, T>& m) {
// templates for casting a type to a node
template<typename T>
void to_otmlnode(OTMLNodePtr node, const T& v) {
node->setValue(aux::unsafe_cast<std::string>(v));
node->setValue(fw::unsafe_cast<std::string>(v));
}
template<typename T>
@@ -203,7 +203,7 @@ void to_otmlnode(OTMLNodePtr node, const std::list<T>& v) {
template <typename K, typename T>
void to_otmlnode(OTMLNodePtr node, const std::map<K, T>& m) {
for(auto it = m.begin(); it != m.end(); ++it) {
std::string k = aux::unsafe_cast<std::string>(it->first);
std::string k = fw::unsafe_cast<std::string>(it->first);
OTMLNodePtr newNode(new OTMLNode);
newNode->setTag(k);
newNode->setUnique();

View File

@@ -1,46 +0,0 @@
#ifndef OTMLNODEEXT_H
#define OTMLNODEEXT_H
#include <util/point.h>
#include <util/color.h>
#include <util/rect.h>
#include <util/size.h>
//inline bool from_otmlnode(const OTMLNodePtr& node, Color& color)
//{
//int r, g, b, a;
//r = node->readAt<int>(0);
//g = node->readAt<int>(1);
//b = node->readAt<int>(2);
//a = 255;
//if(node->hasChild(3))
//a = node->readAt<int>(3);
//return true;
//}
//template <class T>
//bool from_otmlnode(const OTMLNodePtr& node, TPoint<T>& point)
//{
//point.x = node->readAt<T>(0);
//point.y = node->readAt<T>(1);
//return true;
//}
//template <class T>
//bool from_otmlnode(const OTMLNodePtr& node, TSize<T>& size)
//{
//size.setSize(node->readAt<T>(0), node->readAt<T>(1));
//return true;
//}
//template <class T>
//bool from_otmlnode(const OTMLNodePtr& node, TRect<T>& rect)
//{
//rect.setRect(node->readAt<int>(0),
//node->readAt<int>(1),
//node->readAt<int>(2),
//node->readAt<int>(3));
//return true;
//}
#endif

View File

@@ -154,7 +154,7 @@ void OTMLParser::parseNode(const std::string& data)
node->setUnique(dotsPos != std::string::npos);
node->setTag(tag);
node->setValue(value);
node->setSource(doc->source() + ":" + aux::safe_cast<std::string>(currentLine));
node->setSource(doc->source() + ":" + fw::safe_cast<std::string>(currentLine));
currentParent->addChild(node);
previousNode = node;
}

View File

@@ -1,7 +1,7 @@
#ifndef OTMLPARSER_H
#define OTMLPARSER_H
#include "otmldeclarations.h"
#include "declarations.h"
class OTMLParser
{