StringUriByteReadResource.hpp
Go to the documentation of this file.
1 // @formatter:off
2 //
3 // Balau core C++ library
4 //
5 // Copyright (C) 2008 Bora Software (contact@borasoftware.com)
6 //
7 // Licensed under the Boost Software License - Version 1.0 - August 17th, 2003.
8 // See the LICENSE file for the full license text.
9 //
10 
16 
17 #ifndef COM_BORA_SOFTWARE__BALAU_RESOURCE__STRING_URI_BYTE_READ_STRING
18 #define COM_BORA_SOFTWARE__BALAU_RESOURCE__STRING_URI_BYTE_READ_STRING
19 
21 
22 #include <memory>
23 #include <sstream>
24 
25 namespace Balau::Resource {
26 
27 class StringUri;
28 class Uri;
29 
37  public: explicit StringUriByteReadResource(const StringUri & stringUri_);
38 
40  : stringUri(std::move(rhs.stringUri))
41  , stream(std::move(rhs.stream)) {}
42 
43  public: std::istream & readStream() override {
44  return stream;
45  }
46 
47  public: const Uri & uri() const override;
48 
49  public: void close() override {}
50 
52 
53  private: std::unique_ptr<Uri> stringUri;
54  private: std::istringstream stream;
55 };
56 
57 } // namespace Balau::Resource
58 
59 #endif // COM_BORA_SOFTWARE__BALAU_RESOURCE__STRING_URI_BYTE_READ_STRING
A read-only String URI resource which is read as bytes.
Definition: StringUriByteReadResource.hpp:33
A read-only resource which is read as bytes.
Definition: ByteReadResource.hpp:29
An abstract universal resource identifier.
Definition: Uri.hpp:131
std::istream & readStream() override
Get the input stream of the byte read resource.
Definition: StringUriByteReadResource.hpp:43
void close() override
Close the stream(s) in the resource.
Definition: StringUriByteReadResource.hpp:49
The unified resource class hierarchy.
Definition: ByteReadResource.hpp:24
StringUriByteReadResource(const StringUri &stringUri_)
Create a new string byte read resource from the supplied String URI.
An immediate string pseudo-URI.
Definition: StringUri.hpp:49
const Uri & uri() const override
Get the URI associated with this resource.
A read-only resource which is read as bytes.