indent classes, align by spaces
This commit is contained in:
@@ -28,50 +28,50 @@
|
||||
|
||||
class entity_import : public XMLImporter
|
||||
{
|
||||
Entity& m_entity;
|
||||
Entity& m_entity;
|
||||
public:
|
||||
entity_import( Entity& entity )
|
||||
: m_entity( entity ){
|
||||
}
|
||||
void pushElement( const XMLElement& element ){
|
||||
if ( strcmp( element.name(), "epair" ) == 0 ) {
|
||||
m_entity.setKeyValue( element.attribute( "key" ), element.attribute( "value" ) );
|
||||
entity_import( Entity& entity )
|
||||
: m_entity( entity ){
|
||||
}
|
||||
void pushElement( const XMLElement& element ){
|
||||
if ( strcmp( element.name(), "epair" ) == 0 ) {
|
||||
m_entity.setKeyValue( element.attribute( "key" ), element.attribute( "value" ) );
|
||||
}
|
||||
}
|
||||
void popElement( const char* name ){
|
||||
}
|
||||
std::size_t write( const char* data, std::size_t length ){
|
||||
return length;
|
||||
}
|
||||
}
|
||||
void popElement( const char* name ){
|
||||
}
|
||||
std::size_t write( const char* data, std::size_t length ){
|
||||
return length;
|
||||
}
|
||||
};
|
||||
|
||||
class entity_export : public XMLExporter
|
||||
{
|
||||
class ExportXMLVisitor : public Entity::Visitor
|
||||
{
|
||||
XMLImporter& m_importer;
|
||||
public:
|
||||
ExportXMLVisitor( XMLImporter& importer ) : m_importer( importer ){
|
||||
}
|
||||
void visit( const char* key, const char* value ){
|
||||
StaticElement element( "epair" );
|
||||
element.insertAttribute( "key", key );
|
||||
element.insertAttribute( "value", value );
|
||||
m_importer.pushElement( element );
|
||||
m_importer.popElement( element.name() );
|
||||
}
|
||||
};
|
||||
class ExportXMLVisitor : public Entity::Visitor
|
||||
{
|
||||
XMLImporter& m_importer;
|
||||
public:
|
||||
ExportXMLVisitor( XMLImporter& importer ) : m_importer( importer ){
|
||||
}
|
||||
void visit( const char* key, const char* value ){
|
||||
StaticElement element( "epair" );
|
||||
element.insertAttribute( "key", key );
|
||||
element.insertAttribute( "value", value );
|
||||
m_importer.pushElement( element );
|
||||
m_importer.popElement( element.name() );
|
||||
}
|
||||
};
|
||||
|
||||
const Entity& m_entity;
|
||||
const Entity& m_entity;
|
||||
|
||||
public:
|
||||
entity_export( const Entity& entity ) : m_entity( entity ){
|
||||
}
|
||||
void exportXML( XMLImporter& observer ){
|
||||
ExportXMLVisitor visitor( observer );
|
||||
entity_export( const Entity& entity ) : m_entity( entity ){
|
||||
}
|
||||
void exportXML( XMLImporter& observer ){
|
||||
ExportXMLVisitor visitor( observer );
|
||||
|
||||
m_entity.forEachKeyValue( visitor );
|
||||
}
|
||||
m_entity.forEachKeyValue( visitor );
|
||||
}
|
||||
};
|
||||
|
||||
inline void entity_copy( Entity& entity, const Entity& other ){
|
||||
@@ -84,13 +84,13 @@ template<typename EntityType>
|
||||
class EntityConstruction
|
||||
{
|
||||
public:
|
||||
typedef EntityClass* type;
|
||||
static type get( const EntityType& entity ){
|
||||
return &entity.getEntity().getEntityClass();
|
||||
}
|
||||
static void copy( EntityType& entity, const EntityType& other ){
|
||||
entity_copy( entity.getEntity(), other.getEntity() );
|
||||
}
|
||||
typedef EntityClass* type;
|
||||
static type get( const EntityType& entity ){
|
||||
return &entity.getEntity().getEntityClass();
|
||||
}
|
||||
static void copy( EntityType& entity, const EntityType& other ){
|
||||
entity_copy( entity.getEntity(), other.getEntity() );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user