summaryrefslogtreecommitdiff
path: root/src/tests/url.cpp
blob: c9af6769d8d5d5d1e45fc049352fdb02a774fb60 (plain)
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
31
32
#include "bu/url.h"

#include <stdio.h>

int main( int argc, char *argv[] )
{
	printf("encodede: %s\n", Bu::Url::encode( argv[1] ).getStr() );
	printf("decodede: %s\n", Bu::Url::decode( argv[1] ).getStr() );
	Bu::Url u( argv[1] );

	printf("Protocol: %s\n", u.getProtocol().getStr() );
	printf("User:     %s\n", u.getUser().getStr() );
	printf("Pass:     %s\n", u.getPass().getStr() );
	printf("Host:     %s\n", u.getHost().getStr() );
	printf("Path:     %s\n", u.getPath().getStr() );
	try
	{
		printf("Port:     %d\n", u.getPort() );
	} catch( Bu::ExceptionBase &e )
	{
		printf("Port:     not set.\n");
	}
	printf("Parameters:\n");
	for( Bu::Url::ParamList::const_iterator i = u.getParamBegin(); i; i++ )
	{
		printf("  \"%s\" = \"%s\"\n",
			(*i).sName.getStr(), (*i).sValue.getStr()
			);
	}

	return 0;
}