#ifndef _REPORT_H #define _REPORT_H /* All objects that can report have Report as a friend class This allows the Report types full access to the hierarchy Dependency injection is used to provide the Reports with the SpiderManager start point. Common functions for creating XML are provided in the Report class. The work of doing the report was taken out of the classes themselves because the Reports are parameterised and many report_*() functions would have been required for the various facilities This way the reporting is encapsulated in one separate class hierarchy. Report classes are *not* thread safe: only one at a time they share a static XML buffer space which is freed when the program exits */ #include "SpiderManager.h" //start point for accessing live objects #include "FilterGroup.h" #include "define_platform.h" using namespace std; class Report { static char *m_xml; bool m_tagNeedsClose; static Filter fAmps; protected: const SpiderManager *m_sm; char *m_pos; static const char *spiderStatus[]; static const char *dcMode[]; Report(const SpiderManager *_sm); void write(const char *xml); void opentag(const char *tagname); void closetag(const char *tagname); void addAttribute(const char *name, const long int value); void addAttribute(const char *name, const char *value, const bool escapeAmpersands=false); void addAttribute(const char *name, const int value); void addAttribute(const char *name, const double value, const unsigned short accuracy = 2); void addAttribute(const char *name, const size_t value); void addAttribute(const char *name, const bool value); void addAttribute(const char *name, in_addr value); //ip address void CDATA(const char *value); public: const char *xml() {return m_xml;} virtual ~Report(); }; #endif