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 |
|
|
} |