VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtRegularExpressionVisitor.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2007 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtRegularExpressionVisitor.h,v $ $Revision: 1.14 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #ifndef DtRegularExpressionVisitor_H_
14 #define DtRegularExpressionVisitor_H_
15 
16 #include <vrvOsg/vrvOsg.h>
17 #include <osg/NodeVisitor>
18 #include <osg/Group>
19 #include <osg/Switch>
20 #include <boost/regex.hpp>
21 
22 namespace makVrv
23 {
27  class DT_DLL_VRVOSG DtRegularExpressionVisitor : public osg::NodeVisitor
28  {
29 
30  public:
31 
33  {
34  osg::ref_ptr<osg::Node> node;
35  osg::Matrix localToWorldVector;
36  std::string match; // what matched the regular expression
37  };
38 
45  typedef std::vector< ExpressionNodeData > NodeVector;
46 
48  typedef std::vector<boost::regex> RegexVector;
49 
52  DtRegularExpressionVisitor(bool isRegEx = true);
53 
56  DtRegularExpressionVisitor(const std::string& searchExpression, bool isRegEx = true);
57 
60  DtRegularExpressionVisitor(const std::vector<std::string>& searchExpressions,bool isRegEx = true);
61 
63  virtual ~DtRegularExpressionVisitor();
64 
66  void setSearchNames(bool flag);
67 
69  void setSearchDescriptions(bool flag);
70 
72  void setSearchFilenames(bool flag);
73 
78  virtual void apply(osg::ProxyNode& searchNode);
79 
82  virtual void apply(osg::Node& searchNode);
83 
85  virtual void setExpressionToFind(const std::string &searchExpression);
86 
89  virtual NodeVector& nodeVector();
90 
92  virtual void setCutTraversal(bool b);
93 
96  virtual void reset();
97 
98  protected:
99 
101  virtual bool regexSearchAndAdd(const std::string& target, osg::Node* node);
102 
104  virtual bool searchNames(osg::Node* node);
105 
107  virtual bool searchDescriptions(osg::Node* node);
108 
110  virtual bool searchFilenames(osg::ProxyNode* proxyNode);
111 
112  protected:
113 
114  std::vector<std::string> mySearchForStrings;
115 
117  std::string myOriginalFileString;
118 
121 
123 
126 
129 
133  };
134 
135 }
136 
137 #endif
138 

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)