Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

TagDef.hpp

Go to the documentation of this file.
00001 /*
00002     libglim: a C++ Free library render images using OpenGL
00003     Copyright (C) 2002 Nestal Wan
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00026 #ifndef __PICINFO_TAG_DEF_HEADER_INCLUDED__
00027 #define __PICINFO_TAG_DEF_HEADER_INCLUDED__
00028 
00029 #ifndef __PICINFO_EXIF_TYPES_HEADER_INCLUDED__
00030 #include "ExifTypes.hpp"
00031 #endif
00032 
00033 #include <cstddef>
00034 #include <ostream>
00035 #include <string>
00036 
00037 namespace picinfo {
00038 
00039 // forward declaration
00040 struct TagDef ;
00041 struct TagSpace ;
00042 extern const TagSpace exif_tspace ;
00043 
00050 class CTagDef
00051 {
00052 private :
00054     const TagDef    *m_def ;
00055 
00056     typedef std::ostream& (*FormatFunc)( std::ostream&, const void *data,
00057                                          std::size_t size, std::size_t count,
00058                                          int endian ) ;
00059     static const FormatFunc m_format_func[] ;
00060 
00061 public :
00062     explicit CTagDef( tag_t tag, const TagSpace& tspace = exif_tspace ) ;
00063     
00064     bool CheckDef( uint16_t type, uint32_t count ) const ;
00065 
00066     tag_t Tag( ) const ;
00067     uint16_t TypeMask( ) const ;
00068     
00069     uint32_t MaxCount( ) const ;
00070     uint32_t MinCount( ) const ;
00071 
00072     const char* LongName( ) const ;
00073     const char* TagName( ) const ;
00074     
00075     static uint32_t DataSize( uint16_t type ) ;
00076     
00077     std::ostream& Format( std::ostream& os,
00078                           uint16_t type, const void *data, std::size_t size,
00079                           std::size_t count, int endian ) const ;
00080 
00081 private :
00082     static std::ostream& FormatAscii( std::ostream& os, const void *data,
00083                                       std::size_t size, std::size_t count,
00084                                       int endian ) ;
00085     static std::ostream& FormatUndefined( std::ostream& os, const void *data,
00086                                           std::size_t size, std::size_t count,
00087                                           int endian ) ;
00088     static std::ostream& FormatUnsupported( std::ostream& os, const void *data,
00089                                             std::size_t size, std::size_t count,
00090                                             int endian ) ;
00091 
00092     const char* FindEnumName( uint32_t value ) const ;
00093 
00094     template <typename T1, typename T2>
00095     static std::ostream& Format( std::ostream& os, const void *data, std::size_t,
00096                                  std::size_t count, int endian ) ;
00097 
00098     template <typename T>
00099     std::ostream& FormatEnum( std::ostream& os, const void *data, std::size_t size,
00100                               std::size_t count, int endian ) const ;
00101 } ;
00102 
00103 } // end of namespace
00104 
00105 #endif

Generated on Fri Jan 13 23:38:12 2006 for picinfo by  doxygen 1.4.4