provider_type_register.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** (if your name is missing here, please add it)
28 */
29 
30 
31 #pragma once
32 
33 #include "../../Core/IOData/file_system.h"
34 #include "provider_type.h"
35 
36 namespace clan
37 {
40 
43 template<class ProviderClass>
45 {
48 
49 public:
51  ProviderType_Register(const std::string &type) : ImageProviderType(type)
52  {
53  }
54 
58 
59 public:
61  virtual PixelBuffer load(
62  const std::string &filename,
63  const FileSystem &fs,
64  bool srgb) override
65  {
66  return ProviderClass::load(filename, fs, srgb);
67  }
68 
69  virtual PixelBuffer load(
70  IODevice &file,
71  bool srgb) override
72  {
73  return ProviderClass::load(file, srgb);
74  }
75 
76  virtual void save(
77  PixelBuffer buffer,
78  const std::string &filename,
79  FileSystem &fs) override
80  {
81  ProviderClass::save(buffer, filename, fs);
82  }
83 
84  virtual void save(
85  PixelBuffer buffer,
86  IODevice &file) override
87  {
88  ProviderClass::save(buffer, file);
89  }
90 
92 };
93 
94 }
95 
virtual void save(PixelBuffer buffer, IODevice &file) override
Definition: provider_type_register.h:84
virtual PixelBuffer load(const std::string &filename, const FileSystem &fs, bool srgb) override
Called to load an image with this provider type.
Definition: provider_type_register.h:61
Class template to register a provider type.
Definition: provider_type_register.h:45
I/O Device interface.
Definition: iodevice.h:51
Provider type.
Definition: provider_type.h:45
ProviderType_Register(const std::string &type)
Registers provider type in the ProviderFactory.
Definition: provider_type_register.h:51
virtual void save(PixelBuffer buffer, const std::string &filename, FileSystem &fs) override
Called to save a given PixelBuffer to a file.
Definition: provider_type_register.h:76
virtual PixelBuffer load(IODevice &file, bool srgb) override
Definition: provider_type_register.h:69
Definition: clanapp.h:36
Virtual File System (VFS).
Definition: file_system.h:48
Pixel data container.
Definition: pixel_buffer.h:69