Add Image accessor functions
This commit is contained in:
parent
b29bc17bee
commit
c97b821587
65
src/rss.cpp
65
src/rss.cpp
@ -221,6 +221,71 @@ std::string rss::getLastBuildDate() const {
|
||||
return cdata_to_string(tmp);
|
||||
}
|
||||
|
||||
std::string rss::getImageURL() const {
|
||||
if(!_ok)
|
||||
return "";
|
||||
|
||||
rapidxml::xml_node<> *tmp = _item_node->first_node("image");
|
||||
if(tmp == 0)
|
||||
return "";
|
||||
tmp = tmp->first_node("url");
|
||||
if(tmp == 0)
|
||||
return "";
|
||||
return cdata_to_string(tmp);
|
||||
}
|
||||
|
||||
std::string rss::getImageTitle() const {
|
||||
if(!_ok)
|
||||
return "";
|
||||
|
||||
rapidxml::xml_node<> *tmp = _item_node->first_node("image");
|
||||
if(tmp == 0)
|
||||
return "";
|
||||
tmp = tmp->first_node("title");
|
||||
if(tmp == 0)
|
||||
return "";
|
||||
return cdata_to_string(tmp);
|
||||
}
|
||||
|
||||
std::string rss::getimageLink() const {
|
||||
if(!_ok)
|
||||
return "";
|
||||
|
||||
rapidxml::xml_node<> *tmp = _item_node->first_node("image");
|
||||
if(tmp == 0)
|
||||
return "";
|
||||
tmp = tmp->first_node("link");
|
||||
if(tmp == 0)
|
||||
return "";
|
||||
return cdata_to_string(tmp);
|
||||
}
|
||||
|
||||
int rss::getimageWidth() const {
|
||||
if(!_ok)
|
||||
return 0;
|
||||
|
||||
rapidxml::xml_node<> *tmp = _item_node->first_node("image");
|
||||
if(tmp == 0)
|
||||
return 0;
|
||||
tmp = tmp->first_node("width");
|
||||
if(tmp == 0)
|
||||
return 0;
|
||||
return atoi(tmp->value());
|
||||
}
|
||||
|
||||
int rss::getimageHeight() const {
|
||||
if(!_ok)
|
||||
return 0;
|
||||
|
||||
rapidxml::xml_node<> *tmp = _item_node->first_node("image");
|
||||
if(tmp == 0)
|
||||
return 0;
|
||||
tmp = tmp->first_node("height");
|
||||
if(tmp == 0)
|
||||
return 0;
|
||||
return atoi(tmp->value());
|
||||
}
|
||||
|
||||
int rss::getItemCount() const {
|
||||
if(!_ok)
|
||||
return -1;
|
||||
|
@ -54,8 +54,14 @@ namespace rss_utils {
|
||||
std::string getDocs() const;
|
||||
std::string getTTL() const;
|
||||
std::string getLastBuildDate() const;
|
||||
int getItemCount() const;
|
||||
|
||||
std::string getImageURL() const;
|
||||
std::string getImageTitle() const;
|
||||
std::string getImageLink() const;
|
||||
int getImageWidth() const;
|
||||
int getImageHeight() const;
|
||||
|
||||
int getItemCount() const;
|
||||
std::vector<item> getItems();
|
||||
|
||||
item& getItem(const int);
|
||||
@ -64,7 +70,6 @@ namespace rss_utils {
|
||||
const item& operator[](const int) const;
|
||||
|
||||
//TODO
|
||||
//std::string getImage() const;
|
||||
//std::string getCloud() const;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user