File: params.cc

package info (click to toggle)
libopkele 2.0.4-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,844 kB
  • ctags: 1,075
  • sloc: sh: 10,137; cpp: 4,879; makefile: 175; xml: 82; ansic: 70; sql: 55
file content (30 lines) | stat: -rw-r--r-- 612 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <opkele/types.h>
#include <opkele/exception.h>
#include <opkele/util.h>
#include <openssl/sha.h>
#include <openssl/hmac.h>

#include "config.h"

namespace opkele {
    using namespace std;

    string params_t::append_query(const string& url,const char *prefix) const {
	string rv = url;
	bool p = true;
	if(rv.find('?')==string::npos) {
	    rv += '?'; p = false; }
	for(fields_iterator i=fields_begin();i!=fields_end();++i) {
	    if(p)
		rv += '&';
	    else
		p = true;
	    if(prefix) rv += prefix;
	    rv += *i;
	    rv += '=';
	    rv += util::url_encode(get_field(*i));
	}
	return rv;
    }

}