//=-- PagePlugin.h - Abstract base class for page plugins to derive from -----=
//
//  PluginInit Class:
//    Initialize plugins.  The code for this class is in the PluginNode.cpp 
//    file.
//
//=---------------------------------------------------------------------------=
//  This file is copyright (c) 1997-1998 Chris Lattner
//=---------------------------------------------------------------------------=

#ifndef PAGEPLUGIN_H
#define PAGEPLUGIN_H

#include "Plugin.h"
#include "FilterHandle.h"

class AccessFormatPlugin;
class Serialize;
class VTExp;

class MSAPI PagePlugin : public Plugin {
public :
  PagePlugin(const String &Name);

  virtual PluginType GetType() const { return GetPluginType(); }
  inline static PluginType GetPluginType() { return Plugin::PAGE_PLUGIN; }

  virtual void ProcessAccess(AccessFormatPlugin &) {}
  virtual void OutputHTML(ostream &strm, Table<CSString,VTExp*> &) = 0;
  virtual int ValidateName(String &name);

  void MetaProcessAccess(AccessFormatPlugin &);
  void MetaLoadSettings(Table<CSString,VTExp*> *, int F);

  virtual void GetFullName(Table<CSString,VTExp*> &Params, String &FullName, 
                           int UpdateFreq) = 0;
  virtual const String GetPluginFullName() const { return FullName; }

  static PagePlugin *CreatePlugin(const String &Name) {
    return (PagePlugin *)Plugin::CreatePlugin(Plugin::PAGE_PLUGIN, Name);
  }

  int Flags;

  enum FlagBits {  
    FClear        = 0x00,
    FAutoFilter   = 0x01,
    FIgnoreErrors = 0x02,
    FNoAccesses   = 0x04
  };

protected :
  int NumAccesses;     // Number of accesses read this time...
  FilterHandle DefFilter;
  String FullName;
};

#endif
