/* ------------------------------------------------------------------------------ MetaCam - Extract EXIF information from digital camera files, with support for Vendor specific blocks. Copyright (C) 2000 Daniel Stephens (daniel@cheeseplant.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------ */ #include #include "datatiff.h" static const char *rcsid __attribute__((unused))="$Id: dataifdentry.cc,v 1.3 2002/09/02 19:20:01 daniel Exp $"; _DataIFDEntry::_DataIFDEntry(const TIFFDataSource &src, long ofs, long t, short typ, long vals) : _IFDEntry(t, typ), source(src), value_count(vals), offset(ofs) { } _DataIFDEntry::~_DataIFDEntry() { } unsigned long _DataIFDEntry::values() const { return value_count; } vector _DataIFDEntry::getUVALUE() const { vector v; if (getRawType() == tBYTE) { source.seek(offset); for (unsigned int i=0; i _DataIFDEntry::getSVALUE() const { vector v; if (getRawType() == tSBYTE) { source.seek(offset); for (unsigned int i=0; i _DataIFDEntry::getRATIONAL() const { vector v; if (getRawType() != tRATIONAL) {return v;} source.seek(offset); for (unsigned int i=0; i _DataIFDEntry::getSRATIONAL() const { vector v; if (getRawType() != tSRATIONAL) {return v;} source.seek(offset); for (unsigned int i=0; i _DataIFDEntry::getSTRING() const { vector v; if (getRawType() != tASCII) {return v;} char tmpbuf[1024]; source.seek(offset); source.getData((unsigned char *)tmpbuf, value_count); tmpbuf[value_count] = 0; v.push_back(string(tmpbuf)); return v; } vector _DataIFDEntry::getOPAQUE() const { vector v; if (getRawType() != tUNDEFINED) {return v;} int toget=value_count; source.seek(offset); while (toget > 0) { unsigned char tmpbuf[1024]; int g = toget; if (g>1024) g=1024; source.getData((unsigned char *)tmpbuf, g); for (int i=0; i v = getSTRING(); vector::iterator iter; for (iter=v.begin(); iter != v.end(); ++iter) { os << "\"" << (*iter) << "\","; } return; } case 1: case 3: case 4: { vector v = getUVALUE(); vector::iterator iter; for (iter=v.begin(); iter != v.end(); ++iter) { os << (*iter) << ","; } return; } case 5: { vector v = getRATIONAL(); vector::iterator iter; for (iter=v.begin(); iter != v.end(); ++iter) { os << (*iter) << ","; } return; } case 7: { vector v = getOPAQUE(); vector::iterator iter; for (iter=v.begin(); iter != v.end(); ++iter) { unsigned char c=(*iter); os << hexdigit[(c >> 4) & 0x0f] << hexdigit[c&0x0F] << " "; } return; } case 6: case 8: case 9: { vector v = getSVALUE(); vector::iterator iter; for (iter=v.begin(); iter != v.end(); ++iter) { os << (*iter) << ","; } return; } case 10: { vector v = getSRATIONAL(); vector::iterator iter; for (iter=v.begin(); iter != v.end(); ++iter) { os << (*iter) << ","; } return; } } // 11 FLOAT // 12 DOUBLE }