VR-Forces 4.0.4 Class Documentation
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
makVrv::DtRegularExpressionVisitor Class Reference

Visitor that matches regular expressions against scene graph node data. More...

Inheritance diagram for makVrv::DtRegularExpressionVisitor:
Inheritance graph
[legend]

List of all members.

Classes

struct  ExpressionNodeData

Public Types

typedef std::vector
< ExpressionNodeData
NodeVector
 typedef a vector of osg ref node pointers for convenience.
typedef std::vector< boost::regex > RegexVector
 typdef a vector of regex for convenience

Public Member Functions

 DtRegularExpressionVisitor (bool isRegEx=true)
 Default constructor.
 DtRegularExpressionVisitor (const std::string &searchExpression, bool isRegEx=true)
 Constructor that accepts string argument.
 DtRegularExpressionVisitor (const std::vector< std::string > &searchExpressions, bool isRegEx=true)
 Constructor that accepts string vector argument.
virtual ~DtRegularExpressionVisitor ()
 DTOR.
void setSearchNames (bool flag)
 Set to true to include node names.
void setSearchDescriptions (bool flag)
 Set to true to include description.
void setSearchFilenames (bool flag)
 Set to true to include proxy node file names.
virtual void apply (osg::ProxyNode &searchNode)
 The 'apply' method for 'ProxyNode' type instances.
virtual void apply (osg::Node &searchNode)
 Compare the 'mySearchForRegularExpressions' data member against the node's name and description list (depending on the values of member control variables).
virtual void setExpressionToFind (const std::string &searchExpression)
 Set the mySearchForRegularExpressions to user-defined string.
virtual NodeVectornodeVector ()
 return a reference to the ProxyNodeVector of Groups we found.
virtual void setCutTraversal (bool b)
 Set value of cutTraversal.
virtual void reset ()
 Reset the visitor; Must be called after a traversal if the visitor will be used more than once.

Protected Member Functions

virtual bool regexSearchAndAdd (const std::string &target, osg::Node *node)
 Test the target against mySearchForRegularExpressions.
virtual bool searchNames (osg::Node *node)
 Search the node's name(s) for the target expressions.
virtual bool searchDescriptions (osg::Node *node)
 Search the node's description(s) for the target expressions.
virtual bool searchFilenames (osg::ProxyNode *proxyNode)
 Search the proxy node's filename(s) for the target expressions.

Protected Attributes

std::vector< std::string > mySearchForStrings
std::string myOriginalCacheFileString
std::string myOriginalFileString
RegexVector mySearchForRegularExpressions
 the names we are looking for
bool myExpressionIsRegEx
NodeVector myFoundNodeVector
 Vector of nodes with names that match the searchForName string.
bool cutTraversal
 Switch to make traversal stop after one node is matched.
bool mySearchNames
bool mySearchDescriptions
bool mySearchFilenames

Detailed Description

Visitor that matches regular expressions against scene graph node data.


Member Typedef Documentation

typedef a vector of osg ref node pointers for convenience.

This way if you use this visitor to store nodes for removal, as you remove them they aren't actually deleted until the visitor is. I've had weird problems when extracting nodes and just keeping osg::node* around where removing the child causes it to be deleted but it's really some other node's parent.

typedef std::vector<boost::regex> makVrv::DtRegularExpressionVisitor::RegexVector

typdef a vector of regex for convenience


Constructor & Destructor Documentation

Default constructor.

Initialize mySearchForRegularExpressions to "" and set the traversal mode to TRAVERSE_ALL_CHILDREN

makVrv::DtRegularExpressionVisitor::DtRegularExpressionVisitor ( const std::string &  searchExpression,
bool  isRegEx = true 
)

Constructor that accepts string argument.

Initializes mySearchForRegularExpressions to user string set the traversal mode to TRAVERSE_ALL_CHILDREN

makVrv::DtRegularExpressionVisitor::DtRegularExpressionVisitor ( const std::vector< std::string > &  searchExpressions,
bool  isRegEx = true 
)

Constructor that accepts string vector argument.

Initializes mySearchForRegularExpressions to user strings set the traversal mode to TRAVERSE_ALL_CHILDREN

DTOR.


Member Function Documentation

Set to true to include node names.

Set to true to include description.

Set to true to include proxy node file names.

virtual void makVrv::DtRegularExpressionVisitor::apply ( osg::ProxyNode &  searchNode) [virtual]

The 'apply' method for 'ProxyNode' type instances.

Compare the 'mySearchForRegularExpressions' data member against the node's name, description, and filename list (depending on the values of member control variables). If the strings match, add this node to our list

virtual void makVrv::DtRegularExpressionVisitor::apply ( osg::Node &  searchNode) [virtual]

Compare the 'mySearchForRegularExpressions' data member against the node's name and description list (depending on the values of member control variables).

virtual void makVrv::DtRegularExpressionVisitor::setExpressionToFind ( const std::string &  searchExpression) [virtual]

Set the mySearchForRegularExpressions to user-defined string.

return a reference to the ProxyNodeVector of Groups we found.

Nodes are returned in the order they are found.

Set value of cutTraversal.

virtual void makVrv::DtRegularExpressionVisitor::reset ( ) [virtual]

Reset the visitor; Must be called after a traversal if the visitor will be used more than once.

virtual bool makVrv::DtRegularExpressionVisitor::regexSearchAndAdd ( const std::string &  target,
osg::Node *  node 
) [protected, virtual]

Test the target against mySearchForRegularExpressions.

virtual bool makVrv::DtRegularExpressionVisitor::searchNames ( osg::Node *  node) [protected, virtual]

Search the node's name(s) for the target expressions.

virtual bool makVrv::DtRegularExpressionVisitor::searchDescriptions ( osg::Node *  node) [protected, virtual]

Search the node's description(s) for the target expressions.

virtual bool makVrv::DtRegularExpressionVisitor::searchFilenames ( osg::ProxyNode *  proxyNode) [protected, virtual]

Search the proxy node's filename(s) for the target expressions.


Member Data Documentation

std::vector<std::string> makVrv::DtRegularExpressionVisitor::mySearchForStrings [protected]

the names we are looking for

Vector of nodes with names that match the searchForName string.

Switch to make traversal stop after one node is matched.


The documentation for this class was generated from the following file:

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)