• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

MimeTable.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   MimeTableEntry and MimeTable declarations
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 #if !defined (_MimeTable_h_)
00025 #define _MimeTable_h_
00026 
00027 #include <string.h>
00028 #include "ink_defs.h"
00029 #include "ink_string.h"
00030 
00031 struct MimeTableEntry
00032 {
00033   const char *name;
00034   const char *mime_type;
00035   const char *mime_encoding;
00036   const char *icon;
00037 
00038   friend int operator ==(const MimeTableEntry & a, const MimeTableEntry & b)
00039   {
00040     return (strcasecmp(a.name, b.name) == 0);
00041   }
00042   friend int operator <(const MimeTableEntry & a, const MimeTableEntry & b)
00043   {
00044     return (strcasecmp(a.name, b.name) < 0);
00045   }
00046   friend int operator >(const MimeTableEntry & a, const MimeTableEntry & b)
00047   {
00048     return (strcasecmp(a.name, b.name) < 0);
00049   }
00050 };
00051 
00052 class MimeTable
00053 {
00054 public:
00055   MimeTable()
00056   {
00057   }
00058    ~MimeTable()
00059   {
00060   }
00061 
00062   MimeTableEntry *get_entry_path(const char *path);
00063   MimeTableEntry *get_entry(const char *name);
00064 
00065 private:
00066   static MimeTableEntry m_table[];
00067   static int m_table_size;
00068   static MimeTableEntry m_unknown;
00069 
00070 private:
00071   MimeTable(const MimeTable &);
00072   MimeTable & operator =(const MimeTable &);
00073 };
00074 extern MimeTable mimeTable;
00075 #endif

Generated by  doxygen 1.7.1