xref: /haiku/headers/private/netservices/GopherRequest.h (revision 560961ee2a8044537147b4cebdbfd0de13ccaa58)
1 /*
2  * Copyright 2014 Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _B_GOPHER_REQUEST_H_
6 #define _B_GOPHER_REQUEST_H_
7 
8 
9 #include <deque>
10 
11 #include <NetworkRequest.h>
12 #include <UrlProtocolRoster.h>
13 
14 
15 #ifndef LIBNETAPI_DEPRECATED
16 namespace BPrivate {
17 
18 namespace Network {
19 #endif
20 
21 class BGopherRequest : public BNetworkRequest {
22 public:
23 	virtual						~BGopherRequest();
24 
25 			status_t			Stop();
26 	const 	BUrlResult&			Result() const;
27             void                SetDisableListener(bool disable);
28 
29 private:
30 			friend class BUrlProtocolRoster;
31 
32 #ifdef LIBNETAPI_DEPRECATED
33 								BGopherRequest(const BUrl& url,
34 									BUrlProtocolListener* listener = NULL,
35 									BUrlContext* context = NULL);
36 #else
37 								BGopherRequest(const BUrl& url,
38 									BDataIO* output,
39 									BUrlProtocolListener* listener = NULL,
40 									BUrlContext* context = NULL);
41 #endif
42 
43 			status_t			_ProtocolLoop();
44 			void				_SendRequest();
45 
46 			bool				_NeedsParsing();
47 			bool				_NeedsLastDotStrip();
48 #ifdef LIBNETAPI_DEPRECATED
49 			void				_ParseInput(bool last);
50 #else
51 			status_t			_ParseInput(bool last);
52 #endif
53 
54 			BString&			_HTMLEscapeString(BString &str);
55 
56 private:
57 			char				fItemType;
58 			BString				fPath;
59 
60 			ssize_t				fPosition;
61 
62 			BUrlResult			fResult;
63 };
64 
65 #ifndef LIBNETAPI_DEPRECATED
66 } // namespace Network
67 
68 } // namespace BPrivate
69 #endif
70 
71 #endif // _B_GOPHER_REQUEST_H_
72