00001
00002
00003
00004
00005
00006
00007
00008 #ifndef PHOTO_H_
00009 #define PHOTO_H_
00010
00011 #include "Util/XmlDoc.h"
00012 #include "Persistency/XmlFileReader.h"
00013
00014 namespace Impala {
00015 namespace Application {
00016 namespace TagsLife {
00017
00018 using namespace std;
00019
00020 class Photo : public Util::XmlDoc{
00021 public:
00022 string id, secret;
00023 int farm, server;
00024 string owner, title, ownername;
00025 float latitude, longitude;
00026 int views;
00027
00028
00029
00030 Photo(DOMNode* photo) {
00031 initPhoto(photo);
00032 }
00033
00034
00035 string imageUrl() {return imageUrl("");}
00036
00037 string imageUrl(string sizeSuffix) {
00038 string url = "http://farm";
00039 url += MakeString(farm);
00040 url += ".static.flickr.com/";
00041 url += MakeString(server) + "/";
00042 url += id + "_" + secret;
00043 if(sizeSuffix.length() > 0) url += "_" + sizeSuffix;
00044 url += ".jpg";
00045 return(url);
00046 }
00047
00048 private:
00049 void initPhoto(DOMNode* photo) {
00050
00051
00052
00053
00054
00055
00056 id = GetAttributeValue(photo, "id");
00057 secret = GetAttributeValue(photo, "secret");
00058
00059 farm = atoi(GetAttributeValue(photo, "farm"));
00060 server = atoi(GetAttributeValue(photo, "server"));
00061
00062 owner = GetAttributeValue(photo, "owner");
00063 title = GetAttributeValue(photo, "title");
00064 ownername = GetAttributeValue(photo, "ownername");
00065
00066 latitude = atof(GetAttributeValue(photo, "latitude"));
00067 longitude = atof(GetAttributeValue(photo, "longitude"));
00068
00069 views = atoi(GetAttributeValue(photo, "views"));
00070 }
00071 ILOG_VAR_DEC;
00072 };
00073
00074 ILOG_VAR_INIT(Photo, Impala.Application.TagsLife);
00075
00076 }
00077 }
00078 }
00079
00080 #endif