#ifndef LXWEATHER_RESOURCE_H_ #define LXWEATHER_RESOURCE_H_ #include "exception.h" #include "location.h" #include "transport.h" #include #include namespace LXWeather { typedef enum { RESOURCE_UNKNOWN, RESOURCE_YAHOO, RESOURCE_MAX } ResourceType; class ResourceException : public Exception { public: ResourceException(const std::string &msg) : Exception(msg) {}; }; class Resource { public: Resource(const ResourceType type, Transport &transport) : type_(type), location_(NULL), transport_(transport) {}; virtual ~Resource() { if (location_) { delete location_; } }; ResourceType type() { return type_; }; Location *location() const { return location_; }; void location(Location *location) { if (location_) { delete location_; } location_ = location; }; Transport &transport() const { return transport_; }; virtual std::vector findLocation(const std::string &name) = 0; /* virtual std::string forecast(const std::string &URI) = 0;*/ protected: ResourceType type_; Location *location_; Transport &transport_; }; } /* end namespace LXWeather */ #endif /* LXWEATHER_RESOURCE_H_ */