Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef MediaContainerType_h_
8 : #define MediaContainerType_h_
9 :
10 : #include "MediaMIMETypes.h"
11 : #include "mozilla/Maybe.h"
12 : #include "nsString.h"
13 :
14 : namespace mozilla {
15 :
16 : // Class containing media type information for containers.
17 0 : class MediaContainerType
18 : {
19 : public:
20 0 : explicit MediaContainerType(const MediaMIMEType& aType)
21 0 : : mExtendedMIMEType(aType)
22 0 : {}
23 0 : explicit MediaContainerType(MediaMIMEType&& aType)
24 0 : : mExtendedMIMEType(Move(aType))
25 0 : {}
26 : explicit MediaContainerType(const MediaExtendedMIMEType& aType)
27 : : mExtendedMIMEType(aType)
28 : {
29 : }
30 0 : explicit MediaContainerType(MediaExtendedMIMEType&& aType)
31 0 : : mExtendedMIMEType(Move(aType))
32 : {
33 0 : }
34 :
35 0 : const MediaMIMEType& Type() const { return mExtendedMIMEType.Type(); }
36 0 : const MediaExtendedMIMEType& ExtendedType() const { return mExtendedMIMEType; }
37 :
38 : // Original string. Note that "type/subtype" may not be lowercase,
39 : // use Type().AsString() instead to get the normalized "type/subtype".
40 0 : const nsACString& OriginalString() const { return mExtendedMIMEType.OriginalString(); }
41 :
42 : size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
43 :
44 : private:
45 : MediaExtendedMIMEType mExtendedMIMEType;
46 : };
47 :
48 : Maybe<MediaContainerType> MakeMediaContainerType(const nsAString& aType);
49 : Maybe<MediaContainerType> MakeMediaContainerType(const nsACString& aType);
50 : Maybe<MediaContainerType> MakeMediaContainerType(const char* aType);
51 :
52 : } // namespace mozilla
53 :
54 : #endif // MediaContainerType_h_
|