00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMimeTypes.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*------------------------------------------------------------------------- 00016 Copyright 2008 Sandia Corporation. 00017 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00018 the U.S. Government retains certain rights in this software. 00019 -------------------------------------------------------------------------*/ 00020 00050 #ifndef _vtkMimeTypes_h 00051 #define _vtkMimeTypes_h 00052 00053 #include <vtkObject.h> 00054 #include <vtkStdString.h> //Needed for lookup 00055 00056 class vtkMimeTypeStrategy; 00057 00058 class VTK_TEXT_ANALYSIS_EXPORT vtkMimeTypes : 00059 public vtkObject 00060 { 00061 public: 00062 static vtkMimeTypes* New(); 00063 vtkTypeMacro(vtkMimeTypes, vtkObject); 00064 void PrintSelf(ostream& os, vtkIndent indent); 00065 00067 00068 void ClearStrategies(); 00069 // Description: 00070 // Prepend a strategy to the list of strategies. vtkMimeTypes assumes ownership 00071 // of the supplied object. 00072 void PrependStrategy(vtkMimeTypeStrategy* strategy); 00073 // Description: 00074 // Append a strategy to the list of strategies. vtkMimeTypes assumes ownership 00075 // of the supplied object. 00076 void AppendStrategy(vtkMimeTypeStrategy* strategy); 00078 00080 00082 vtkStdString Lookup(const vtkStdString& uri); 00083 // Description: 00084 // Given the contents of a resource, returns the MIME-type of the resource, or 00085 // empty-string if the type cannot be identified. 00086 vtkStdString Lookup(const char* begin, const char* end); 00087 // Description: 00088 // Given the contents of a resource, returns the MIME-type of the resource, or 00089 // empty-string if the type cannot be identified. 00090 vtkStdString Lookup(const vtkTypeUInt8* begin, const vtkTypeUInt8* end); 00091 // Description: 00092 // Given a resource URI and its contents, returns the MIME-type of the resource, 00093 // or empty-string if the type cannot be identified. 00094 vtkStdString Lookup(const vtkStdString& uri, const char* begin, const char* end); 00095 // Description: 00096 // Given a resource URI and its contents, returns the MIME-type of the resource, 00097 // or empty-string if the type cannot be identified. 00098 vtkStdString Lookup(const vtkStdString& uri, const vtkTypeUInt8* begin, const vtkTypeUInt8* end); 00100 *" will match any type (including empty 00103 type), and "text/*" will match "text/plain", "text/html", "text/xml", 00104 etc. */ 00105 static bool Match(const vtkStdString& pattern, const vtkStdString& type); 00106 00107 //BTX 00108 private: 00109 vtkMimeTypes(); 00110 ~vtkMimeTypes(); 00111 00112 vtkMimeTypes(const vtkMimeTypes&); //Not implemented. 00113 void operator=(const vtkMimeTypes&); //Not implemented. 00114 00115 class Implementation; 00116 Implementation* const Internal; 00117 //ETX 00118 }; 00119 00120 #endif // !_vtkMimeTypes_h 00121