aboutsummaryrefslogtreecommitdiff
path: root/web/mime-url-encoding.hxx
blob: b9d2a76e121be4b05e0e9d108cbcafd3d9ee793e (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
// file      : web/mime-url-encoding.hxx -*- C++ -*-
// license   : MIT; see accompanying LICENSE file

#ifndef WEB_MIME_URL_ENCODING_HXX
#define WEB_MIME_URL_ENCODING_HXX

#include <string>

namespace web
{
  // URL-encode characters other than unreserved (see RFC3986). If the query
  // flag is true, then the encoding is applied to the URL query part, and so
  // convert space characters to plus characters rather than percent-encode
  // them.
  //
  std::string
  mime_url_encode (const char*, bool query = true);

  std::string
  mime_url_encode (const std::string&, bool query = true);

  // If the query flag is true, then convert plus characters to space
  // characters (see above). Throw std::invalid_argument if an invalid encoding
  // sequence is encountered.
  //
  std::string
  mime_url_decode (const char* b, const char* e,
                   bool trim = false,
                   bool query = true);
}

#endif // WEB_MIME_URL_ENCODING_HXX