2009-07-02 09:12:38 -04:00
|
|
|
// -*- c++ -*-
|
|
|
|
// Generated by gtkmmproc -- DO NOT MODIFY!
|
|
|
|
#ifndef _GLIBMM_URIUTILS_H
|
|
|
|
#define _GLIBMM_URIUTILS_H
|
|
|
|
|
|
|
|
|
|
|
|
/* $Id: fileutils.hg,v 1.3 2004/01/22 18:38:12 murrayc Exp $ */
|
|
|
|
|
|
|
|
/* Copyright (C) 2002 The gtkmm Development Team
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2009-07-02 12:00:45 -04:00
|
|
|
* modify it under the terms of the GNU Library General Public
|
2009-07-02 09:12:38 -04:00
|
|
|
* License as published by the Free Software Foundation; either
|
2009-07-02 12:00:45 -04:00
|
|
|
* version 2 of the License, or (at your option) any later version.
|
2009-07-02 09:12:38 -04:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2009-07-02 12:00:45 -04:00
|
|
|
* Library General Public License for more details.
|
2009-07-02 09:12:38 -04:00
|
|
|
*
|
2009-07-02 12:00:45 -04:00
|
|
|
* You should have received a copy of the GNU Library General Public
|
2009-07-02 09:12:38 -04:00
|
|
|
* License along with this library; if not, write to the Free
|
|
|
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <glibmmconfig.h>
|
|
|
|
|
|
|
|
GLIBMM_USING_STD(string)
|
|
|
|
|
|
|
|
|
|
|
|
namespace Glib
|
|
|
|
{
|
|
|
|
|
|
|
|
/** @defgroup UriUtils URI Utilities
|
|
|
|
* Various uri-related functions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//Note that the illegal_characters and reserved_chars_allowed parameters are bytes and may not be UTF-8
|
|
|
|
//so they are not Glib::ustring. See http://bugzilla.gnome.org/show_bug.cgi?id=508773
|
|
|
|
|
|
|
|
/** Unescapes a whole escaped string.
|
|
|
|
* If any of the characters in @a illegal_characters or the character zero appears
|
|
|
|
* as an escaped character in @a escaped_string then that is an error and an empty string
|
|
|
|
* will be returned. This is useful it you want to avoid, for instance, having a
|
|
|
|
* slash being expanded in an escaped path element, which might confuse pathname
|
|
|
|
* handling.
|
|
|
|
*
|
|
|
|
* @param escaped_string An escaped string to be unescaped.
|
|
|
|
* @param illegal_characters An optional string of illegal characters not to be allowed.
|
|
|
|
* @result An unescaped version of @a escaped_string.
|
|
|
|
*
|
|
|
|
* @ingroup UriUtils
|
|
|
|
* @newin2p16
|
|
|
|
*/
|
|
|
|
std::string uri_unescape_string(const std::string& escaped_string, const std::string& illegal_characters = std::string());
|
|
|
|
|
|
|
|
//TODO: Use iterator?
|
|
|
|
//char * g_uri_unescape_segment (const char *escaped_string,
|
|
|
|
// const char *escaped_string_end,
|
|
|
|
// const char *illegal_characters);
|
|
|
|
|
|
|
|
/** Gets the scheme portion of a URI. RFC 3986 decodes the scheme as:
|
|
|
|
* @code
|
|
|
|
* URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
|
|
|
* @endcode
|
|
|
|
* Common schemes include "file", "http", "svn+ssh", etc.
|
|
|
|
*
|
|
|
|
* @param uri
|
|
|
|
* @result The "Scheme" component of the URI, or an empty string on error.
|
|
|
|
*
|
|
|
|
* @ingroup UriUtils
|
|
|
|
* @newin2p16
|
|
|
|
*/
|
|
|
|
std::string uri_parse_scheme(const std::string& uri);
|
|
|
|
|
|
|
|
/** Escapes a string for use in a URI.
|
|
|
|
*
|
|
|
|
* Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical
|
|
|
|
* characters plus dash, dot, underscore and tilde) are escaped.
|
|
|
|
* But if you specify characters in @a reserved_chars_allowed they are not
|
|
|
|
* escaped. This is useful for the "reserved" characters in the URI
|
|
|
|
* specification, since those are allowed unescaped in some portions of
|
|
|
|
* a URI.
|
|
|
|
*
|
|
|
|
* @param unescaped The unescaped input string.
|
|
|
|
* @param reserved_chars_allowed A string of reserved characters that are allowed to be used.
|
|
|
|
* @param allow_utf8 true if the result can include UTF-8 characters.
|
|
|
|
* @result An escaped version of @a unescaped.
|
|
|
|
*
|
|
|
|
* @ingroup UriUtils
|
|
|
|
* @newin2p16
|
|
|
|
*/
|
|
|
|
std::string uri_escape_string(const std::string& unescaped, const std::string& reserved_chars_allowed = std::string(), bool allow_utf8 = true);
|
|
|
|
|
|
|
|
} // namespace Glib
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* _GLIBMM_URIUTILS_H */
|
|
|
|
|