1 /* 2 * Copyright 2010 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _B_HTTP_TIME_H_ 6 #define _B_HTTP_TIME_H_ 7 8 #include <ctime> 9 10 #include <DateTime.h> 11 #include <String.h> 12 13 namespace BPrivate { 14 15 #ifndef LIBNETAPI_DEPRECATED 16 namespace Network { 17 #endif 18 19 enum { 20 B_HTTP_TIME_FORMAT_PARSED = -1, 21 B_HTTP_TIME_FORMAT_RFC1123 = 0, 22 B_HTTP_TIME_FORMAT_PREFERRED = B_HTTP_TIME_FORMAT_RFC1123, 23 B_HTTP_TIME_FORMAT_COOKIE, 24 B_HTTP_TIME_FORMAT_RFC1036, 25 B_HTTP_TIME_FORMAT_ASCTIME 26 }; 27 28 29 class BHttpTime { 30 public: 31 BHttpTime(); 32 BHttpTime(BDateTime date); 33 BHttpTime(const BString& dateString); 34 35 // Date modification 36 void SetString(const BString& string); 37 void SetDate(BDateTime date); 38 39 40 // Date conversion 41 BDateTime Parse(); 42 BString ToString(int8 format = B_HTTP_TIME_FORMAT_PARSED); 43 44 private: 45 BString fDateString; 46 BDateTime fDate; 47 int8 fDateFormat; 48 }; 49 50 #ifndef LIBNETAPI_DEPRECATED 51 } // namespace Network 52 #endif 53 54 } // namespace BPrivate 55 #endif // _B_HTTP_TIME_H_ 56