00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef FINDAPPROXPATH_H
00020 #define FINDAPPROXPATH_H
00021
00022 #include "pandabase.h"
00023
00024 #include "typeHandle.h"
00025 #include "pvector.h"
00026
00027 class PandaNode;
00028
00029
00030
00031
00032
00033
00034
00035
00036 class FindApproxPath {
00037 public:
00038 INLINE FindApproxPath();
00039
00040 bool add_string(const string &str_path);
00041 bool add_flags(const string &str_flags);
00042 bool add_component(string str_component);
00043
00044 INLINE void add_match_name(const string &name, int flags);
00045 INLINE void add_match_name_glob(const string &glob, int flags);
00046 INLINE void add_match_exact_type(TypeHandle type, int flags);
00047 INLINE void add_match_inexact_type(TypeHandle type, int flags);
00048 INLINE void add_match_one(int flags);
00049 INLINE void add_match_many(int flags);
00050 INLINE void add_match_pointer(PandaNode *pointer, int flags);
00051
00052 INLINE int get_num_components() const;
00053 INLINE bool is_component_match_many(int index) const;
00054 INLINE bool matches_component(int index, PandaNode *node) const;
00055 INLINE bool matches_stashed(int index) const;
00056
00057 INLINE bool return_hidden() const;
00058 INLINE bool return_stashed() const;
00059
00060 void output(ostream &out) const;
00061 INLINE void output_component(ostream &out, int index) const;
00062
00063 #ifndef WIN32_VC
00064
00065
00066 private:
00067 #endif
00068 enum ComponentType {
00069 CT_match_name,
00070 CT_match_name_glob,
00071 CT_match_exact_type,
00072 CT_match_inexact_type,
00073 CT_match_one,
00074 CT_match_many,
00075 CT_match_pointer
00076 };
00077 enum ComponentFlags {
00078 CF_stashed = 0x001,
00079 };
00080
00081 class Component {
00082 public:
00083 bool matches(PandaNode *node) const;
00084 void output(ostream &out) const;
00085
00086 ComponentType _type;
00087 string _name;
00088 TypeHandle _type_handle;
00089 PandaNode *_pointer;
00090 int _flags;
00091 };
00092
00093 typedef pvector<Component> Path;
00094 Path _path;
00095
00096 bool _return_hidden;
00097 bool _return_stashed;
00098
00099 friend ostream &operator << (ostream &, FindApproxPath::ComponentType);
00100 friend INLINE ostream &operator << (ostream &, const FindApproxPath::Component &);
00101 };
00102
00103 ostream &
00104 operator << (ostream &out, FindApproxPath::ComponentType type);
00105
00106 INLINE ostream &
00107 operator << (ostream &out, const FindApproxPath::Component &component) {
00108 component.output(out);
00109 return out;
00110 }
00111
00112 INLINE ostream &
00113 operator << (ostream &out, const FindApproxPath &path) {
00114 path.output(out);
00115 return out;
00116 }
00117
00118 #include "findApproxPath.I"
00119
00120 #endif