Skip to content
Permalink
Browse files

Remove Visitor (wrapper around TiXmlVisitor)

  • Loading branch information...
jhasse committed Sep 28, 2018
1 parent 81485da commit da130aefd426c942a4ddd19190e6e31b7cd1ba28
Showing with 0 additions and 92 deletions.
  1. +0 −49 ticpp.cpp
  2. +0 −43 ticpp.h
@@ -26,55 +26,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using namespace ticpp;

// In the following Visitor functions, casting away const should be safe, as the object can only be referred to by a const &
bool Visitor::VisitEnter( const TiXmlDocument& doc )
{
return VisitEnter( Document( const_cast< TiXmlDocument* >( &doc ) ) );
}

bool Visitor::VisitExit( const TiXmlDocument& doc )
{
return VisitEnter( Document( const_cast< TiXmlDocument* >( &doc ) ) );
}

bool Visitor::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute )
{
if ( 0 != firstAttribute )
{
Attribute attribute( const_cast< TiXmlAttribute* >( firstAttribute ) );
return VisitEnter( Element( const_cast< TiXmlElement* >( &element ) ), &attribute );
}
else
{
return VisitEnter( Element( const_cast< TiXmlElement* >( &element ) ), 0 );
}
}

bool Visitor::VisitExit( const TiXmlElement& element )
{
return VisitExit( Element( const_cast< TiXmlElement* >( &element ) ) );
}

bool Visitor::Visit( const TiXmlDeclaration& declaration )
{
return Visit( Declaration( const_cast< TiXmlDeclaration* >( &declaration ) ) );
}

bool Visitor::Visit( const TiXmlStylesheetReference& stylesheet )
{
return Visit( StylesheetReference( const_cast< TiXmlStylesheetReference* >( &stylesheet ) ) );
}

bool Visitor::Visit( const TiXmlText& text )
{
return Visit( Text( const_cast< TiXmlText* >( &text ) ) );
}

bool Visitor::Visit( const TiXmlComment& comment )
{
return Visit( Comment( const_cast< TiXmlComment* >( &comment ) ) );
}

Attribute::Attribute()
{
SetTiXmlPointer( new TiXmlAttribute() );
43 ticpp.h
@@ -109,49 +109,6 @@ namespace ticpp
class TICPP_API Comment;
class TICPP_API Attribute;

/** Wrapper around TiXmlVisitor */
class TICPP_API Visitor : public TiXmlVisitor
{
public:
// Overload the TiXmlVisitor functions, wrap objects, call ticpp::Visitor functions
/// @internal
virtual bool VisitEnter( const TiXmlDocument& doc );
/// @internal
virtual bool VisitExit( const TiXmlDocument& doc );
/// @internal
virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute );
/// @internal
virtual bool VisitExit( const TiXmlElement& element );
/// @internal
virtual bool Visit( const TiXmlDeclaration& declaration );
/// @internal
virtual bool Visit( const TiXmlStylesheetReference& stylesheet );
/// @internal
virtual bool Visit( const TiXmlText& text );
/// @internal
virtual bool Visit( const TiXmlComment& comment );

public:
/// Visit a document.
virtual bool VisitEnter( const Document& /*doc*/ ) { return true; }
/// Visit a document.
virtual bool VisitExit( const Document& /*doc*/ ) { return true; }

/// Visit an element.
virtual bool VisitEnter( const Element& /*element*/, const Attribute* /*firstAttribute*/ ) { return true; }
/// Visit an element.
virtual bool VisitExit( const Element& /*element*/ ) { return true; }

/// Visit a declaration
virtual bool Visit( const Declaration& /*declaration*/ ) { return true; }
/// Visit a stylesheet reference
virtual bool Visit( const StylesheetReference& /*stylesheet*/ ) { return true; }
/// Visit a text node
virtual bool Visit( const Text& /*text*/ ) { return true; }
/// Visit a comment node
virtual bool Visit( const Comment& /*comment*/ ) { return true; }
};

/** Wrapper around TiXmlBase */
class TICPP_API Base
{

0 comments on commit da130ae

Please sign in to comment.
You can’t perform that action at this time.