//=-- TestPlugin.cpp - -------------------------------------------------------= // // PLUGIN DESCRIPTION: // // PLUGIN AUTHOR: // Chris Lattner, Author of Magicstats (sabre@nondot.org) // // PLUGIN HOMEPAGE: // http://www.nondot.org/MagicStats/ // // PLUGIN VERSION / COMPATIBILITY: // TestPlugin v1.0 / MagicStats 2.0+ // //=---------------------------------------------------------------------------= // This file is copyright (c) 1997-2000 Chris Lattner //=---------------------------------------------------------------------------= #include "PagePlugin.h" #include "SerializeEx.h" #include "VarTable.h" class TestPlugin : public PluginTemplate { public: inline static unsigned int GetCurrentVersion() { return 100; // Version 1.00 } inline static const char *GetPluginName() { return "TestPlugin"; } TestPlugin(int &CE) { CE = 0; Flags = FAutoFilter; } // The full name consists of all of the data settings that alter the data // that is kept track of and stored. void GetFullName(VarTable &, String &fullName, int updateFreq) { fullName = String::IntToStr(updateFreq) + Name; } void ProcessAccess(AccessFormatPlugin &A) { URLs.AddToTail("" + A.GetURL() + " - " + A.GetHost()); } void OutputHTML(ostream &O, VarTable &) { LinkedList::Iterator I = URLs.GetIterator(); O << "Pages visited - Host who visited...
    \n"; for (; I; I++) { O << *I << "
    \n"; } O << "
\n"; } void ResetState() { URLs.ClearList(); } void LoadState(Serialize &I) { unsigned int Version = 0; ResetState(); I >> Version; // Check version number... switch (Version) { case 100: // Version 1.00 I >> URLs; break; default: cout << "Serialized " << Name << " Page plugin is of a version that cannot " << "be deserialized\nwith this version of the plugin. Reseting state.\n"; break; } } void SaveState(Serialize &O) { O << GetCurrentVersion(); // Serialize the Version number O << URLs; } private : LinkedList URLs; }; INIT_PLUGIN(TestPlugin);