ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/GoogleTron/Url.cpp
Revision: 684
Committed: 2006-03-06T16:16:10-08:00 (19 years, 3 months ago) by douglas
File size: 1260 byte(s)
Log Message:
Oops

File Contents

# Content
1 // Url
2 //
3 // Douglas Thrift
4 //
5 // $Id$
6
7 #include <cxx/standard.hh>
8
9 #include "Url.hpp"
10
11 Url::Url(const cse::String &location, const std::time_t &modified, Frequency frequency, uint8_t priority) : location(location), frequency(frequency), priority(priority)
12 {
13 ::gmtime_r(&modified, &this->modified);
14
15 _assert (priority < 11);
16 }
17
18 Url::Url(const cse::String &location, const std::tm &modified, Frequency frequency, uint8_t priority) : location(location), modified(modified), frequency(frequency), priority(priority)
19 {
20 _assert (priority < 11);
21 }
22
23 cse::String Url::GetModified() const
24 {
25 ext::Buffer buffer(22);
26
27 size_t size(::strftime(buffer.Begin(), buffer.GetSize(), "%FT%TTZ", &modified));
28
29 buffer.SetSize(size);
30
31 return buffer;
32 }
33
34 cse::String Url::GetFrequency() const
35 {
36 switch (frequency)
37 {
38 case always:
39 return _B("always");
40 case hourly:
41 return _B("hourly");
42 case daily:
43 return _B("daily");
44 case weekly:
45 return _B("weekly");
46 case monthly:
47 return _B("monthly");
48 case yearly:
49 return _B("yearly");
50 case never:
51 return _B("never");
52 _nodefault
53 }
54 }
55
56 cse::String Url::GetPriority() const
57 {
58 _assert (priority < 11);
59
60 switch (priority)
61 {
62 default:
63 return _S<ios::String>() << _B("0.") << priority;
64 case 10:
65 return _B("1.0");
66 }
67 }

Properties

Name Value
svn:eol-style native
svn:keywords Id