DataURIStreamFactory.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // DataURIStreamFactory.h
  3. //
  4. // Library: Foundation
  5. // Package: URI
  6. // Module: DataURIStreamFactory
  7. //
  8. // Definition of the DataURIStreamFactory class.
  9. //
  10. // Copyright (c) 2019, Applied Informatics Software Engineering GmbH.
  11. // and Contributors.
  12. //
  13. // SPDX-License-Identifier: BSL-1.0
  14. //
  15. #ifndef Foundation_DataURIStreamFactory_INCLUDED
  16. #define Foundation_DataURIStreamFactory_INCLUDED
  17. #include "Poco/Foundation.h"
  18. #include "Poco/URIStreamFactory.h"
  19. namespace Poco {
  20. class Foundation_API DataURIStreamFactory: public URIStreamFactory
  21. /// An implementation of the URIStreamFactory interface
  22. /// that read data from data URIs.
  23. /// For example, for URI "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D" it read "Hello, World!".
  24. {
  25. public:
  26. DataURIStreamFactory();
  27. /// Creates the DataURIStreamFactory.
  28. ~DataURIStreamFactory();
  29. /// Destroys the DataURIStreamFactory.
  30. std::istream* open(const URI& uri);
  31. /// Creates an input stream returning decoded data from the given data URI.
  32. ///
  33. /// Throws a DataFormatException exception if the data is incorrect format.
  34. static void registerFactory();
  35. /// Registers the DataURIStreamFactory with the
  36. /// default URIStreamOpener instance.
  37. static void unregisterFactory();
  38. /// Unregisters the DataURIStreamFactory with the
  39. /// default URIStreamOpener instance.
  40. };
  41. } // namespace Poco
  42. #endif // Foundation_DataURIStreamFactory_INCLUDED