ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/GoogleTron/Url.cpp
Revision: 677
Committed: 2006-03-04T07:11:04-08:00 (19 years, 4 months ago) by douglas
File size: 1017 byte(s)
Log Message:
I should probably go to sleep now...

File Contents

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

Properties

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