Base Framework
|
#include <base/net/MimeType.h>
Inherits Object.
Public Types | |
enum | MediaType { APPLICATION, AUDIO, IMAGE, MESSAGE, MULTIPART, TEXT, VIDEO, EXTENSION, UNINITIALIZED } |
Public Member Functions | |
MimeType () | |
MimeType (const String &type, const String &subtype) noexcept | |
MimeType (MediaType mediaType, const String &subtype) | |
MimeType (const String &value) | |
MimeType & | operator= (const MimeType &assign) noexcept |
bool | isValid () const noexcept |
bool | operator== (const MimeType &value) const noexcept |
bool | operator!= (const MimeType &value) const noexcept |
const String & | getType () const noexcept |
const String & | getSubtype () const noexcept |
MediaType | getMediaType () const noexcept |
bool | matches (MediaType mediaType, const String &subtype) const noexcept |
enum MimeType::MediaType |
Top-level media types.
Enumerator | |
---|---|
APPLICATION | Application type. |
AUDIO | Audio type. |
IMAGE | Image type. |
MESSAGE | Message type. |
MULTIPART | Multipart type. |
TEXT | Text type. |
VIDEO | Video type. |
EXTENSION | Unspecified type. |
UNINITIALIZED | Used internally. |
MimeType::MimeType | ( | ) |
Initializes the mime type as "application/octet-stream".
Initializes the mime object with specified values. Use the isValid() method to validate against grammar.
type | The type of the mime object (e.g. image). |
subtype | The subtype of the mime object (e.g. jpeg). |
Initializes the mime object with specified values. Use the isValid() method to validate against grammar. The media type must be APPLICATION, AUDIO, IMAGE, MESSAGE, MULTIPART, TEXT, or VIDEO. OutOfDomain is raised for all other values.
mediaType | The media type of the mime object (e.g. VIDEO). |
subtype | The subtype of the mime object (e.g. mpeg). |
MimeType::MimeType | ( | const String & | value | ) |
Initializes the mime object with specified values. Only raises InvalidFormat is '/' is missing. Use the isValid() method to validate against grammar.
value | The string representation of the mime object (e.g. "text/html"). |
|
noexcept |
Returns the top-level type.
|
inlinenoexcept |
Returns the subtype.
|
inlinenoexcept |
Returns the type.
|
noexcept |
Returns true if the type and subtype complies with the grammar described in RFC 2045.
Returns true if the media type and subtype matches.
|
inlinenoexcept |
Returns false if the objects are different.
Assignment of MIME type to MIME type.
|
noexcept |
Returns true if the objects are equal.