#ifndef TypeMatcher_First #define TypeMatcher_First #ifdef __GNUG__ #pragma interface #endif #include "Object.h" #include "Symbol.h" class OrdCollection; class Bitmap; class Data; class SmartBitmap; extern SmartBitmap gFileIcon, gAsciiIcon, gImageIcon; extern const char *cMagic; // magic cookie for ET++ generated files //---- TypeMatcher ------------------------------------------------------------- class TypeMatcher: public Object { public: MetaDef(TypeMatcher); TypeMatcher(const Symbol &t, const char *ext, const char *tag, bool isAscii, int prio= 1000); ~TypeMatcher(); virtual Bitmap *GetBitmap(); const Symbol &GetType(); static void AddMatcher(TypeMatcher*); static TypeMatcher *MatchByName(Data*); static TypeMatcher *MatchByContents(Data*); protected: virtual bool MatchExtension(Data*, const char *extension); virtual bool MatchPathName(Data*, const char *pathname, int len); virtual bool MatchNameAndContents(Data*, const char *pathname, const char *buf, int len); virtual bool MatchContents(Data*, const char *buf, int len); int Compare(Object *op); protected: const Symbol *type; char *extension, *tag; int priority; public: bool ascii; private: static OrdCollection *matchers; static bool sorted; }; inline const Symbol &TypeMatcher::GetType() { return *type; } #endif