17 #ifndef COM_BORA_SOFTWARE__BALAU_RESOURCE__URI 18 #define COM_BORA_SOFTWARE__BALAU_RESOURCE__URI 29 class ByteReadResource;
30 class ByteWriteResource;
31 class Utf8To32ReadResource;
32 class Utf32To8WriteResource;
44 public:
virtual bool hasNext()
const = 0;
51 public:
virtual std::unique_ptr<Uri>
next() = 0;
91 public:
virtual bool hasNext()
const = 0;
98 public:
virtual std::unique_ptr<Uri>
next() = 0;
137 public:
virtual std::unique_ptr<Uri> clone()
const = 0;
153 public:
virtual std::unique_ptr<Uri> append(
const std::string & pathComponent)
const = 0;
172 public:
virtual std::unique_ptr<Uri> resolve(std::string_view path)
const = 0;
179 public:
virtual bool isRegularDirectory()
const = 0;
186 public:
virtual bool isRegularFile()
const = 0;
193 public:
virtual std::string toUriString()
const = 0;
201 public:
virtual std::string toRawString()
const = 0;
208 public:
virtual size_t hashcode()
const noexcept = 0;
213 public:
virtual bool canReadFrom()
const = 0;
218 public:
virtual bool canWriteTo()
const = 0;
226 public:
virtual std::unique_ptr<ByteReadResource> byteReadResource()
const = 0;
234 public:
virtual std::unique_ptr<Utf8To32ReadResource> utf8To32ReadResource()
const = 0;
242 public:
virtual std::unique_ptr<ByteWriteResource> byteWriteResource() = 0;
250 public:
virtual std::unique_ptr<Utf32To8WriteResource> utf32To8WriteResource() = 0;
255 public:
virtual bool isRecursivelyIterable()
const = 0;
260 public:
virtual bool isIterable()
const = 0;
267 public:
virtual std::unique_ptr<RecursiveUriIterator> recursiveIterator()
const = 0;
274 public:
virtual std::unique_ptr<UriIterator> iterator()
const = 0;
286 public:
virtual ~
Uri() =
default;
293 public:
virtual void dispatch(
UriDispatcher & visitor)
const = 0;
301 inline std::unique_ptr<Uri>
operator / (
const std::unique_ptr<Uri> & uri,
const std::string & pathComponent) {
302 return uri->append(pathComponent);
322 void fromString(std::unique_ptr<Uri> & uri, std::string_view value);
330 inline void fromString(std::shared_ptr<Uri> & uri, std::string_view value) {
331 std::unique_ptr<Uri> ptr;
333 uri = std::shared_ptr<Uri>(std::move(ptr));
342 inline void fromString(std::shared_ptr<const Uri> & uri, std::string_view value) {
343 std::unique_ptr<Uri> ptr;
345 uri = std::shared_ptr<const Uri>(std::move(ptr));
350 #endif // COM_BORA_SOFTWARE__BALAU_RESOURCE__URI virtual std::unique_ptr< Uri > next()=0
Get the next item.
bool operator==(const UriComponents &lhs, const UriComponents &rhs)
Returns true if the two URI component instances are equal.
Definition: UriComponents.hpp:335
virtual ~RecursiveUriIterator()=default
Destroy the iterator instance.
void fromString(File &destination, std::string_view value)
Overwrite the supplied file URI by assignment by converting the supplied UTF-8 string to a file URI...
Definition: File.hpp:733
An abstract universal resource identifier.
Definition: Uri.hpp:131
virtual bool hasNext() const =0
Returns true if there is another item available in the iterator.
The unified resource class hierarchy.
Definition: ByteReadResource.hpp:24
An abstract read iterator that iterates recursively.
Definition: Uri.hpp:37
virtual std::string toRawString() const =0
Get a string representing the raw URI.
Core includes, typedefs and functions.
Balau::U8String< AllocatorT > toString(const File &file)
Print the file URI as a UTF-8 string.
Definition: File.hpp:724
Assertion utilities for development purposes.
std::shared_ptr< Uri > cloneToShared() const
Clone the concrete Uri to a shared pointer.
Definition: Uri.hpp:144
An abstract read iterator.
Definition: Uri.hpp:84
Dispatcher interface for URIs.
Visitor interface for URIs.
Definition: UriDispatcher.hpp:32
std::unique_ptr< Uri > operator/(const std::unique_ptr< Uri > &uri, const std::string &pathComponent)
Appends the path component to the supplied URI, returning a new URI.
Definition: Uri.hpp:301