00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : Mike Heck (Apr 2000) 00022 **=======================================================================*/ 00023 00024 00025 #ifndef _SO_SEARCHPATH_ACTION_ 00026 #define _SO_SEARCHPATH_ACTION_ 00027 00028 // Note: Not necessary to include SoSubAction.h because it is already 00029 // included by SoSearchAction.h 00030 #include <Inventor/actions/SoSearchAction.h> 00031 00116 class SoSearchPathAction : public SoSearchAction { 00117 00118 SO_ACTION_HEADER(SoSearchPathAction); 00119 00120 public: 00121 00126 SoSearchPathAction(); 00127 00131 virtual ~SoSearchPathAction(); 00132 00136 void reset(); 00137 00141 void setSearchString( const char *searchString ); 00145 const SbString& getSearchString() const 00146 { return m_strSearchString; }; 00147 00151 void setSeparatorChar( const char sepChar ) 00152 { m_cSepChar = sepChar; } 00156 char getSeparatorChar() const 00157 { return m_cSepChar; } 00158 00162 void setDerivedIsOK( const SbBool derivedIsOK ) 00163 { m_bDerivedIsOK = derivedIsOK; }; 00167 SbBool getDerivedIsOK() const 00168 { return m_bDerivedIsOK; }; 00169 00176 int getNumItemsFound() const 00177 { return m_nItemNum; }; 00178 00179 private: 00180 // Notifies action that the current node satisfies the current search item. 00181 virtual void setFound(); 00182 00183 private: 00184 static void initClass(); 00185 static void exitClass(); 00186 00187 // Static and instance-specific callbacks called during traversal 00188 static void searchStatic(SoAction *action, SoNode *node); 00189 virtual void search (SoNode *node); 00190 00191 private: 00192 // Initiates action on graph 00193 virtual void beginTraversal(SoNode *node); 00194 00195 // Classify search item and call appropriate SearchAction method 00196 SbBool setSearchParameters( const char* item ); 00197 00198 // Result of setupNextSearchItem 00199 enum ItemSetupResult { 00200 NO_MORE_ITEMS, 00201 VALID_ITEM, 00202 INVALID_ITEM 00203 }; 00204 00205 // Extract next search item from search string and get ready to go. 00206 ItemSetupResult setupNextSearchItem(); 00207 00208 SbString m_strSearchString; // Search string 00209 char *m_pStartChar; // Points to next search item 00210 char m_cSepChar; // Char that separates search items 00211 SbBool m_bDerivedIsOK; // Will type search match derived types 00212 int m_nItemNum; // Which search item is active (for error reporting) 00213 00214 private: 00215 00216 }; 00217 00218 #endif /* _SO_SEARCHPATH_ACTION_ */ 00219 00220