nlib
UriTemplate.h
Go to the documentation of this file.
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)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
Definition: Config.h:163
#define NLIB_VIS_PUBLIC
Symbols for functions and classes are made available outside of the library.
Definition: Platform_unix.h:89
The class that supports URI Template (RFC 6570, Level 3).
Definition: UriTemplate.h:27
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
Definition: Config.h:99
Defines the class for handling URIs.
errno_t Resolve(size_t *written, char(&str)[N]) const noexcept
Calls Resolve(written, str, N).
Definition: UriTemplate.h:37
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
Definition: Config.h:229
int errno_t
Indicates with an int-type typedef that a POSIX error value is returned as the return value...
Definition: NMalloc.h:37