nlib
FileStyleUri.h
Go to the documentation of this file.
1 
2 #pragma once
3 #ifndef INCLUDE_NN_NLIB_FILESTYLEURI_H_
4 #define INCLUDE_NN_NLIB_FILESTYLEURI_H_
5 
6 #include "nn/nlib/Config.h"
7 #include "nn/nlib/Uri.h"
8 
9 NLIB_NAMESPACE_BEGIN
10 
12  public:
13  FileStyleUri() NLIB_NOEXCEPT : prv_(NULL) {}
15  bool FromUri(const Uri& uri) NLIB_NOEXCEPT;
16  bool ToUri(Uri* uri) const NLIB_NOEXCEPT NLIB_NONNULL;
17  bool Parse(const char* str) NLIB_NOEXCEPT NLIB_NONNULL;
18  bool ComposeString(
19  char* buf,
20  size_t size) const NLIB_NOEXCEPT NLIB_NONNULL;
21  template <size_t N>
23  char (&buf)[N]) const NLIB_NOEXCEPT {
24  return this->ComposeString(buf, N);
25  }
26  bool SetPath(const char* path) NLIB_NOEXCEPT;
27  size_t GetNumSegment() const NLIB_NOEXCEPT;
28  const char* GetSegment(size_t i) const NLIB_NOEXCEPT;
29  bool AddBaseUri(const Uri& relative, const FileStyleUri& base) NLIB_NOEXCEPT;
30  void Reset() NLIB_NOEXCEPT;
31  bool IsPathDirectory() const NLIB_NOEXCEPT;
32 
33  private:
34  NLIB_VIS_HIDDEN bool CheckInit() const NLIB_NOEXCEPT;
35  struct FileStyleUriPrivate;
36  mutable FileStyleUriPrivate* prv_;
38 };
39 
40 NLIB_NAMESPACE_END
41 
42 #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:145
The class for parsing URIs that use the file scheme and for constructing URI strings.
Definition: FileStyleUri.h:11
#define NLIB_VIS_HIDDEN
Symbols for functions and classes are not made available outside of the library.
Definition: Platform_unix.h:60
#define NLIB_VIS_PUBLIC
Symbols for functions and classes are made available outside of the library.
Definition: Platform_unix.h:61
bool ComposeString(char(&buf)[N]) const noexcept
Writes a URI string.
Definition: FileStyleUri.h:22
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
Definition: Config.h:86
A file that contains the configuration information for each development environment.
The class for parsing and constructing regular URIs.
Definition: Uri.h:17
Defines the class for handling URIs.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
Definition: Config.h:211
#define NLIB_NONNULL
Indicates that you cannot specify NULL for all arguments.
Definition: Platform_unix.h:76
FileStyleUri() noexcept
Instantiates the object with default parameters (default constructor). Initializes an object...
Definition: FileStyleUri.h:13