00001 #ifndef __ARC_SEC_SOURCE_H__ 00002 #define __ARC_SEC_SOURCE_H__ 00003 00004 #include <fstream> 00005 #include <arc/XMLNode.h> 00006 #include <arc/URL.h> 00007 00008 namespace ArcSec { 00009 00011 00013 class Source { 00014 private: 00015 Arc::XMLNode node; 00016 Source(void) { }; 00017 public: 00019 00022 Source(const Source& s):node(s.node) { }; 00024 00026 Source(Arc::XMLNode xml); 00028 Source(std::istream& stream); 00030 00031 Source(Arc::URL& url); 00033 Source(const std::string& str); 00035 Arc::XMLNode Get(void) const { return node; }; 00037 operator bool(void) { return (bool)node; }; 00038 operator Arc::XMLNode(void) { return node; }; 00039 }; 00040 00042 class SourceFile: public Source { 00043 private: 00044 std::ifstream* stream; 00045 SourceFile(void):Source(std::string("")) {}; 00046 public: 00048 SourceFile(const SourceFile& s):Source(s),stream(NULL) {}; 00050 SourceFile(const char* name); 00052 SourceFile(const std::string& name); 00053 ~SourceFile(void); 00054 }; 00055 00057 class SourceURL: public Source { 00058 private: 00059 Arc::URL* url; 00060 SourceURL(void):Source(std::string("")) {}; 00061 public: 00063 SourceURL(const SourceURL& s):Source(s),url(NULL) {}; 00065 SourceURL(const char* url); 00067 SourceURL(const std::string& url); 00068 ~SourceURL(void); 00069 }; 00070 00071 } 00072 00073 #endif 00074