monotone

monotone Mtn Source Tree

Root/uri.hh

1// Copyright (C) 2006 Graydon Hoare <graydon@pobox.com>
2//
3// This program is made available under the GNU GPL version 2.0 or
4// greater. See the accompanying file COPYING for details.
5//
6// This program is distributed WITHOUT ANY WARRANTY; without even the
7// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8// PURPOSE.
9
10#ifndef __URI_HH__
11#define __URI_HH__
12
13#include "sanity.hh"
14
15struct uri_t
16{
17 std::string scheme;
18 std::string user;
19 std::string host;
20 std::string port;
21 std::string path;
22 std::string query;
23 std::string fragment;
24
25 void clear()
26 {
27 scheme.clear();
28 user.clear();
29 host.clear();
30 port.clear();
31 path.clear();
32 query.clear();
33 fragment.clear();
34 }
35
36 std::string resource() const
37 {
38 std::string res;
39 if (!scheme.empty())
40 res += scheme + ":";
41 std::string authority;
42 if (!user.empty())
43 authority += user + "@";
44 if (!host.empty())
45 authority += host;
46 if (!port.empty())
47 authority += ":" + port;
48 if (!authority.empty())
49 res += "//" + authority;
50 if (!path.empty())
51 res += path;
52 return res;
53 }
54};
55
56void
57parse_uri(std::string const & in, uri_t & uri, origin::type made_from);
58
59std::string
60urldecode(std::string const & in, origin::type made_from);
61
62#endif
63
64// Local Variables:
65// mode: C++
66// fill-column: 76
67// c-file-style: "gnu"
68// indent-tabs-mode: nil
69// End:
70// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status