FileMessage
and FileParticle
, which are derived from Message
and Particle
. It uses the reference-counting mechanism of the Message
and Envelope
classes to ensure that files are not deleted until no longer needed. Although we created a new particle type to allow these types to appear in the pigi
graphical interface, we recommend that you use the Message
interface described in
Section 4.3 for your own types.
The
File
type adds the following functions to Message
: Constructors
FileMessage()
Create a new file message with a unique filename. By default, the file will be deleted when no file messages reference it.
FileMessage(const char* name)
Create a new file message with the given filename. By default, the file will not be deleted when no file messages reference it.
FileMessage(const FileMessage& src)
Create a new file message containing the same filename as the given file message. By default, the file will not be deleted when no file messages reference it.
Operations
const char* fileName()
Return the file name contained in this message.
StringList print()
Return the file name contained in this message in a StringList
object.
const char* fileName()
Return the file name contained in this message.
void setTransient(int transient)
Set the status of the file. If transient is TRUE
, the file will be deleted when no file messages reference it; if FALSE
, then it will not be deleted.
4.5.2 The String type
The string type is implemented by the classes StringMessage
and StringParticle
, which are derived from Message
and Particle
. It contains an InfString
object-InfString
is a version of StringList
that allows limited modification, and is used to interface C++ to Tcl. Again, It uses the reference-counting mechanism of the Message
and Envelope
classes to ensure that strings are not deleted until no longer needed. StringMessage
is currently very simple-it adds the following functions to Message
: Constructors
StringMessage()
Create a new string message an empty string.
StringMessage(const char* name)
Create a new string message with a copy of the given string. The given string can be deleted, since the new message does not reference it.
StringMessage(const StringMessage& src)
Create a new string message containing the same string as the given string message. Again, the string is copied.
Operations
StringList print()
Return the string contained in this message in a StringList
object.