1 module mars.RequestParams;
2 
3 import std.conv;
4 
5 class RequestParams {
6 	
7 	private string[string] params;
8 	
9 	string[string] getParams() {
10 		return params;
11 	}
12 	
13 	string toJson() {
14 		import std.json;
15 		
16 		return JSONValue(params).toString;
17 	}
18 	
19 	/**
20 	 * string value
21 	 */
22 	void put(string key, string value) {
23 		params[key] = value;
24 	}
25 	
26 	/**
27 	 * boolean value
28 	 */
29 	void put(string key, bool value) {
30 		params[key] = to!string(value);
31 	}
32 	
33 	/**
34 	 * signed 8 bits
35 	 */
36 	void put(string key, byte value) {
37 		params[key] = to!string(value);
38 	}
39 	
40 	/**
41 	 * signed 16 bits
42 	 */
43 	void put(string key, short value) {
44 		params[key] = to!string(value);
45 	}
46 	
47 	/**
48 	 * signed 32 bits
49 	 */
50 	void put(string key, int value) {
51 		params[key] = to!string(value);
52 	}
53 	
54 	/**
55 	 * signed 64 bits
56 	 */
57 	void put(string key, long value) {
58 		params[key] = to!string(value);
59 	}
60 	
61 	/**
62 	 * 32 bit floating point
63 	 */
64 	void put(string key, float value) {
65 		params[key] = to!string(value);
66 	}
67 	
68 	/**
69 	 * 64 bit floating point
70 	 */
71 	void put(string key, double value) {
72 		params[key] = to!string(value);
73 	}
74 	
75 	/**
76 	 * largest FP size implemented in hardwareImplementation Note:
77 	 * 80 bits for x86 CPUs or double size, whichever is larger
78 	 */
79 	void put(string key, real value) {
80 		params[key] = to!string(value);
81 	}
82 }