|
bool | SetUri (const char *scheme, const char *userinfo, const char *host, const char *port, const char *path, const char *query, const char *fragment) noexcept |
| URIの各部分を設定します。 [詳解]
|
|
bool | IsAbsolute () const noexcept |
| URIが絶対URIであればtrue を返します。この関数ではschemeが指定されていれば絶対URIであると判断しています。
|
|
bool | AddBaseUri (const Uri &relative, const Uri &base) noexcept |
| 相対パスを解決します。 [詳解]
|
|
const char * | GetScheme () const noexcept |
| URIのスキーム(http, file等)の文字列を返します。 [詳解]
|
|
const char * | GetUserInfo () const noexcept |
| 指定した URI に関連付けられているユーザー名、パスワードなどのユーザー固有の情報を取得します。 [詳解]
|
|
const char * | GetHost () const noexcept |
| ホスト名を取得します。 [詳解]
|
|
const char * | GetPort () const noexcept |
| ポート番号の文字列を取得します。 [詳解]
|
|
int | GetPortNumber () const noexcept |
| ポート番号を取得します。ポート番号の文字列が設定されていてint型へ変換可能な場合は非負の整数を返し、それ以外の場合は-1を返します。
|
|
const char * | GetPath () const noexcept |
| パスを取得します。 [詳解]
|
|
const char * | GetQuery () const noexcept |
| クエリ文字列を取得します [詳解]
|
|
const char * | GetFragment () const noexcept |
| フラグメント文字列を取得します [詳解]
|
|
bool | SetScheme (const char *first, const char *last) noexcept |
| スキームの文字列(末尾の:は含まない)を設定します。
|
|
bool | SetUserInfo (const char *first, const char *last) noexcept |
| 指定した URI に関連付けられているユーザー名、パスワードなどのユーザー固有の情報を設定します。
|
|
bool | SetHost (const char *first, const char *last) noexcept |
| ホスト名を設定します。
|
|
bool | SetPort (const char *first, const char *last) noexcept |
| ポート番号の文字列(:は含まない)を設定します。
|
|
bool | SetPath (const char *first, const char *last) noexcept |
| パスを設定します。
|
|
bool | SetQuery (const char *first, const char *last) noexcept |
| クエリ文字列(先頭の?は含まない)を設定します。
|
|
bool | SetFragment (const char *first, const char *last) noexcept |
| フラグメント文字列(先頭の::は含まない)を設定します。
|
|
bool | SetScheme (const char *scheme) noexcept |
| スキームの文字列(末尾の:は含まない)を設定します。
|
|
bool | SetUserInfo (const char *userinfo) noexcept |
| 指定した URI に関連付けられているユーザー名、パスワードなどのユーザー固有の情報を設定します。
|
|
bool | SetHost (const char *host) noexcept |
| ホスト名を設定します。
|
|
bool | SetPort (const char *port) noexcept |
| ポート番号の文字列(:は含まない)を設定します。
|
|
bool | SetPortNumber (int port) noexcept |
| ポート番号を設定します。
|
|
bool | SetPath (const char *path) noexcept |
| パスを設定します。
|
|
bool | SetQuery (const char *query) noexcept |
| クエリ文字列(先頭の?は含まない)を設定します。
|
|
bool | SetFragment (const char *fragment) noexcept |
| フラグメント文字列(先頭の::は含まない)を設定します。
|
|
template<size_t N> |
bool | SetQuery (const UriQueryEncoder< N > &encoder) noexcept |
| クエリ文字列(先頭の?は含まない)を設定します。
|
|
Error | GetError () const noexcept |
| エラーが発生した場合に詳細な理由を取得することができます。
|
|
| operator bool () const |
| オブジェクトが初期化済みで内部でエラーが発生していなければtrue 、発生していればfalse を返します。
|
|
|
constexpr | Uri () noexcept |
| デフォルトコンストラクタです。
|
|
| Uri (Uri &&rhs) |
| ムーブコンストラクタです。
|
|
Uri & | operator= (Uri &&rhs) |
| ムーブ代入演算子です。
|
|
void | Reset () noexcept |
| このオブジェクトをデフォルトコンストラクタの実行直後の状態にリセットします。
|
|
|
bool | Parse (const char *first, const char *last) noexcept |
| URI文字列をパースします。 [詳解]
|
|
bool | Parse (const char *str) noexcept |
| 上記関数の引数省略版で、ヌル終端する文字列を受け取ります。
|
|
bool | ComposeString (char *buf, size_t size) const noexcept |
| URI文字列を書き出します。 [詳解]
|
|
template<size_t N> |
bool | ComposeString (char(&buf)[N]) const noexcept |
| 上記関数のテンプレートオーバーロードです。
|
|
|
static bool | IsHostName (const nlib_utf8_t *first, const nlib_utf8_t *last) noexcept |
| 文字列がホスト名の要件(RFC1034 3.1)を満たすかどうかを判定します。 [詳解]
|
|
static bool | IsHostName (const nlib_utf8_t *str) noexcept |
| 上記関数の引数省略版で、ヌル終端する文字列を受け取ります。
|
|
static bool | IsIpv4 (const nlib_utf8_t *first, const nlib_utf8_t *last) noexcept |
| 文字列がIPv4の要件を満たすかどうかを判定します。 [詳解]
|
|
static bool | IsIpv4 (const nlib_utf8_t *str) noexcept |
| 上記関数の引数省略版で、ヌル終端する文字列を受け取ります。
|
|
static bool | IsIpv6 (const nlib_utf8_t *first, const nlib_utf8_t *last) noexcept |
| 文字列がIPv6の要件を満たすかどうかを判定します。 [詳解]
|
|
static bool | IsIpv6 (const nlib_utf8_t *str) noexcept |
| 上記関数の引数省略版で、ヌル終端する文字列を受け取ります。
|
|
static bool | IsEmailAddress (const nlib_utf8_t *first, const nlib_utf8_t *last) noexcept |
| 文字列がemailアドレスの要件(RFC5322 3.4)を満たすかどうかを判定します [詳解]
|
|
static bool | IsEmailAddress (const nlib_utf8_t *str) noexcept |
| 上記関数の引数省略版で、ヌル終端する文字列を受け取ります。
|
|
static bool | IsUri (const nlib_utf8_t *first, const nlib_utf8_t *last) noexcept |
| 文字列がURIであるかどうかを判定します。相対パスの場合、URIではなくURI参照となることに注意してください。 [詳解]
|
|
static bool | IsUri (const nlib_utf8_t *str) noexcept |
| 上記関数の引数省略版で、ヌル終端する文字列を受け取ります。
|
|
static bool | IsUriReference (const nlib_utf8_t *first, const nlib_utf8_t *last) noexcept |
| 文字列がURI参照であるかどうかを判定します。 [詳解]
|
|
static bool | IsUriReference (const nlib_utf8_t *str) noexcept |
| 上記関数の引数省略版で、ヌル終端する文字列を受け取ります。
|
|
static bool | IsReserved (int c) noexcept |
| c がRFC3986のReserved Characters であればtrue を返します。
|
|
static bool | IsUnreserved (int c) noexcept |
| c がRFC3986のUnreserved Characters であればtrue を返します。
|
|
static bool | IsHexDigit (int c) noexcept |
| 16進数の数値であればtrue を返します。
|
|
|
static errno_t | DecodeUriComponent (size_t *written, char *buf, size_t n, const char *first, const char *last) noexcept |
| % エンコードされた文字列をデコードします。 [詳解]
|
|
template<size_t N> |
static errno_t | DecodeUriComponent (size_t *written, char(&buf)[N], const char *s) noexcept |
| 上記関数のテンプレートオーバーロードです。
|
|
static errno_t | DecodeUriComponent (size_t *written, char *buf, size_t n, const char *s) noexcept |
| 上記関数の引数省略版で、ヌル終端する文字列を受け取ります。
|
|
template<size_t N> |
static errno_t | DecodeUriComponent (size_t *written, char(&buf)[N], const char *first, const char *last) noexcept |
| 上記関数のテンプレートオーバーロードです。
|
|
static std::pair< errno_t, size_t > | DecodeUriComponent (char *buf, size_t n, const char *first, const char *last) noexcept |
| % エンコードされた文字列をデコードします。エラー値とデコードされた文字列のバイト数(ヌル文字を含まず)のペアを返します。
|
|
template<size_t N> |
static std::pair< errno_t, size_t > | DecodeUriComponent (char(&buf)[N], const char *first, const char *last) noexcept |
| 上記関数のテンプレートオーバーロードです。
|
|
static std::pair< errno_t, size_t > | DecodeUriComponent (char *buf, size_t n, const char *s) noexcept |
| 上記関数の引数省略版で、ヌル終端する文字列を受け取ります。
|
|
template<size_t N> |
static std::pair< errno_t, size_t > | DecodeUriComponent (char(&buf)[N], const char *s) noexcept |
| 上記関数のテンプレートオーバーロードです。
|
|
static errno_t | DecodePath (size_t *written, char *buf, size_t n, const char *s) noexcept |
| % エンコードされた文字列をデコードします。 デコードされた文字が'/'の場合にEILSEQ を返すこと以外は、DecodeUriComponent() と同じです。
|
|
template<size_t N> |
static errno_t | DecodePath (size_t *written, char(&buf)[N], const char *s) noexcept |
| 上記関数のテンプレートオーバーロードです。
|
|
static std::pair< errno_t, size_t > | DecodePath (char *buf, size_t n, const char *s) noexcept |
| % エンコードされた文字列をデコードします。 デコードされた文字が'/'の場合にEILSEQ を返すこと以外は、DecodeUriComponent() と同じです。 [詳解]
|
|
template<size_t N> |
static std::pair< errno_t, size_t > | DecodePath (char(&buf)[N], const char *s) noexcept |
| 上記関数の引数省略版で、settings をデフォルト値で渡します。
|
|
|
static errno_t | EncodeUriComponent (size_t *written, char *buf, size_t n, const char *first, const char *last, bool fragment_mode) noexcept |
| 文字列を% エンコードします。 [詳解]
|
|
template<size_t N> |
static errno_t | EncodeUriComponent (size_t *written, char(&buf)[N], const char *first, const char *last, bool fragment_mode) noexcept |
| 上記関数のテンプレートオーバーロードです。
|
|
static errno_t | EncodeUriComponent (size_t *written, char *buf, size_t n, const char *s, bool fragment_mode) noexcept |
|
template<size_t N> |
static errno_t | EncodeUriComponent (size_t *written, char(&buf)[N], const char *s, bool fragment_mode) noexcept |
| 上記関数のテンプレートオーバーロードです。
|
|
static std::pair< errno_t, size_t > | EncodeUriComponent (char *buf, size_t n, const char *first, const char *last, bool fragment_mode) noexcept |
| 文字列を% エンコードします。エラー値とエンコードされた文字列のバイト数(ヌル文字を含まず)のペアを返します。
|
|
template<size_t N> |
static std::pair< errno_t, size_t > | EncodeUriComponent (char(&buf)[N], const char *first, const char *last, bool fragment_mode) noexcept |
| 上記関数のテンプレートオーバーロードです。
|
|
static std::pair< errno_t, size_t > | EncodeUriComponent (char *buf, size_t n, const char *s, bool fragment_mode) |
|
template<size_t N> |
static std::pair< errno_t, size_t > | EncodeUriComponent (char(&buf)[N], const char *s, bool fragment_mode) |
| 上記関数のテンプレートオーバーロードです。
|
|
static errno_t | EncodePath (size_t *written, char *buf, size_t n, const char *s) noexcept |
| 文字列を% エンコードします。'/'を% エンコードしないこと以外は、EncodeUriComponent() と同じです。
|
|
template<size_t N> |
static errno_t | EncodePath (size_t *written, char(&buf)[N], const char *s) noexcept |
| 上記関数のテンプレートオーバーロードです。
|
|
static std::pair< errno_t, size_t > | EncodePath (char *buf, size_t n, const char *s) noexcept |
| test
|
|
template<size_t N> |
static std::pair< errno_t, size_t > | EncodePath (char(&buf)[N], const char *s) noexcept |
| 上記関数のテンプレートオーバーロードです。
|
|
一般的なURIをパースしたり構築したりするためのクラスです。
- 説明
HttpStyleUri
, FileStyleUri
はこのクラスを利用してURIをパースしています。
- 相対URI(相対パス)を利用する場合にもこのクラスを用います。 パースする際には、
%
エンコードされた文字の一部をデコードします。 デコードされる文字は、RFC3986のunreserved(ALPHA / DIGIT / "-" / "." / "_" / "~")
に属する文字です。 それ以外の文字は%
エンコードされたままです。
- 以下がコード例です。
bool result = uri.
Parse(
"http://www.example.com/dir/index.html?query=test#part1");
SUCCEED_IF(!!result);
- 参照
- https://www.ietf.org/rfc/rfc3986.txt (RFC 3986)
-
http://www.eonet.ne.jp/~h-hash/rfc_ja/rfc3986.ja.html (RFC 3986, in Japanese)
- 各種例:
- misc/uri/uri.cpp.
Uri.h の 51 行目に定義があります。