forked from cpp-netlib/cpp-netlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrss.hpp
81 lines (52 loc) · 1.75 KB
/
rss.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright (c) Glyn Matthews 2011.
// Copyright 2012 Google, Inc.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef ___RSS_INC__
#define ___RSS_INC__
#include <string>
#include <vector>
#include <network/http/client.hpp>
namespace network {
namespace rss {
class item {
public:
void set_title(const std::string& title) { title_ = title; }
std::string title() const { return title_; }
void set_author(const std::string& author) { author_ = author; }
std::string author() const { return author_; }
void set_description(const std::string& description) {
description_ = description;
}
std::string description() const { return description_; }
private:
std::string title_;
std::string author_;
std::string description_;
};
class channel {
public:
typedef item value_type;
typedef std::vector<item>::iterator iterator;
typedef std::vector<item>::const_iterator const_iterator;
channel(const http::client::response& response);
std::string title() const { return title_; }
std::string description() const { return description_; }
std::string link() const { return link_; }
std::string author() const { return author_; }
unsigned int item_count() const { return items_.size(); }
iterator begin() { return items_.begin(); }
iterator end() { return items_.end(); }
const_iterator begin() const { return items_.begin(); }
const_iterator end() const { return items_.end(); }
private:
std::string title_;
std::string description_;
std::string link_;
std::string author_;
std::vector<item> items_;
};
} // namespace rss
} // namespace network
#endif // ___RSS_INC__