2010-10-27 18:03:31 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2010 Haiku Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _B_HTTP_TIME_H_
|
|
|
|
#define _B_HTTP_TIME_H_
|
|
|
|
|
|
|
|
#include <ctime>
|
|
|
|
|
2014-01-23 20:20:43 +04:00
|
|
|
#include <DateTime.h>
|
2010-10-27 18:03:31 +04:00
|
|
|
#include <String.h>
|
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
|
|
|
|
enum {
|
|
|
|
B_HTTP_TIME_FORMAT_PARSED = -1,
|
|
|
|
B_HTTP_TIME_FORMAT_RFC1123 = 0,
|
|
|
|
B_HTTP_TIME_FORMAT_PREFERRED = B_HTTP_TIME_FORMAT_RFC1123,
|
|
|
|
B_HTTP_TIME_FORMAT_COOKIE,
|
|
|
|
B_HTTP_TIME_FORMAT_RFC1036,
|
|
|
|
B_HTTP_TIME_FORMAT_ASCTIME
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class BHttpTime {
|
|
|
|
public:
|
|
|
|
BHttpTime();
|
2014-01-23 20:20:43 +04:00
|
|
|
BHttpTime(BDateTime date);
|
2010-10-27 18:03:31 +04:00
|
|
|
BHttpTime(const BString& dateString);
|
|
|
|
|
|
|
|
// Date modification
|
|
|
|
void SetString(const BString& string);
|
2014-01-23 20:20:43 +04:00
|
|
|
void SetDate(BDateTime date);
|
2010-10-27 18:03:31 +04:00
|
|
|
|
|
|
|
|
|
|
|
// Date conversion
|
2014-01-23 20:20:43 +04:00
|
|
|
BDateTime Parse();
|
2010-10-27 18:03:31 +04:00
|
|
|
BString ToString(int8 format = B_HTTP_TIME_FORMAT_PARSED);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BString fDateString;
|
2014-01-23 20:20:43 +04:00
|
|
|
BDateTime fDate;
|
2010-10-27 18:03:31 +04:00
|
|
|
int8 fDateFormat;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif // _B_HTTP_TIME_H_
|