nlib
FileStyleUri.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_FILESTYLEURI_H_
17 #define INCLUDE_NN_NLIB_FILESTYLEURI_H_
18 
19 #include "nn/nlib/Config.h"
20 #include "nn/nlib/Uri.h"
21 #include "nn/nlib/Swap.h"
22 
23 NLIB_NAMESPACE_BEGIN
24 
26  public:
28  ~FileStyleUri() NLIB_NOEXCEPT { Reset(); }
29  NLIB_DEFMOVE_PIMPL(FileStyleUri);
31  using std::swap;
32  swap(prv_, rhs.prv_);
33  }
34  bool FromUri(const Uri& uri) NLIB_NOEXCEPT;
35  bool ToUri(Uri* uri) const NLIB_NOEXCEPT NLIB_NONNULL;
36  bool Parse(const char* first, const char* last) NLIB_NOEXCEPT NLIB_NONNULL;
37  bool Parse(const char* str) NLIB_NOEXCEPT {
38  return Parse(str, str + nlib_strlen(str));
39  }
40  bool ComposeString(
41  char* buf,
42  size_t size) const NLIB_NOEXCEPT NLIB_NONNULL;
43  template <size_t N>
45  char (&buf)[N]) const NLIB_NOEXCEPT {
46  return this->ComposeString(buf, N);
47  }
48  bool SetPath(const char* path) NLIB_NOEXCEPT;
49  size_t GetNumSegment() const NLIB_NOEXCEPT;
50  const char* GetSegment(size_t i) const NLIB_NOEXCEPT;
51  bool AddBaseUri(const Uri& relative, const FileStyleUri& base) NLIB_NOEXCEPT;
52  void Reset() NLIB_NOEXCEPT;
53  bool IsPathDirectory() const NLIB_NOEXCEPT;
54 
55  private:
56  NLIB_VIS_HIDDEN bool CheckInit() const NLIB_NOEXCEPT;
57  struct FileStyleUriPrivate;
58  mutable FileStyleUriPrivate* prv_;
60 };
61 
62 NLIB_NAMESPACE_END
63 #ifndef __cpp_rvalue_references
64 NLIB_DEFINE_STD_SWAP(::nlib_ns::FileStyleUri)
65 #endif
66 #endif // INCLUDE_NN_NLIB_FILESTYLEURI_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:179
The class for parsing URIs that use the file scheme and for constructing URI strings.
Definition: FileStyleUri.h:25
bool Parse(const char *str) noexcept
Returns Parse(str, str + nlib_strlen(str)).
Definition: FileStyleUri.h:37
#define NLIB_VIS_HIDDEN
Symbols for functions and classes are not made available outside of the library.
Definition: Platform_unix.h:88
#define NLIB_DEPRECATED
Indicates that a function or something has been deprecated.
Definition: Config.h:109
#define NLIB_VIS_PUBLIC
Symbols for functions and classes are made available outside of the library.
Definition: Platform_unix.h:89
bool ComposeString(char(&buf)[N]) const noexcept
Writes a URI string.
Definition: FileStyleUri.h:44
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
Definition: Config.h:105
#define NLIB_CEXPR
Defines constexpr if it is available for use. If not, holds an empty string.
Definition: Config.h:107
A file that contains the configuration information for each development environment.
The class for parsing and constructing regular URIs.
Definition: Uri.h:51
Defines the class for handling URIs.
size_t nlib_strlen(const char *s)
Internally calls strlen(). In some cases, it may operate as an independent implementation.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
Definition: Config.h:245
#define NLIB_NONNULL
Indicates that you cannot specify NULL for all arguments.
constexpr FileStyleUri() noexcept
Instantiates the object with default parameters (default constructor). Initializes an object...
Definition: FileStyleUri.h:27