Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ImageSize Class Reference

#include <image_size.h>

List of all members.

Public Types

enum  Type {
  UNKNOWN = -1, GIF = 1, JPEG = 2, PNG = 3,
  BMP = 4
}
enum  Error {
  SUCCESS = 0, INVALID_FILE = 1, INVALID_FILE_NAME = 2, INVALID_FILE_TYPE = 3,
  BAD_HEADER = 4, BAD_IMAGE = 5
}
 if the image is not valid these errors are saying why. More...


Public Methods

 ImageSize (std::string file_name)
bool operator! () const
bool is_valid () const
unsigned int get_width () const
unsigned int get_height () const
Type get_type () const
 returns the type of the image. More...

Error get_error () const
 more detailed description why an error occured. More...


Private Methods

 ImageSize ()
bool get_image_type ()
 detects the image type out of the file_name extension. More...

bool compare (std::string a, std::string b)
 uncasesesitiv string compare. More...

bool get_1_byte (unsigned int &byte)
bool get_le_2_bytes (unsigned int &bytes)
 2 bytes, littel endian. More...

bool get_be_2_bytes (unsigned int &bytes)
 2 bytes, big endian. More...

bool get_le_4_bytes (unsigned int &bytes)
 4 bytes, littel endian. More...

bool get_be_4_bytes (unsigned int &bytes)
 4 bytes, big endian. More...

bool jump_abs (unsigned int pos)
 absolut seeking in file. More...

bool jump_rel (unsigned int n)
 relative seeking in file. More...

bool get_string (std::string &s, unsigned int n)
 reads n bytes from the file and stores them as a string in s. More...

void get_gif_geometry ()
bool check_gif_signature ()
void get_jpeg_geometry ()
bool check_jpeg_signature ()
bool jpeg_find_sof0_marker ()
void get_png_geometry ()
bool check_png_signature ()
void get_bmp_geometry ()
bool check_bmp_signature ()

Private Attributes

bool valid
unsigned int width
unsigned int height
std::ifstream in
Type type
std::string file_name
Error error


Member Enumeration Documentation

enum ImageSize::Error
 

if the image is not valid these errors are saying why.

Enumeration values:
SUCCESS  no Error.
INVALID_FILE  couldn't open the file.
INVALID_FILE_NAME  eg.: file name without an extension.
INVALID_FILE_TYPE  unsuported file type.
BAD_HEADER  probably damaged image header.
BAD_IMAGE  probably damaged image.

enum ImageSize::Type
 

Enumeration values:
UNKNOWN 
GIF 
JPEG 
PNG 
BMP 


Constructor & Destructor Documentation

ImageSize::ImageSize std::string    file_name
 

ImageSize::ImageSize   [inline, private]
 


Member Function Documentation

bool ImageSize::check_bmp_signature   [private]
 

bool ImageSize::check_gif_signature   [private]
 

bool ImageSize::check_jpeg_signature   [private]
 

bool ImageSize::check_png_signature   [private]
 

bool ImageSize::compare std::string    a,
std::string    b
[private]
 

uncasesesitiv string compare.

string a will be converted to upper case, string b won't be touched

bool ImageSize::get_1_byte unsigned int &    byte [private]
 

bool ImageSize::get_be_2_bytes unsigned int &    bytes [private]
 

2 bytes, big endian.

bool ImageSize::get_be_4_bytes unsigned int &    bytes [private]
 

4 bytes, big endian.

void ImageSize::get_bmp_geometry   [private]
 

Error ImageSize::get_error   const [inline]
 

more detailed description why an error occured.

void ImageSize::get_gif_geometry   [private]
 

unsigned int ImageSize::get_height   const [inline]
 

bool ImageSize::get_image_type   [private]
 

detects the image type out of the file_name extension.

void ImageSize::get_jpeg_geometry   [private]
 

bool ImageSize::get_le_2_bytes unsigned int &    bytes [private]
 

2 bytes, littel endian.

bool ImageSize::get_le_4_bytes unsigned int &    bytes [private]
 

4 bytes, littel endian.

void ImageSize::get_png_geometry   [private]
 

bool ImageSize::get_string std::string &    s,
unsigned int    n
[private]
 

reads n bytes from the file and stores them as a string in s.

Type ImageSize::get_type   const [inline]
 

returns the type of the image.

unsigned int ImageSize::get_width   const [inline]
 

bool ImageSize::is_valid   const [inline]
 

bool ImageSize::jpeg_find_sof0_marker   [private]
 

bool ImageSize::jump_abs unsigned int    pos [private]
 

absolut seeking in file.

bool ImageSize::jump_rel unsigned int    n [private]
 

relative seeking in file.

bool ImageSize::operator!   const [inline]
 


Member Data Documentation

Error ImageSize::error [private]
 

std::string ImageSize::file_name [private]
 

unsigned int ImageSize::height [private]
 

std::ifstream ImageSize::in [private]
 

Type ImageSize::type [private]
 

bool ImageSize::valid [private]
 

unsigned int ImageSize::width [private]
 


The documentation for this class was generated from the following files:
Generated on Tue Nov 20 02:19:53 2001 for Leo<HTML> by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001