#include <assert.h>
#include <ctype.h>
#include "File.hpp"
#include "String.hpp"
Go to the source code of this file.
Functions |
| unsigned int | File__byte_read (File file) |
| | Read a byte from *file*.
|
| void | File__byte_write (File file, unsigned int byte) |
| | Write *byte* ot *file*.
|
| int | File__character_read (File in_file) |
| | Return the next character read from *in_file*.
|
| void | File__close (File file) |
| | Closes *file*.
|
| double | File__double_attribute_read (File in_file, String_Const attribute_name) |
| | Reads in an XML attribute with a floating point value.
|
| float | File__float_attribute_read (File in_file, String_Const attribute_name) |
| | Reads in an XML attribute with a floating point value.
|
| void | File__flush (File file) |
| | Flushes file content out of internal buffers.
|
| void | File__format (File file, String_Const format,...) |
| | will write *format* out to *file* with all patterns that start with "%" replaced by formatted versions of its arguments.
|
| int | File__integer_attribute_read (File in_file, String_Const attribute_name) |
| | Reads in an XML attribute with a integer value.
|
| unsigned int | File__little_endian_short_read (File file) |
| | Read a little endian short (16-bits) from *file*.
|
| void | File__little_endian_short_write (File file, unsigned int xshort) |
| | Write 16-bit *xshort* to *file* in little endian format.
|
| File | File__open (String_Const file_name, String_Const flags) |
| | will open *file_name* using *flags* to specify read/write options.
|
| void | File__string_match (File in_file, String_Const pattern) |
| | Exactly matches *pattern* read from *in_file*.
|
| void | File__tag_match (File in_file, String_Const tag_name) |
| | Matchs and "XML" start tag.
|
Function Documentation
Read a byte from *file*.
- Parameters:
-
- Returns:
- byte read from *file*.
File__byte_read*() will read a byte from *file* and return it.
Definition at line 17 of file File.cpp.
Write *byte* ot *file*.
- Parameters:
-
| file | to read from. |
| byte | to write out. |
File__byte_write*() will write *byte* to *file*.
Definition at line 29 of file File.cpp.
Return the next character read from *in_file*.
- Parameters:
-
- Returns:
- character read from *in_file*.
File__character_read*() will read in and return the next character from *in_file*. (*char*)(-1) is returned when an end of file condition is encountered on *in_file*.
Definition at line 41 of file File.cpp.
Closes *file*.
- Parameters:
-
File__close*() will close *file*.
Definition at line 50 of file File.cpp.
Reads in an XML attribute with a floating point value.
- Parameters:
-
| in_file | is the input file to read from. |
| attribute_name | is the attribute name. |
- Returns:
- the floating point value.
File__double_attribute_read*() will read in a pattern that matches ' ATTRIBUTE_NAME="VALUE"', where ATTRIBUTE_NAME matches *attribute_name* and VALUE is an optionally signed floating point number. This is used for parsing "XML" file input. "XML" is in quotes is because this is really not a very robust XML parser. An assertion failure occurs if the input does not parse properly.
Definition at line 66 of file File.cpp.
Reads in an XML attribute with a floating point value.
- Parameters:
-
| in_file | is the input file to read from. |
| attribute_name | is the attribute name. |
- Returns:
- the floating point value.
File__float_attribute_read*() will read in a pattern that matches ' ATTRIBUTE_NAME="VALUE"', where ATTRIBUTE_NAME matches *attribute_name* and VALUE is an optionally signed floating point number. This is used for parsing "XML" file input. "XML" is in quotes is because this is really not a very robust XML parser. An assertion failure occurs if the input does not parse properly.
Definition at line 128 of file File.cpp.
Flushes file content out of internal buffers.
- Parameters:
-
File__flush*() will flush out the internal buffers of *out_file*.
Definition at line 166 of file File.cpp.
will write *format* out to *file* with all patterns that start with "%" replaced by formatted versions of its arguments.
- Parameters:
-
| file | to output to. |
| format | is the formatting string. |
File__format*() will write *format* out to *file* with all patterns that start with "%" replaced by formatted versions of its arguments.
Definition at line 107 of file File.cpp.
Reads in an XML attribute with a integer value.
- Parameters:
-
| in_file | is the input file to read from. |
| attribute_name | is the attribute name. |
- Returns:
- the floating point value.
File__integer_attribute_read*() will read in a pattern that matches ' ATTRIBUTE_NAME="VALUE"', where ATTRIBUTE_NAME matches *attribute_name* and VALUE is an optionally signed integer number. This is used for parsing "XML" file input. "XML" is in quotes is because this is really not a very robust XML parser. An assertion failure occurs if the input does not parse properly.
Definition at line 183 of file File.cpp.
Read a little endian short (16-bits) from *file*.
- Parameters:
-
- Returns:
- 16-bit value from *file*.
File__little_endian_short_read*() will read a 16-bit unsigned integer from *file* and return it.
Definition at line 215 of file File.cpp.
Write 16-bit *xshort* to *file* in little endian format.
- Parameters:
-
| file | to write. |
| xshort | to write. |
File__little_endian_short_write*() will write write *xshort* to *file* as a little endian 16-bit unsigned integer.
Definition at line 231 of file File.cpp.
will open *file_name* using *flags* to specify read/write options.
- Parameters:
-
| file_name | is the file name to open. |
| flags | specify the read/write options. |
File__open*() will open *file_name* using *flags* to read/write options. An open *File* object is returned or (*File)0 if the open failed.
Definition at line 243 of file File.cpp.
Exactly matches *pattern* read from *in_file*.
- Parameters:
-
| in_file | to read from. |
| pattern | to matach. |
File__string_match*() will read characters from *in_file* that must exactly match *pattern*. An assertion failure occurs if *pattern* does not match exactly.
Definition at line 255 of file File.cpp.
Matchs and "XML" start tag.
- Parameters:
-
| in_file | is the file to read from. |
| tag_name | is the name of the tat to match. |
File__tag_match*() parse "WHITESPACE<TAG" where WHTITESPACE is zero or more spaces and TAG matches *tag_name*. An assertion failure occurs the pattern does not parse properly. This is not a very robust XML parser.
Definition at line 272 of file File.cpp.