Move file format to a separate header in order to better obfuscate the image loaders within the io library.

This commit is contained in:
Pavel Krajcevski 2012-08-27 22:47:20 -04:00
parent db6e76f1b3
commit f2c2f7c9af
4 changed files with 16 additions and 6 deletions

View file

@ -1,11 +1,7 @@
#ifndef _IMAGE_LOADER_H_ #ifndef _IMAGE_LOADER_H_
#define _IMAGE_LOADER_H_ #define _IMAGE_LOADER_H_
enum EImageFileFormat { #include "ImageFileFormat.h"
eFileFormat_PNG,
kNumImageFileFormats
};
class ImageLoader { class ImageLoader {

View file

@ -1,7 +1,7 @@
#ifndef _IMAGE_FILE_H_ #ifndef _IMAGE_FILE_H_
#define _IMAGE_FILE_H_ #define _IMAGE_FILE_H_
#include "ImageLoader.h" #include "ImageFileFormat.h"
class ImageFile { class ImageFile {

View file

@ -0,0 +1,10 @@
#ifndef _IMAGE_FILE_FORMAT_H_
#define _IMAGE_FILE_FORMAT_H_
enum EImageFileFormat {
eFileFormat_PNG,
kNumImageFileFormats
};
#endif // _IMAGE_FILE_FORMAT_H_

View file

@ -5,6 +5,7 @@
#include <assert.h> #include <assert.h>
#include "ImageFile.h" #include "ImageFile.h"
#include "ImageLoader.h"
#ifdef PNG_FOUND #ifdef PNG_FOUND
# include "ImageLoaderPNG.h" # include "ImageLoaderPNG.h"
@ -150,6 +151,9 @@ EImageFileFormat ImageFile::DetectFileFormat(const char *filename) {
return kNumImageFileFormats; return kNumImageFileFormats;
} }
// consume the last character...
dotPos++;
const char *ext = &filename[dotPos]; const char *ext = &filename[dotPos];
if(strcmp(ext, ".png") == 0) { if(strcmp(ext, ".png") == 0) {