sbDeviceCapabilitiesUtils.cpp
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2009 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
26 
27 #include <sbDeviceUtils.h>
28 #include <sbIDeviceCapabilities.h>
30 
31 
35 {
36 }
37 
38 sbDeviceCapabilitiesUtils::~sbDeviceCapabilitiesUtils()
39 {
40 }
41 
42 NS_IMETHODIMP
43 sbDeviceCapabilitiesUtils::MapContentTypeToFileExtensions(
44  const nsAString &aMimeType,
45  PRUint32 aContentType,
46  nsIStringEnumerator **_retval)
47 {
48  nsTArray<nsCString> fileExtensions;
49 
50  for (PRUint32 index = 0;
52  ++index)
53  {
56 
57  if (aMimeType.EqualsLiteral(entry.MimeType) &&
58  aContentType == entry.ContentType)
59  {
60  fileExtensions.AppendElement(entry.Extension);
61  }
62  }
63 
64  nsCOMPtr<nsIStringEnumerator> fileExtensionEnum =
65  new sbTArrayStringEnumerator(&fileExtensions);
66  NS_ENSURE_TRUE(fileExtensionEnum, NS_ERROR_OUT_OF_MEMORY);
67 
68  fileExtensionEnum.forget(_retval);
69 
70  return NS_OK;
71 }
72 
PRUint32 const MAP_FILE_EXTENSION_CONTENT_FORMAT_LENGTH
classDescription entry
Definition: FeedWriter.js:1427
return NS_OK
NS_IMPL_ISUPPORTS1(sbDeviceCapabilitiesUtils, sbIDeviceCapabilitiesUtils) sbDeviceCapabilitiesUtils
char const * Extension
Definition: sbDeviceUtils.h:55
Definition: sbDeviceUtils.h:54
char const * MimeType
Definition: sbDeviceUtils.h:56
sbExtensionToContentFormatEntry_t const MAP_FILE_EXTENSION_CONTENT_FORMAT[]
PRUint32 ContentType
Definition: sbDeviceUtils.h:61
Temporary interface to allow us to access the mime-type -> file extension mappings in sbDeviceUtils...