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 { this->Reset(); }
15  NLIB_VIS_PUBLIC bool FromUri(const Uri& uri) NLIB_NOEXCEPT;
16  NLIB_VIS_PUBLIC bool ToUri(Uri* uri) const NLIB_NOEXCEPT NLIB_NONNULL;
17  NLIB_VIS_PUBLIC bool Parse(const char* str) NLIB_NOEXCEPT NLIB_NONNULL;
18  NLIB_VIS_PUBLIC bool ComposeString(char* buf, size_t size) const NLIB_NOEXCEPT NLIB_NONNULL;
19  template <size_t N>
20  bool ComposeString(char (&buf)[N]) const NLIB_NOEXCEPT {
21  return this->ComposeString(buf, N);
22  }
23  NLIB_VIS_PUBLIC bool SetPath(const char* path) NLIB_NOEXCEPT;
24  size_t GetNumSegment() const NLIB_NOEXCEPT {
25  return m_Segments.GetNumSegment();
26  }
27  const char* GetSegment(size_t i) const NLIB_NOEXCEPT {
28  return m_Segments.GetSegment(i);
29  }
30  NLIB_VIS_PUBLIC bool AddBaseUri(const Uri& relative, const FileStyleUri& base) NLIB_NOEXCEPT;
31  void Reset() NLIB_NOEXCEPT { m_Segments.Reset(); }
32  bool IsPathDirectory() const NLIB_NOEXCEPT {
33  return m_Segments.IsDirectory();
34  }
35 
36  private:
37  detail::Segments m_Segments;
39 };
40 
41 NLIB_NAMESPACE_END
42 
43 #endif // INCLUDE_NN_NLIB_FILESTYLEURI_H_
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
Definition: Platform.h:2151
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
#define NLIB_NONNULL
Indicates that you cannot specify NULL for all arguments.
Definition: Platform_unix.h:66
#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:126
The class for parsing URIs that use the file scheme and for constructing URI strings.
Definition: FileStyleUri.h:11
const char * GetSegment(size_t i) const noexcept
Specifies an index and gets a segment.
Definition: FileStyleUri.h:27
size_t GetNumSegment() const noexcept
Gets the number of stored segments.
Definition: FileStyleUri.h:24
bool IsPathDirectory() const noexcept
Gets whether the path is in the form of a directory path.
Definition: FileStyleUri.h:32
void Reset() noexcept
Initializes (resets) an object.
Definition: FileStyleUri.h:31
A file that contains the configuration information for each development environment.
The class for parsing and constructing regular URIs.
Definition: Uri.h:18
Defines the class for handling URIs.
#define NLIB_VIS_PUBLIC
Symbols for functions and classes are made available outside of the library.
Definition: Platform_unix.h:51
FileStyleUri() noexcept
Instantiates the object with default parameters (default constructor). Initializes an object...
Definition: FileStyleUri.h:13