1#include "image_reader.h"
2#include <cgv/base/register.h>
55 static std::vector<base_ptr>& ref_readers()
57 static std::vector<base_ptr> readers;
65 ref_readers().push_back(
object);
69 for (
unsigned int i=0; i<ref_readers().size(); ++i) {
70 if (
object == ref_readers()[i]) {
71 ref_readers().erase(ref_readers().begin()+i);
87 static std::string exts;
89 std::vector<base_ptr>& readers = reader_listener::ref_readers();
90 for (
unsigned int i=0; i<readers.size(); ++i) {
103 std::string text =
"Image Files (";
104 std::string exts =
"*.";
117 return rd->get_last_error();
145 std::string::size_type pos = file_name.find_last_of(
'.');
146 if (pos == std::string::npos)
148 std::string ext =
to_lower(file_name.substr(pos+1));
149 std::vector<base_ptr>& readers = reader_listener::ref_readers();
150 std::stringstream all_supported_extensions(
"");
151 for (
unsigned int i=0; i<readers.size(); ++i) {
152 if (i != readers.size() - 1) {
153 all_supported_extensions <<
":";
156 all_supported_extensions << supported_extensions;
162 last_error =
"could not find a suitable reader for " + file_name +
" (supported formats are " +
163 all_supported_extensions.str() +
")";
184 return rd->get_nr_images();
192 return rd->get_image_duration();
200 return rd->get_current_image();
208 return rd->seek_image(idx);
218 return rd->read_palette(i,dv);
226 return rd->read_palette(i,dv);
234 return rd->supports_per_line_read();
307 return rd->get_type_name();
308 return "cmi::image_reader";
314 return rd->get_property_declarations();
322 return rd->set_void(property,
type, value);
329 return rd->get_void(property,
type, value);
base class for all classes that can be registered with support for dynamic properties (see also secti...
virtual std::string get_property_declarations()
return a semicolon separated list of property declarations
T * get_interface()
use dynamic type cast to check for the given interface
virtual bool set_void(const std::string &property, const std::string &value_type, const void *value_ptr)
abstract interface for the setter of a dynamic property.
virtual bool get_void(const std::string &property, const std::string &value_type, void *value_ptr)
abstract interface for the getter of a dynamic property.
bool empty() const
return whether the data pointer is a null pointer
the data view gives access to a data array of one, two, three or four dimensions.
void set_ptr(unsigned char *ptr, bool manage_ptr)
set a different data pointer that will be deleted with the delete [] operator of type (unsigned char*...
the base namespace holds the base hierarchy, support for plugin registration and signals
data::ref_ptr< base, true > base_ptr
ref counted pointer to base
namespace for data management components
namespace for compile time type information
namespace that holds tools that dont fit any other namespace
unsigned int replace(std::string &s, char c1, char c2)
replace char c1 with c2 in the given string _s and return number of replacements
char to_lower(char c)
convert char to lower case
bool is_element(char c, const std::string &s)
check if char c arises in string s
this header is dependency free
Helper functions to process strings.
convenience class to register an object of the given class type
interfaces that allows to listen to registration events.
interfaces that add provides very basic functionality.