- Main Page
- Classes
- Files
- Directories

- File List
- File Members

# CImageLoader.h File Reference

`#include "CColor.h"`

## Classes
class | cImageLoader
| cImageLoader provides a class to load images files into memory. The real work is deferred to specific files that know how to load specific image file types. More...
## Functions
char * | find_extension (const char *a_input, const bool include_dot=0)
void | find_filename (char *a_dest, const char *a_input, const bool a_includeExtension=false)
| Discards the path component of a filename and returns the result in a_dest.
void | replace_extension (char *a_dest, const char *a_input, const char *a_extension)
| Copies the string a_input to a_dest, replacing a_input's extension.
bool | find_directory (char *a_dest, const char *a_source)
void | string_tolower (char *a_dest, const char *a_source)
| Converts a_source to lower-case and writes the result to a_dest.
void | chop_newlines (char *a_str)
| Chops newline characters from the end of a string.
unsigned char * | readFile (const char *a_filename, bool a_readAsText)
| Global function to read the contents of a file.

## Detailed Description

## Function Documentation

void chop_newlines | ( | char * | a_str | ) |

Chops newline characters from the end of a string.

Chops newline characters from the end of a string.

Parameters:

  | a_str | The string to clean up.

bool find_directory | ( | char * | a_dest,
|  | const char * | a_source |
| ) |  |  |

Finds only the _path_ portion of source, and copies it with _no_ trailing '\'. If there's no /'s or \'s, writes an empty string

Parameters:

  | a_dest | String which will contain the directory name
  | a_source | Input string containing path and filename

Returns:
  true for success, false if there's no separator

char* find_extension | ( | const char * | a_input,
|  | const bool | include_dot |
| ) |  |  |

Finds the extension in a filename and returns a pointer to the character after the '.' in the original string, or 0 if no '.' is found.

Parameters:

  | a_input | The input filename string
  | include_dot | Should we include the '.' in the output?

Returns:
  Returns a pointer to the character after the '.', or 0 for an error

void find_filename | ( | char * | a_dest,
|  | const char * | a_input,
|  | const bool | a_includeExtension |
| ) |  |  |

Discards the path component of a filename and returns the result in a_dest.

Discards the path component of a filename and returns the filename itself, optionally including the extension, in a_dest. If there are no path separators, copies the whole string.

Parameters:

  | a_dest | String which will contain the resulting filename
  | a_input | Input string containing path and filename
  | a_includeExtension | Should the output include the extension?

unsigned char* readFile | ( | const char * | a_filename,
|  | bool | a_readAsText |
| ) |  |  |

Global function to read the contents of a file.

Global function to read the contents of a file. Caller is responsible for deleting the allocated memory.

Parameters:

  | a_filename | The file to read
  | a_readAsText | if true, the file is opened in text mode (if supported) and a null character is appended to the returned value

Returns:
  A buffer containing the file contents, or 0 for an error

void replace_extension | ( | char * | a_dest,
|  | const char * | a_input,
|  | const char * | a_extension |
| ) |  |  |

Copies the string a_input to a_dest, replacing a_input's extension.

Copies the string a_input to a_dest, replacing a_input's extension

Parameters:

  | a_input | The input filename
  | a_dest | The output filename
  | a_extension | The extension to replace a_input's extension with

void string_tolower | ( | char * | a_dest,
|  | const char * | a_source |
| ) |  |  |

Converts a_source to lower-case and writes the result to a_dest.

Convert a string into lower case.

Parameters:

  | a_dest | Output string
  | a_source | Input string