]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/msdos/mimetype.cpp
Replace incorrect uses of wxString::empty() with the intended clear().
[wxWidgets.git] / src / msdos / mimetype.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/msdos/mimetype.cpp
3// Purpose: classes and functions to manage MIME types
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 23.09.98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9// Licence: wxWindows licence (part of wxExtra library)
10/////////////////////////////////////////////////////////////////////////////
11
12// for compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
16 #pragma hdrstop
17#endif
18
19#if wxUSE_MIMETYPE
20
21#include "wx/msdos/mimetype.h"
22
23#ifndef WX_PRECOMP
24 #include "wx/dynarray.h"
25 #include "wx/string.h"
26 #include "wx/intl.h"
27 #include "wx/log.h"
28 #if wxUSE_GUI
29 #include "wx/icon.h"
30 #endif
31#endif //WX_PRECOMP
32
33#include "wx/file.h"
34#include "wx/confbase.h"
35
36// other standard headers
37#include <ctype.h>
38
39// in case we're compiling in non-GUI mode
40class WXDLLEXPORT wxIcon;
41
42bool wxFileTypeImpl::SetCommand(const wxString& WXUNUSED(cmd),
43 const wxString& WXUNUSED(verb),
44 bool WXUNUSED(overwriteprompt))
45{
46 return false;
47}
48
49bool wxFileTypeImpl::SetDefaultIcon(const wxString& WXUNUSED(strIcon),
50 int WXUNUSED(index))
51{
52 return false;
53}
54
55bool wxFileTypeImpl::GetCommand(wxString *WXUNUSED(command),
56 const char *WXUNUSED(verb)) const
57{
58 return false;
59}
60
61bool wxFileTypeImpl::GetExtensions(wxArrayString& WXUNUSED(extensions))
62{
63 return false;
64}
65
66bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
67{
68 if ( !m_strFileType.empty() )
69 {
70 *mimeType = m_strFileType ;
71 return true ;
72 }
73 else
74 return false;
75}
76
77bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const
78{
79 wxString s;
80
81 if (GetMimeType(&s))
82 {
83 mimeTypes.Clear();
84 mimeTypes.Add(s);
85 return true;
86 }
87 else
88 return false;
89}
90
91bool wxFileTypeImpl::GetIcon(wxIconLocation *WXUNUSED(icon)) const
92{
93 // no such file type or no value or incorrect icon entry
94 return false;
95}
96
97bool wxFileTypeImpl::GetDescription(wxString *WXUNUSED(desc)) const
98{
99 return false;
100}
101
102size_t
103wxFileTypeImpl::GetAllCommands(wxArrayString * WXUNUSED(verbs),
104 wxArrayString * WXUNUSED(commands),
105 const wxFileType::MessageParameters& WXUNUSED(params)) const
106{
107 wxFAIL_MSG( wxT("wxFileTypeImpl::GetAllCommands() not yet implemented") );
108 return 0;
109}
110
111void
112wxMimeTypesManagerImpl::Initialize(int WXUNUSED(mailcapStyles),
113 const wxString& WXUNUSED(extraDir))
114{
115 wxFAIL_MSG( wxT("wxMimeTypesManagerImpl::Initialize() not yet implemented") );
116}
117
118void
119wxMimeTypesManagerImpl::ClearData()
120{
121 wxFAIL_MSG( wxT("wxMimeTypesManagerImpl::ClearData() not yet implemented") );
122}
123
124// extension -> file type
125wxFileType *
126wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& e)
127{
128 wxString ext = e ;
129 ext = ext.Lower() ;
130 if ( ext == wxT("txt") )
131 {
132 wxFileType *fileType = new wxFileType;
133 fileType->m_impl->SetFileType(wxT("text/text"));
134 fileType->m_impl->SetExt(ext);
135 return fileType;
136 }
137 else if ( ext == wxT("htm") || ext == wxT("html") )
138 {
139 wxFileType *fileType = new wxFileType;
140 fileType->m_impl->SetFileType(wxT("text/html"));
141 fileType->m_impl->SetExt(ext);
142 return fileType;
143 }
144 else if ( ext == wxT("gif") )
145 {
146 wxFileType *fileType = new wxFileType;
147 fileType->m_impl->SetFileType(wxT("image/gif"));
148 fileType->m_impl->SetExt(ext);
149 return fileType;
150 }
151 else if ( ext == wxT("png" ))
152 {
153 wxFileType *fileType = new wxFileType;
154 fileType->m_impl->SetFileType(wxT("image/png"));
155 fileType->m_impl->SetExt(ext);
156 return fileType;
157 }
158 else if ( ext == wxT("jpg" )|| ext == wxT("jpeg") )
159 {
160 wxFileType *fileType = new wxFileType;
161 fileType->m_impl->SetFileType(wxT("image/jpeg"));
162 fileType->m_impl->SetExt(ext);
163 return fileType;
164 }
165 else if ( ext == wxT("bmp") )
166 {
167 wxFileType *fileType = new wxFileType;
168 fileType->m_impl->SetFileType(wxT("image/bmp"));
169 fileType->m_impl->SetExt(ext);
170 return fileType;
171 }
172 else if ( ext == wxT("tif") || ext == wxT("tiff") )
173 {
174 wxFileType *fileType = new wxFileType;
175 fileType->m_impl->SetFileType(wxT("image/tiff"));
176 fileType->m_impl->SetExt(ext);
177 return fileType;
178 }
179 else if ( ext == wxT("xpm") )
180 {
181 wxFileType *fileType = new wxFileType;
182 fileType->m_impl->SetFileType(wxT("image/xpm"));
183 fileType->m_impl->SetExt(ext);
184 return fileType;
185 }
186 else if ( ext == wxT("xbm") )
187 {
188 wxFileType *fileType = new wxFileType;
189 fileType->m_impl->SetFileType(wxT("image/xbm"));
190 fileType->m_impl->SetExt(ext);
191 return fileType;
192 }
193
194 // unknown extension
195 return NULL;
196}
197
198// MIME type -> extension -> file type
199wxFileType *
200wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& WXUNUSED(mimeType))
201{
202 return NULL;
203}
204
205size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& WXUNUSED(mimetypes))
206{
207 // VZ: don't know anything about this for Mac
208 wxFAIL_MSG( wxT("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
209
210 return 0;
211}
212
213wxFileType *
214wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& WXUNUSED(ftInfo))
215{
216 wxFAIL_MSG( wxT("wxMimeTypesManagerImpl::Associate() not yet implemented") );
217
218 return NULL;
219}
220
221bool
222wxMimeTypesManagerImpl::Unassociate(wxFileType *WXUNUSED(ft))
223{
224 return false;
225}
226
227#endif // wxUSE_MIMETYPE