Public Member Functions | |
| BinHex () | |
| Default constructor. | |
| virtual | ~BinHex () |
| Destructor. | |
| void | initialize () |
| Resets to the initial state. | |
| const char * | fileName () const |
| Gets the file name. | |
| void | setFileName (const char *name) |
| Sets the file name. | |
| void | fileType (char *buf) const |
| Gets the file type. | |
| void | setFileType (const char *type) |
| Sets the file type. | |
| void | fileCreator (char *buf) const |
| Gets the file creator. | |
| void | setFileCreator (const char *creator) |
| Sets the file creator. | |
| uint8_t | flag1 () const |
| Gets the first byte of the Macintosh Finder flags. | |
| void | setFlag1 (uint8_t flag) |
| Sets the first byte of the Macintosh Finder flags. | |
| uint8_t | flag2 () const |
| Gets the second byte of the Macintosh Finder flags. | |
| void | setFlag2 (uint8_t flag) |
| Sets the second byte of the Macintosh Finder flags. | |
| const String & | dataFork () const |
| Gets the data fork for the file. | |
| void | setDataFork (const String &bytes) |
| Sets the data fork for the file. | |
| const String & | resourceFork () const |
| Gets the resource fork for the file. | |
| void | setResourceFork (const String &bytes) |
| Sets the resource fork for the file. | |
| const String & | binhexChars () const |
| Gets the characters of the BinHex encoded file. | |
| void | setBinHexChars (const String &chars) |
| Sets the characters of the BinHex encoded file. | |
| void | encode () |
| Converts the Macintosh file information to BinHex format. | |
| int | decode () |
| Converts the Macintosh file information from BinHex format. | |
To use BinHex for converting a Macintosh file to BinHex format, call the member functions setFileName(), setFileType(), setFileCreator(), setFlag1(), setFlag2(), setDataFork(), and setResourceFork() to set the elements to be encoded. (The library sets reasonable default values for any elements that you do not set.) Then call the encode() member function to actually perform the conversion to BinHex. Finally, call binhexChars() to get the characters of the BinHex file.
To use BinHex for converting a Macintosh file from BinHex format, call the member function setBinHexChars() to set the characters of the BinHex file to be converted. Then call decode() to actually perform the conversion. Finally, call fileName(), fileType(), fileCreator(), flag1(), flag2(), dataFork(), and resourceFork() to get the decoded elements.
Note: BinHex does not change the file name in any way. When you deal with file names, you should be aware of the fact that some filenames that are valid on a Macintosh may cause problems or unexpected results on a non-Macintosh system, and vice versa. Such problem characters include slash ('/'), colon (':'), space and possibly other characters.
| const String & binhexChars | ( | ) | const |
Gets the characters of the BinHex encoded file.
| const String & dataFork | ( | ) | const |
Gets the data fork for the file.
For files that originate on non-Macintosh systems, such as GIF or JPEG files, the file data should be set as the data fork.
| int decode | ( | ) |
Converts the Macintosh file information from BinHex format.
Returns zero if the decode operation completes successufully; otherwise, the function returns -1.
| void fileCreator | ( | char * | buf | ) | const |
Gets the file creator.
Most Macintosh files have a creator, which is represented by a signature of four bytes. The creator specifies which application to launch when a file's icon is double clicked. buf should point to an array of at least four characters.
| buf | buffer of at least four bytes that contains the file creator on output |
| const char * fileName | ( | ) | const |
Gets the file name.
The file name is restricted to a maximum length of 63 characters.
| void fileType | ( | char * | buf | ) | const |
Gets the file type.
All Macintosh files have a file type, which is represented by four bytes. Some examples include "TEXT" for a text file, or "APPL" for an application. buf should point to an array of at least four characters.
| buf | buffer of at least four bytes that contains the file type on output |
| uint8_t flag1 | ( | ) | const |
Gets the first byte of the Macintosh Finder flags.
For files that originate on non-Macintosh systems, this byte should be set to zero (the default).
| uint8_t flag2 | ( | ) | const |
Gets the second byte of the Macintosh Finder flags.
For files that originate on non-Macintosh systems, this byte should be set to zero (the default).
| void initialize | ( | ) |
Resets the object's internal state to its initial state.
You may call this member function to reuse the object for more than one encode or decode operation.
| const String & resourceFork | ( | ) | const |
Gets the resource fork for the file.
For files that originate on non-Macintosh systems, such as GIF or JPEG files, the resource fork should normally be empty.
| void setBinHexChars | ( | const String & | chars | ) |
Sets the characters of the BinHex encoded file.
| chars | the encoded characters of the BinHex file |
| void setDataFork | ( | const String & | bytes | ) |
Sets the data fork for the file.
For files that originate on non-Macintosh systems, such as GIF or JPEG files, the file data should be set as the data fork.
| bytes | the bytes of the data fork |
| void setFileCreator | ( | const char * | creator | ) |
Sets the file creator.
Most Macintosh files have a creator, which is represented by a signature of four bytes. The creator specifies which application to launch when a file's icon is double clicked. creator should point to an array of at least four characters.
| creator | the file creator |
| void setFileName | ( | const char * | name | ) |
Sets the file name.
The file name is restricted to a maximum length of 63 characters.
| name | the file name |
| void setFileType | ( | const char * | type | ) |
Sets the file type.
All Macintosh files have a file type, which is represented by four bytes. Some examples include "TEXT" for a text file, or "APPL" for an application. type should point to an array of at least four characters.
| type | the file type |
| void setFlag1 | ( | uint8_t | flag | ) |
Sets the first byte of the Macintosh Finder flags.
For files that originate on non-Macintosh systems, this byte should be set to zero (the default).
| flag | the first byte of the Finder flags |
| void setFlag2 | ( | uint8_t | flag | ) |
Sets the second byte of the Macintosh Finder flags.
For files that originate on non-Macintosh systems, this byte should be set to zero (the default).
| flag | the second byte of the Finder flags |
| void setResourceFork | ( | const String & | bytes | ) |
Sets the resource fork for the file.
For files that originate on non-Macintosh systems, such as GIF or JPEG files, the resource fork should normally be empty.
| bytes | the bytes of the resource fork |
Copyright © 2001-2009 Hunny Software, Inc. All rights reserved.