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

ExifEntry.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 License
00007     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_EXIF_ENTRY_HEADER_INCLUDED__
00027 #define __PICINFO_EXIF_ENTRY_HEADER_INCLUDED__
00028 
00029 #ifndef __PICINFO_TAG_DEF_HEADER_INCLUDED__
00030 #include "TagDef.hpp"
00031 #endif
00032 
00033 #ifndef __PICINFO_CSTDINT_HEADER_INCLUDED__
00034 #include "cstdint.hpp"
00035 #endif
00036 
00037 #include <algorithm>
00038 #include <cstdio>
00039 #include <cstring>
00040 #include <iosfwd>
00041 #include <vector>
00042 
00043 namespace picinfo {
00044 
00045 class CTiff ;
00046 struct TagSpace ;
00047 
00052 class CExifEntry
00053 {
00054 private :
00055     CTagDef     m_tag ;     
00056     uint16_t    m_type ;    
00057     uint32_t    m_count ;   
00058     uint32_t    m_offset ;  
00059     
00060     CTiff       *m_file ;   
00061     
00066     mutable std::vector<unsigned char>  m_data ;
00067     
00068 private :
00070     template <typename T1, typename T2>
00071     struct Convert
00072     {
00073         T2 operator()( const CExifEntry *e, std::size_t idx ) ;
00074     } ;
00075 
00076 public :
00077     CExifEntry( tag_t tag, const TagSpace& tspace  ) ;
00078     CExifEntry( tag_t tag, const TagSpace& tspace, uint16_t type,
00079                uint32_t count, uint32_t offset, CTiff *file ) ;
00080 
00081     bool operator<( const CExifEntry& rhs ) const ;
00082 
00083     tag_t Tag( ) const ;
00084     uint32_t Count( ) const ;
00085     
00086     const char* LongName( ) const ;
00087     const char* TagName( ) const ;
00088 
00089     unsigned char* Data( ) ;
00090     const unsigned char* Data( ) const ;
00091     uint32_t Size( ) const ;
00092 
00093     template <typename T>
00094     const T As( std::size_t idx = 0 ) const ;
00095 
00096     std::string Format( ) const ;
00097 
00098     friend std::ostream& operator<<( std::ostream& os, const CExifEntry& e ) ;
00099 
00100 private :
00101     bool IsReference( ) const ;
00102     bool IsDataReady( ) const ;
00103     void EnsureDataReady( ) const ;
00104     
00105 } ;
00106 
00107 } // end of namespace
00108 
00109 #endif

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