1363 |
* Use this constructor if you want to create a new RIFF file completely |
* Use this constructor if you want to create a new RIFF file completely |
1364 |
* "from scratch". Note: there must be no empty chunks or empty list |
* "from scratch". Note: there must be no empty chunks or empty list |
1365 |
* chunks when trying to make the new RIFF file persistent with Save()! |
* chunks when trying to make the new RIFF file persistent with Save()! |
|
* Note that this constructor will create a RIFX file on |
|
|
* big-endian machines. |
|
1366 |
* |
* |
1367 |
* @param FileType - four-byte identifier of the RIFF file type |
* @param FileType - four-byte identifier of the RIFF file type |
1368 |
* @see AddSubChunk(), AddSubList() |
* @see AddSubChunk(), AddSubList() |
1379 |
ListType = FileType; |
ListType = FileType; |
1380 |
} |
} |
1381 |
|
|
|
|
|
|
/** @brief Create new RIFF file. |
|
|
* |
|
|
* Use this constructor if you want to create a new RIFF file |
|
|
* completely "from scratch" and also want to specify |
|
|
* endianess. Note: there must be no empty chunks or empty list |
|
|
* chunks when trying to make the new RIFF file persistent with |
|
|
* Save()! |
|
|
* |
|
|
* @param FileType - four-byte identifier of the RIFF file type |
|
|
* @param Endian - endianess used in the new file. A value of |
|
|
* endian_little will create a RIFF file, |
|
|
* endian_big a RIFX file, endian_native will |
|
|
* create a RIFF file on little-endian machines |
|
|
* and RIFX on big-endian. |
|
|
* @see AddSubChunk(), AddSubList() |
|
|
*/ |
|
|
File::File(uint32_t FileType, endian_t Endian) : List(this) { |
|
|
#if defined(WIN32) |
|
|
hFileRead = hFileWrite = INVALID_HANDLE_VALUE; |
|
|
#else |
|
|
hFileRead = hFileWrite = 0; |
|
|
#endif |
|
|
Mode = stream_mode_closed; |
|
|
#if WORDS_BIGENDIAN |
|
|
bEndianNative = Endian != endian_little; |
|
|
#else |
|
|
bEndianNative = Endian != endian_big; |
|
|
#endif |
|
|
ulStartPos = RIFF_HEADER_SIZE; |
|
|
ListType = FileType; |
|
|
} |
|
|
|
|
1382 |
/** @brief Load existing RIFF file. |
/** @brief Load existing RIFF file. |
1383 |
* |
* |
1384 |
* Loads an existing RIFF file with all its chunks. |
* Loads an existing RIFF file with all its chunks. |
1527 |
return false; |
return false; |
1528 |
} |
} |
1529 |
|
|
1530 |
|
/** @brief Set the byte order to be used when saving. |
1531 |
|
* |
1532 |
|
* Set the byte order to be used in the file. A value of |
1533 |
|
* endian_little will create a RIFF file, endian_big a RIFX file |
1534 |
|
* and endian_native will create a RIFF file on little-endian |
1535 |
|
* machines and RIFX on big-endian machines. |
1536 |
|
* |
1537 |
|
* @param Endian - endianess to use when file is saved. |
1538 |
|
*/ |
1539 |
|
void File::SetByteOrder(endian_t Endian) { |
1540 |
|
#if WORDS_BIGENDIAN |
1541 |
|
bEndianNative = Endian != endian_little; |
1542 |
|
#else |
1543 |
|
bEndianNative = Endian != endian_big; |
1544 |
|
#endif |
1545 |
|
} |
1546 |
|
|
1547 |
/** @brief Save changes to same file. |
/** @brief Save changes to same file. |
1548 |
* |
* |
1549 |
* Make all changes of all chunks persistent by writing them to the |
* Make all changes of all chunks persistent by writing them to the |