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
33
34
35
36
37
38
39
40
41
42
|
/*
* Copyright (C) 2007-2008 Xagasoft, All rights reserved.
*
* This file is part of the libbu++ library and is released under the
* terms of the license contained in the file LICENSE.
*/
#include "bu/url.h"
#include <stdio.h>
int main( int argc, char *argv[] )
{
for( argc--, argv++; argc >= 0; argc--, argv++ )
{
printf("encodede: %s\n", Bu::Url::encode( *argv ).getStr() );
printf("decodede: %s\n", Bu::Url::decode( *argv ).getStr() );
Bu::Url u( *argv );
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;
}
|