Object <- FixedList <- ObjectList <- ContentTypeLabel |
|
|
ContentParameterValue ContentTagValue FormattedContentTag NewContentTypeLabel SetContentParameterValue SetContentTagValue SetUpContentTypeLabel |
|
ContentSubtype ContentType ContentTypeAndSubtype FormattedContentType TypeIsText |
| Field | Type | |
|---|---|---|
| ContentTypeLabel: | contentType: | Text |
| contentSubtype: | Text | |
| parameters: | ObjectList | |
| headerTags: | Text |
instance ContentTypeLabel tag; contentType: nilObject; contentSubtype: nilObject; parameters: nilObject; headerTags: nilObject; end instance;
Define Class ContentTypeLabel;
inherits from ObjectList;
field contentType: Text, getter, setter;
field contentSubtype: Text, getter, setter;
field parameters: ObjectList;
field headerTags: Text;
attribute ContentType: Text;
// returns the content type, i.e. "text" for the case of
// "text/plain; charset = us-ascii"
attribute TypeIsText: Boolean, readOnly;
attribute ContentSubtype: Text;
// returns the content subtype, i.e. "plain" for the case of
// "text/plain; charset = us-ascii"
operation ContentParameterValue(parameterKey: Literal): Text;
// returns the value for the specified parameter, i.e. "us-ascii"
// when passed "charset" for the case of "text/plain; charset = us-ascii"
// returns an empty text object if there is no such parameter
operation SetContentParameterValue(parameterKey: Literal; parameterValue: HasText);
// sets the value for the specified parameter
operation ContentTagValue(tagKey: Literal): Text;
// returns the value for the specified tag, i.e. "1" when passed "form-index".
// returns an empty text object if there is no such parameter
operation SetContentTagValue(parameterKey: HasText; parameterValue: HasText);
// sets the value for the specified parameter
operation FormattedContentTag(tagIndex: Unsigned): Text;
// returns a tag in the form "Subject: Check this out" when passed the
// index of the subject tag. Used to iterated over all tags when outputing
// them in the header of a MIME part.
attribute FormattedContentType: Text, readOnly;
// returns a line formatted as per RFC1521, i.e.
// "text/plain; charset = iso-2022-jp; hoopy = frood"
attribute ContentTypeAndSubtype: Text, readOnly;
// returns the type and subtype combined, such as "text/plain"
// intended to be used as a key for looking up a decoder
operation SetUpContentTypeLabel(source: HasText): Boolean;
// given a content type line in source and extracts and
// stores the various pieces. Returns true if the
// line was legal as specified by RFC1521.
intrinsic NewContentTypeLabel(type: Literal; subtype: Literal; parameters: Literal): ContentTypeLabel;
// call to create a transient ContentTypeLabel. Pass in any desired initial
// values, or pass nil to leave it as the default value. The parameters
// parameter can have any number of parameter key/value pairs and should
// not start with a semicolon.
// *** example
// label = NewContentTypeLabel("text", "plain", "charset=iso-2022-jp; hoopy = frood");
end class;