ce64ffdb90
In order to prevent classes between libnetapi.so with the legacy API and applications using the libnetservices.a library, the latter will have the classes in a distinct namespace. In the implementation, both libbnetapi.so and libnetservices.a will use the same header and source files. If LIBNETAPI_DEPRECATED is defined during build, the headers and source will have binary compatible behavior. Otherwise, the classes and other objects will be put in the HaikuExt namespace. In order to build the libbnetapi.so and libnetservices.a with the proper build configuration, there is a stub `src/kits/net/libnetapi_deprecated` folder that applies the special configuration to the source files. Currently HaikuDepot, Webpositive, libshared.a and the http_streamer add on use the compatible API in libbnetapi.so. Change-Id: Ic73e9f271ef75749adda46f6f72e9a0b2851b461 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3667 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
56 lines
1.0 KiB
C++
56 lines
1.0 KiB
C++
/*
|
|
* 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>
|
|
|
|
#include <DateTime.h>
|
|
#include <String.h>
|
|
|
|
namespace BPrivate {
|
|
|
|
#ifndef LIBNETAPI_DEPRECATED
|
|
namespace Network {
|
|
#endif
|
|
|
|
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();
|
|
BHttpTime(BDateTime date);
|
|
BHttpTime(const BString& dateString);
|
|
|
|
// Date modification
|
|
void SetString(const BString& string);
|
|
void SetDate(BDateTime date);
|
|
|
|
|
|
// Date conversion
|
|
BDateTime Parse();
|
|
BString ToString(int8 format = B_HTTP_TIME_FORMAT_PARSED);
|
|
|
|
private:
|
|
BString fDateString;
|
|
BDateTime fDate;
|
|
int8 fDateFormat;
|
|
};
|
|
|
|
#ifndef LIBNETAPI_DEPRECATED
|
|
} // namespace Network
|
|
#endif
|
|
|
|
} // namespace BPrivate
|
|
#endif // _B_HTTP_TIME_H_
|