3
<TITLE> DwBinhex Man Page </TITLE>
5
<BODY BGCOLOR="#FFFFFF">
7
<FONT COLOR="navy"> NAME </FONT>
10
DwBinhex -- Class for converting files to or from Binhex 4.0 format
12
<FONT COLOR="navy"> SYNOPSIS </FONT>
15
class DW_EXPORT DwBinhex {
19
<A HREF="binhex.html#DwBinhex">DwBinhex</A>();
21
void <A HREF="binhex.html#Initialize">Initialize</A>();
22
const char* <A HREF="binhex.html#FileName">FileName</A>() const;
23
void <A HREF="binhex.html#SetFileName">SetFileName</A>(const char* aName);
24
void <A HREF="binhex.html#FileType">FileType</A>(char* aBuf) const;
25
void <A HREF="binhex.html#SetFileType">SetFileType</A>(const char* aType);
26
void <A HREF="binhex.html#FileCreator">FileCreator</A>(char* aBuf) const;
27
void <A HREF="binhex.html#SetFileCreator">SetFileCreator</A>(const char* aType);
28
DwUint8 <A HREF="binhex.html#Flag1">Flag1</A>() const;
29
void <A HREF="binhex.html#SetFlag1">SetFlag1</A>(DwUint8 aFlag);
30
DwUint8 <A HREF="binhex.html#Flag2">Flag2</A>() const;
31
void <A HREF="binhex.html#SetFlag2">SetFlag2</A>(DwUint8 aFlag);
32
const DwString& <A HREF="binhex.html#DataFork">DataFork</A>() const;
33
void <A HREF="binhex.html#SetDataFork">SetDataFork</A>(const DwString& aStr);
34
const DwString& <A HREF="binhex.html#ResourceFork">ResourceFork</A>() const;
35
void <A HREF="binhex.html#SetResourceFork">SetResourceFork</A>(const DwString& aStr);
36
const DwString& <A HREF="binhex.html#BinhexChars">BinhexChars</A>() const;
37
void <A HREF="binhex.html#SetBinhexChars">SetBinhexChars</A>(const DwString& aStr);
38
void <A HREF="binhex.html#Encode">Encode</A>();
39
int <A HREF="binhex.html#Decode">Decode</A>();
43
<FONT COLOR="navy"> DESCRIPTION </FONT>
46
<B><TT>DwBinhex</TT></B> converts data to or from Binhex 4.0 format. Binhex
47
is a format used almost exclusively on Macintosh computers for encoding files
48
into text characters for transmission through the mail transport system or
49
for archiving on non-Macintosh systems. The format includes the file name,
50
file type, file creator, Macintosh Finder flags, data fork, resource fork,
51
and checksums. In MIME, the use of Binhex is deprecated; applesingle and
52
appledouble are the preferred format for encoding Macintosh files. The Binhex
53
4.0 format is described in RFC-1741. Binhex is a widely used, <I>de facto</I>
54
standard, but it is not an official Internet standard.
56
To use <B><TT>DwBinhex</TT></B> for converting a Macintosh file to Binex
57
format, call the member functions <B><TT>SetFileName()</TT></B>,
58
<B><TT>SetFileType()</TT></B>, <B><TT>SetFileCreator()</TT></B>,
59
<B><TT>SetFlag1()</TT></B>, <B><TT>SetFlag2()</TT></B>,
60
<B><TT>SetDataFork()</TT></B>, and <B><TT>SetResourceFork()</TT></B> to set
61
the elements to be encoded. Any elements that are not set by calling one
62
of the member functions are assigned reasonable defaults. Then call the
63
<B><TT>Encode()</TT></B> member function to actually perform the conversion
64
to Binhex. Finally, call <B><TT>BinhexChars()</TT></B> to retrieve the Binhex
67
To use <B><TT>DwBinhex</TT></B> for converting a Macintosh file from Binhex
68
format, call the member function <B><TT>SetBinhexChars()</TT></B> to assign
69
the Binhex characters to be converted. Then call <B><TT>Decode()</TT></B>
70
to actually perform the conversion. Finally, call
71
<B><TT>FileName()</TT></B>, <B><TT>FileType()</TT></B>,
72
<B><TT>FileCreator()</TT></B>, <B><TT>Flag1()</TT></B>,
73
<B><TT>Flag2()</TT></B>, <B><TT>DataFork()</TT></B>, and
74
<B><TT>ResourceFork()</TT></B> to extract the decoded elements.
76
Note: <B><TT>DwBinhex</TT></B> does not change the file name in any way.
77
When you you are dealing with file names, you should be aware of the fact
78
that some filenames that are valid on a Macintosh may cause problems or
79
unexpected results on a non-Macintosh system, and vice versa. Such problem
80
characters include slash ('/'), colon (':'), space and possibly other characters.
82
<FONT COLOR="navy"> Public Member Functions </FONT>
85
<FONT COLOR="teal"><B> <A NAME="DwBinhex">DwBinhex</A>() </B></FONT>
87
This is the default constructor.
89
<FONT COLOR="teal"><B> void <A NAME="Initialize">Initialize</A>() </B></FONT>
91
Resets the object's internal state to its initial state. Call this member
92
function to reuse the object for more than one encode or decode operation.
94
<FONT COLOR="teal"><B> const char* <A NAME="FileName">FileName</A>()
96
void <A NAME="SetFileName">SetFileName</A>(const char* aName) </B></FONT>
98
Gets or sets the file name. The file name is restricted to a maximum length
101
<FONT COLOR="teal"><B> void <A NAME="FileType">FileType</A>(char* aBuf)
103
void <A NAME="SetFileType">SetFileType</A>(const char* aType) </B></FONT>
105
Gets or sets the file type. All Macintosh files have a file type, which is
106
represented by four bytes. Some examples include "TEXT" for a text file,
107
or "APPL" for an application. <B><TT>aBuf</TT></B> should point to an array
108
of at least four characters.
110
<FONT COLOR="teal"><B> void <A NAME="FileCreator">FileCreator</A>(char* aBuf)
112
void <A NAME="SetFileCreator">SetFileCreator</A>(const char* aType)
115
Gets or sets the file creator. Most Macintosh files have a creator, which
116
is represented by a signature of four bytes. The creator specifies which
117
application to launch when a file's icon is double clicked.
118
<B><TT>aBuf</TT></B> should point to an array of at least four characters.
120
<FONT COLOR="teal"><B> DwUint8 <A NAME="Flag1">Flag1</A>() const <BR>
121
void <A NAME="SetFlag1">SetFlag1</A>(DwUint8 aFlag) </B></FONT>
123
Gets or sets the first byte of the Macintosh Finder flags. For files that
124
originate on non-Macintosh systems, this byte should be set to zero (the
127
<FONT COLOR="teal"><B> DwUint8 <A NAME="Flag2">Flag2</A>() const <BR>
128
void <A NAME="SetFlag2">SetFlag2</A>(DwUint8 aFlag) </B></FONT>
130
Gets or sets the second byte of the Macintosh Finder flags. For files that
131
originate on non-Macintosh systems, this byte should be set to zero (the
134
<FONT COLOR="teal"><B> const DwString& <A NAME="DataFork">DataFork</A>()
136
void <A NAME="SetDataFork">SetDataFork</A>(const DwString& aStr)
139
Gets or sets the data fork for the file. For files that originate on
140
non-Macintosh systems, such as a GIF or JPEG file, the file data should be
141
set as the data fork.
143
<FONT COLOR="teal"><B> const DwString&
144
<A NAME="ResourceFork">ResourceFork</A>() const<BR>
145
void <A NAME="SetResourceFork">SetResourceFork</A>(const DwString& aStr)
148
Gets or sets the resource fork for the file. For files that originate on
149
non-Macintosh systems, such as a GIF or JPEG file, the resource should be
152
<FONT COLOR="teal"><B> const DwString&
153
<A NAME="BinhexChars">BinhexChars</A>() const<BR>
154
void <A NAME="SetBinhexChars">SetBinhexChars</A>(const DwString& aStr)
157
Gets or sets the characters of the Binhex encoded file.
159
<FONT COLOR="teal"><B> void <A NAME="Encode">Encode</A>() </B></FONT>
161
Converts the Macintosh file information to Binhex format.
163
<FONT COLOR="teal"><B> int <A NAME="Decode">Decode</A>() </B></FONT>
165
Converts the Macintosh file information from Binhex format. Returns zero
166
if the decode operation completes successufully; otherwise, the function