nlib
NativePathMapper.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_NATIVEPATHMAPPER_H_
17 #define INCLUDE_NN_NLIB_NATIVEPATHMAPPER_H_
18 
19 #include <utility>
20 #include "nn/nlib/Config.h"
21 #include "nn/nlib/Swap.h"
22 
23 NLIB_NAMESPACE_BEGIN
24 
26  public:
29  NLIB_DEFMOVE_PIMPL(NativePathMapper);
30  void Reset() NLIB_NOEXCEPT;
31  errno_t AddMap(const char* native_prefix, const char* uri_prefix) NLIB_NOEXCEPT;
32  errno_t
33  ResolvePath(size_t* count, char* native, size_t n, const char* uri_path) const NLIB_NOEXCEPT;
34  template<size_t N>
35  errno_t
36  ResolvePath(size_t* count, char (&native)[N], const char* uri_path) const NLIB_NOEXCEPT {
37  return ResolvePath(count, native, N, uri_path);
38  }
39  std::pair<errno_t, size_t>
40  ResolvePath(char* native, size_t n, const char* uri_path) const NLIB_NOEXCEPT {
41  size_t count;
42  errno_t e = ResolvePath(&count, native, n, uri_path);
43  return std::make_pair(e, count);
44  }
45  template<size_t N>
46  std::pair<errno_t, size_t>
47  ResolvePath(char (&native)[N], const char* uri_path) const NLIB_NOEXCEPT {
48  size_t count;
49  errno_t e = ResolvePath(&count, native, N, uri_path);
50  return std::make_pair(e, count);
51  }
52 
53  private:
54  struct NativePathMapperPrivate;
55  NativePathMapperPrivate* prv_;
57 };
58 
59 NLIB_NAMESPACE_END
60 #ifndef __cpp_rvalue_references
61 NLIB_DEFINE_STD_SWAP(::nlib_ns::NativePathMapper)
62 #endif
63 #endif // INCLUDE_NN_NLIB_NATIVEPATHMAPPER_H_
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
TypeName で指定されたクラスのコピーコンストラクタと代入演算子を禁止します。
Definition: Config.h:183
constexpr NativePathMapper() noexcept
デフォルトコンストラクタです。
#define NLIB_VIS_PUBLIC
関数やクラス等のシンボルをライブラリの外部に公開します。
Definition: Platform_unix.h:87
std::pair< errno_t, size_t > ResolvePath(char(&native)[N], const char *uri_path) const noexcept
上記関数のテンプレートオーバーロードです。
~NativePathMapper() noexcept
デストラクタです。
機種依存しないURIによるパス記述からネイティブのパス文字列を得るためのクラスです。 ...
#define NLIB_NOEXCEPT
環境に合わせてnoexcept 又は同等の定義がされます。
Definition: Config.h:109
#define NLIB_CEXPR
利用可能であればconstexprが定義されます。そうでない場合は空文字列です。
Definition: Config.h:111
開発環境別の設定が書かれるファイルです。
#define NLIB_FINAL
利用可能であればfinalが定義されます。そうでない場合は空文字列です。
Definition: Config.h:250
std::pair< errno_t, size_t > ResolvePath(char *native, size_t n, const char *uri_path) const noexcept
エラー値と書き込まれた文字列のバイト数のペアを返します。
int errno_t
intのtypedefで、戻り値としてPOSIXのエラー値を返すことを示します。
Definition: NMalloc.h:37