Unofficial OpenGL Software Development Kit: C:/Projects/distro/glsdk_0_5_1/glimg/include/glimg/DdsLoader.h Source File

Unofficial OpenGL Software Development Kit 0.5.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DdsLoader.h
Go to the documentation of this file.
1
2 #ifndef GLIMG_DIRECT_DRAW_SURFACE_LOADER_H
3 #define GLIMG_DIRECT_DRAW_SURFACE_LOADER_H
4
5 #include <string>
6 #include "ImageSet.h"
7
14 namespace glimg
15 {
16 namespace loaders
17 {
23 namespace dds
24 {
27
29 class DdsLoaderException : public std::exception
30 {
31 public:
32
33 virtual ~DdsLoaderException() throw() {}
34
35 virtual const char *what() const throw() {return message.c_str();}
36
37 protected:
38 std::string message;
39 };
40
42 class DdsFileNotFoundException : public DdsLoaderException
43 {
44 public:
45 explicit DdsFileNotFoundException(const std::string &filename)
46 {
47 message = "The file \"" + filename + "\" could not be found.";
48 }
49 };
50
52 class DdsFileMalformedException : public DdsLoaderException
53 {
54 public:
55 DdsFileMalformedException(const std::string &filename, const std::string &msg)
56 {
57 if(filename.empty())
58 message = "The data is not a properly formatted DDS.\n";
59 else
60 message = "The file \"" + filename + "\" is not a proper DDS file.\n";
61
62 message += msg;
63 }
64 };
65
67 class DdsFileUnsupportedException : public DdsLoaderException
68 {
69 public:
70 DdsFileUnsupportedException(const std::string &filename, const std::string &msg)
71 {
72 if(filename.empty())
73 message = "The data uses DDS features that are not yet supported.\n";
74 else
75 message = "The file \"" + filename + "\" uses DDS features that are not yet supported.\n";
76
77 message += msg;
78 }
79 };
81
97 ImageSet *LoadFromFile(const std::string &filename);
98
100 ImageSet *LoadFromMemory(const unsigned char *buffer, size_t bufSize);
101 }
102 }
103 }
104
105 #endif //GLIMG_DIRECT_DRAW_SURFACE_LOADER_H