1 /*******************************************************************************
2 
3         Copyright:
4             Copyright (c) 2004 Kris Bell.
5             Some parts copyright (c) 2009-2016 dunnhumby Germany GmbH.
6             All rights reserved.
7 
8         License:
9             Tango Dual License: 3-Clause BSD License / Academic Free License v3.0.
10             See LICENSE_TANGO.txt for details.
11 
12         Version: Initial release: April 2004
13 
14         Authors: Kris
15 
16 *******************************************************************************/
17 
18 module ocean.net.http.model.HttpParamsView;
19 
20 import ocean.meta.types.Qualifiers;
21 
22 import ocean.time.Time;
23 
24 /******************************************************************************
25 
26         Maintains a set of query parameters, parsed from an HTTP request.
27         Use HttpParams instead for output parameters.
28 
29         Note that these input params may have been encoded by the user-
30         agent. Unfortunately there has been little consensus on what that
31         encoding should be (especially regarding GET query-params). With
32         luck, that will change to a consistent usage of UTF-8 within the
33         near future.
34 
35 ******************************************************************************/
36 
37 interface HttpParamsView
38 {
39         /**********************************************************************
40 
41                 Return the number of headers
42 
43         **********************************************************************/
44 
45         uint size ();
46 
47         /**********************************************************************
48 
49                 Return the value of the provided header, or null if the
50                 header does not exist
51 
52         **********************************************************************/
53 
54         cstring get (cstring name, cstring ret = null);
55 
56         /**********************************************************************
57 
58                 Return the integer value of the provided header, or the
59                 provided default-value if the header does not exist
60 
61         **********************************************************************/
62 
63         int getInt (cstring name, int ret = -1);
64 
65         /**********************************************************************
66 
67                 Return the date value of the provided header, or the
68                 provided default-value if the header does not exist
69 
70         **********************************************************************/
71 
72         Time getDate (cstring name, Time ret = Time.epoch);
73 
74         /**********************************************************************
75 
76                 Output the param list to the provided consumer
77 
78         **********************************************************************/
79 
80         void produce (scope size_t delegate(const(void)[]) consume, cstring eol=null);
81 }