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 {
|
|
|
|
|
2021-01-22 17:20:19 +03:00
|
|
|
namespace Network {
|
|
|
|
|
2010-10-27 18:03:31 +04:00
|
|
|
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);
|
2021-09-11 10:09:44 +03:00
|
|
|
|
2010-10-27 18:03:31 +04:00
|
|
|
// Date modification
|
|
|
|
void SetString(const BString& string);
|
2014-01-23 20:20:43 +04:00
|
|
|
void SetDate(BDateTime date);
|
2021-09-11 10:09:44 +03:00
|
|
|
|
|
|
|
|
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);
|
2021-09-11 10:09:44 +03:00
|
|
|
|
2010-10-27 18:03:31 +04:00
|
|
|
private:
|
|
|
|
BString fDateString;
|
2014-01-23 20:20:43 +04:00
|
|
|
BDateTime fDate;
|
2010-10-27 18:03:31 +04:00
|
|
|
int8 fDateFormat;
|
|
|
|
};
|
|
|
|
|
2021-01-22 17:20:19 +03:00
|
|
|
} // namespace Network
|
|
|
|
|
|
|
|
} // namespace BPrivate
|
2021-09-11 10:09:44 +03:00
|
|
|
|
2010-10-27 18:03:31 +04:00
|
|
|
#endif // _B_HTTP_TIME_H_
|