nlib
UriTemplate.h
[詳解]
1 
2 /*--------------------------------------------------------------------------------*
3  Project: CrossRoad
4  Copyright (C)Nintendo All rights reserved.
5 
6  These coded instructions, statements, and computer programs contain proprietary
7  information of Nintendo and/or its licensed developers and are protected by
8  national and international copyright laws. They may not be disclosed to third
9  parties or copied or duplicated in any form, in whole or in part, without the
10  prior written consent of Nintendo.
11 
12  The content herein is highly confidential and should be handled accordingly.
13  *--------------------------------------------------------------------------------*/
14 
15 #pragma once
16 #ifndef INCLUDE_NN_NLIB_URITEMPLATE_H_
17 #define INCLUDE_NN_NLIB_URITEMPLATE_H_
18 
19 #include "nn/nlib/Uri.h"
20 #include "nn/nlib/Swap.h"
21 
22 NLIB_NAMESPACE_BEGIN
23 
24 class OutputStream;
25 
26 // See RFC6570: https://tools.ietf.org/html/rfc6570
28  public:
29  UriTemplate() NLIB_NOEXCEPT : prv_(NULL) {}
31  NLIB_MOVE_MEMBER_HELPER_1(UriTemplate, prv_);
32  errno_t SetTemplate(const char* str) NLIB_NOEXCEPT;
33  errno_t SetParameter(const char* param, const char* value) NLIB_NOEXCEPT;
34  void ResetParameter() NLIB_NOEXCEPT;
35  errno_t Resolve(size_t* written, char* str, size_t n) const NLIB_NOEXCEPT;
36  template<size_t N>
37  errno_t Resolve(size_t* written, char (&str)[N]) const NLIB_NOEXCEPT {
38  return Resolve(written, str, N);
39  }
40  void swap(UriTemplate& rhs) NLIB_NOEXCEPT {
41  using std::swap;
42  swap(prv_, rhs.prv_);
43  }
44 
45  private:
46  struct UriTemplatePrivate;
47  mutable UriTemplatePrivate* prv_;
49 };
50 
51 NLIB_NAMESPACE_END
52 NLIB_DEFINE_STD_SWAP(::nlib_ns::UriTemplate)
53 #endif // INCLUDE_NN_NLIB_URITEMPLATE_H_
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
TypeName で指定されたクラスのコピーコンストラクタと代入演算子を禁止します。
Definition: Config.h:163
#define NLIB_VIS_PUBLIC
関数やクラス等のシンボルをライブラリの外部に公開します。
Definition: Platform_unix.h:89
URI Template(RFC 6570, Level3)をサポートします。
Definition: UriTemplate.h:27
#define NLIB_NOEXCEPT
環境に合わせてnoexcept 又は同等の定義がされます。
Definition: Config.h:99
URIを扱うためのクラスを定義しています。
errno_t Resolve(size_t *written, char(&str)[N]) const noexcept
Resolve(written, str, N)を呼び出します。
Definition: UriTemplate.h:37
#define NLIB_FINAL
利用可能であればfinalが定義されます。そうでない場合は空文字列です。
Definition: Config.h:229
int errno_t
intのtypedefで、戻り値としてPOSIXのエラー値を返すことを示します。
Definition: NMalloc.h:37