neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
i_resource.hpp
Go to the documentation of this file.
1// i_resource.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
24
25namespace neogfx
26{
28 {
29 public:
30 declare_event(downloaded)
31 declare_event(failed_to_download)
32 public:
33 typedef i_resource abstract_type;
34 public:
37 public:
38 struct not_available : std::logic_error { not_available() : std::logic_error("neogfx::i_resource::not_available") {} };
39 struct no_data : std::logic_error { no_data() : std::logic_error("neogfx::i_resource::no_data") {} };
40 struct const_data : std::logic_error { const_data() : std::logic_error("neogfx::i_resource::const_data") {} };
41 public:
42 virtual ~i_resource() = default;
43 public:
44 virtual bool available() const = 0;
45 virtual bool downloading() const = 0;
46 virtual double downloading_progress() const = 0;
47 virtual bool error() const = 0;
48 virtual i_string const& error_string() const = 0;
49 public:
50 virtual i_string const& uri() const = 0;
51 virtual bool is_empty() const = 0;
52 virtual const void* cdata() const = 0;
53 virtual const void* data() const = 0;
54 virtual void* data() = 0;
55 virtual std::size_t size() const = 0;
56 virtual hash_digest_type const& hash() const = 0;
57 };
58}
virtual hash_digest_type const & hash() const =0
data_type hash_digest_type
virtual bool is_empty() const =0
virtual double downloading_progress() const =0
virtual bool available() const =0
virtual bool error() const =0
virtual bool downloading() const =0
virtual const void * cdata() const =0
virtual const void * data() const =0
virtual std::size_t size() const =0
virtual ~i_resource()=default
virtual void * data()=0
virtual i_string const & uri() const =0
virtual i_string const & error_string() const =0
neolib::i_vector< uint8_t > data_type
#define declare_event(declName,...)
Definition i_event.hpp:305