home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 31 / CDASC_31_1996_juillet_aout.iso / vrac / cuj0796.zip / COLNER.ZIP / HTML.H < prev    next >
C/C++ Source or Header  |  1996-05-08  |  2KB  |  79 lines

  1. #if !defined(HTML_DEFINED)
  2. #define HTML_DEFINED
  3. #include "strClass.h"
  4.     class
  5. BlockOption : public String{
  6.     friend ostream& operator << ( ostream& out, BlockOption& option);
  7.   protected:
  8.     String name;
  9.   public:
  10.       BlockOption(BlockOption& b) : String((String&) b), name(b.name){}
  11.       BlockOption(const char * const _name, const char * const value)
  12.         : name(_name), String(value){}
  13.     BlockOption(const char * const _name) : name(_name){}
  14.     CAST_INJECTORS(BlockOption)
  15.     };
  16. CAST_IOMANIP(BlockOption)
  17. ostream& operator << ( ostream& out, BlockOption& b);
  18. class Block;
  19. ostream& operator << ( ostream& out, Block& b);
  20.     class
  21. Block : public String {
  22.     friend ostream& operator << ( ostream& out, Block& b);
  23.   protected:
  24.     String tag;
  25.     BlockOption* option[10];
  26.     unsigned blockOptionCount;
  27.   public:
  28.     Block():tag(),blockOptionCount(0){}
  29.     Block(const char * const _tag):tag(_tag),blockOptionCount(0){}
  30.     Block( Block& sourceBlock);
  31.     ~Block();
  32.         Block& operator
  33.     << ( BlockOption& opt );
  34.         Block&
  35.     filter(const char * text);
  36.     CAST_INJECTORS(Block)
  37.         Block& operator
  38.     << ( Block& b ){
  39.         (ostrstream&)*this << b;
  40.         return *this;
  41.         }
  42.   };
  43. CAST_IOMANIP(Block)
  44.   class
  45. Anchor : public Block{
  46.   public:
  47.       Anchor(const char * const ref) : Block("a"){
  48.         (Block&)*this << BlockOption( "HREF", ref);
  49.         }
  50.     CAST_INJECTORS(Anchor)
  51.         Anchor&
  52.     filter(const char * text){ ((Block&)*this).filter(text); return *this;}
  53.     };
  54. CAST_IOMANIP(Anchor)
  55.     class
  56. Html : public Block {
  57.     friend ostream& operator << ( ostream& out, Html &html);
  58.   protected:
  59.     String title;
  60.     int isIndex;
  61.     static int responseHeader;
  62.   public:
  63.       Html(const char * const _title, int _isIndex =0)
  64.           : Block("body"), title(_title), isIndex(_isIndex){};
  65.     Html()
  66.         : Block("body"), title(), isIndex(0){};
  67.     static void noResponseHeader(){ responseHeader =0;}
  68.     CAST_INJECTORS(Html)
  69.     Html& operator << ( Block& b ) {
  70.         ((ostrstream&)(Block&)(*this)) << b ;
  71.         return *this;
  72.         }
  73.         Html&
  74.     filter(const char * text){ ((Block&)*this).filter(text); return *this;}
  75.     };
  76. CAST_IOMANIP(Html)
  77. ostream& operator << ( ostream& out, Html &html);
  78. #endif
  79.