1 2 /* Web Polygraph http://www.web-polygraph.org/ 3 * Copyright 2003-2011 The Measurement Factory 4 * Licensed under the Apache License, Version 2.0 */ 5 6 #ifndef POLYGRAPH__CSM_CDBBUILDERS_H 7 #define POLYGRAPH__CSM_CDBBUILDERS_H 8 9 class ContentDbase; 10 class CdbEntry; 11 class CdbePage; 12 class PrefixIdentifier; 13 14 class CdbBuilder { 15 public: 16 CdbBuilder(); 17 virtual ~CdbBuilder(); 18 19 void db(ContentDbase *aDb); 20 void configure(const String &aFname, const char *aBufB, const char *aBufE); 21 virtual bool parse() = 0; 22 23 public: 24 static int TheLinkCount; 25 26 protected: 27 ContentDbase *theDb; 28 String theFname; 29 const char *theBufB; 30 const char *theBufE; 31 }; 32 33 class MarkupParser: public CdbBuilder { 34 public: 35 virtual bool parse(); 36 virtual void addEntry(CdbEntry *e); 37 38 protected: 39 void parseTag(const String &image); 40 void parseBlob(const String &blobImage); 41 42 int RegReplacement(const String &key, const String &ctype); 43 const String *AttrValReplacement(const String &keyPfx, const String &keySfx); 44 45 private: 46 static PrefixIdentifier *TheReplIdentifier; 47 static Array<String*> TheReplacements; 48 }; 49 50 class LinkOnlyParser: public MarkupParser { 51 public: 52 LinkOnlyParser(); 53 54 virtual bool parse(); 55 virtual void addEntry(CdbEntry *e); 56 57 protected: 58 void flush(); 59 60 private: 61 CdbePage *thePage; 62 String theImage; 63 }; 64 65 class VerbatimParser: public CdbBuilder { 66 public: 67 virtual bool parse(); 68 }; 69 70 #endif 71