Naming convention: Renamed data members xyz_ that are pointers to pXyz_

This commit is contained in:
Andreas Huggel
2004-03-23 02:55:12 +00:00
parent 8d677a69f3
commit 3681403ac4
8 changed files with 132 additions and 125 deletions
+34 -34
View File
@@ -20,14 +20,14 @@
*/
/*
File: exif.cpp
Version: $Name: $ $Revision: 1.32 $
Version: $Name: $ $Revision: 1.33 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 26-Jan-04, ahu: created
11-Feb-04, ahu: isolated as a component
*/
// *****************************************************************************
#include "rcsid.hpp"
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.32 $ $RCSfile: exif.cpp,v $")
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.33 $ $RCSfile: exif.cpp,v $")
// *****************************************************************************
// included header files
@@ -74,18 +74,18 @@ namespace Exif {
Metadatum::Metadatum(const Entry& e, ByteOrder byteOrder)
: tag_(e.tag()), ifdId_(e.ifdId()), idx_(e.idx()),
pMakerNote_(e.makerNote()), value_(0), key_(makeKey(e))
pMakerNote_(e.makerNote()), pValue_(0), key_(makeKey(e))
{
value_ = Value::create(TypeId(e.type()));
value_->read(e.data(), e.count() * e.typeSize(), byteOrder);
pValue_ = Value::create(TypeId(e.type()));
pValue_->read(e.data(), e.count() * e.typeSize(), byteOrder);
}
Metadatum::Metadatum(const std::string& key,
const Value* value,
MakerNote* makerNote)
: idx_(0), pMakerNote_(makerNote), value_(0), key_(key)
: idx_(0), pMakerNote_(makerNote), pValue_(0), key_(key)
{
if (value) value_ = value->clone();
if (value) pValue_ = value->clone();
std::pair<uint16, IfdId> p = decomposeKey(key, makerNote);
if (p.first == 0xffff) throw Error("Invalid key");
tag_ = p.first;
@@ -95,15 +95,15 @@ namespace Exif {
Metadatum::~Metadatum()
{
delete value_;
delete pValue_;
// do *not* delete the MakerNote
}
Metadatum::Metadatum(const Metadatum& rhs)
: tag_(rhs.tag_), ifdId_(rhs.ifdId_), idx_(rhs.idx_),
pMakerNote_(rhs.pMakerNote_), value_(0), key_(rhs.key_)
pMakerNote_(rhs.pMakerNote_), pValue_(0), key_(rhs.key_)
{
if (rhs.value_ != 0) value_ = rhs.value_->clone(); // deep copy
if (rhs.pValue_ != 0) pValue_ = rhs.pValue_->clone(); // deep copy
}
Metadatum& Metadatum::operator=(const Metadatum& rhs)
@@ -113,30 +113,30 @@ namespace Exif {
ifdId_ = rhs.ifdId_;
idx_ = rhs.idx_;
pMakerNote_ = rhs.pMakerNote_;
delete value_;
value_ = 0;
if (rhs.value_ != 0) value_ = rhs.value_->clone(); // deep copy
delete pValue_;
pValue_ = 0;
if (rhs.pValue_ != 0) pValue_ = rhs.pValue_->clone(); // deep copy
key_ = rhs.key_;
return *this;
} // Metadatum::operator=
void Metadatum::setValue(const Value* value)
void Metadatum::setValue(const Value* pValue)
{
delete value_;
value_ = value->clone();
delete pValue_;
pValue_ = pValue->clone();
}
void Metadatum::setValue(const Entry& e, ByteOrder byteOrder)
{
delete value_;
value_ = Value::create(TypeId(e.type()));
value_->read(e.data(), e.count() * e.typeSize(), byteOrder);
delete pValue_;
pValue_ = Value::create(TypeId(e.type()));
pValue_->read(e.data(), e.count() * e.typeSize(), byteOrder);
}
void Metadatum::setValue(const std::string& buf)
{
if (value_ == 0) value_ = Value::create(asciiString);
value_->read(buf);
if (pValue_ == 0) pValue_ = Value::create(asciiString);
pValue_->read(buf);
}
std::string Metadatum::tagName() const
@@ -467,7 +467,7 @@ namespace Exif {
: pThumbnail_(0), pMakerNote_(0), ifd0_(ifd0, 0, false),
exifIfd_(exifIfd, 0, false), iopIfd_(iopIfd, 0, false),
gpsIfd_(gpsIfd, 0, false), ifd1_(ifd1, 0, false),
size_(0), data_(0)
size_(0), pData_(0)
{
}
@@ -475,7 +475,7 @@ namespace Exif {
{
delete pMakerNote_;
delete pThumbnail_;
delete[] data_;
delete[] pData_;
}
int ExifData::read(const std::string& path)
@@ -489,23 +489,23 @@ namespace Exif {
int ExifData::read(const char* buf, long len)
{
// Copy the data buffer
delete[] data_;
data_ = new char[len];
memcpy(data_, buf, len);
delete[] pData_;
pData_ = new char[len];
memcpy(pData_, buf, len);
size_ = len;
// Read the TIFF header
int ret = 0;
int rc = tiffHeader_.read(data_);
int rc = tiffHeader_.read(pData_);
if (rc) return rc;
// Read IFD0
rc = ifd0_.read(data_ + tiffHeader_.offset(),
rc = ifd0_.read(pData_ + tiffHeader_.offset(),
byteOrder(),
tiffHeader_.offset());
if (rc) return rc;
// Find and read ExifIFD sub-IFD of IFD0
rc = ifd0_.readSubIfd(exifIfd_, data_, byteOrder(), 0x8769);
rc = ifd0_.readSubIfd(exifIfd_, pData_, byteOrder(), 0x8769);
if (rc) return rc;
// Find MakerNote in ExifIFD, create a MakerNote class
Ifd::iterator pos = exifIfd_.findTag(0x927c);
@@ -533,14 +533,14 @@ namespace Exif {
exifIfd_.erase(pos);
}
// Find and read Interoperability IFD in ExifIFD
rc = exifIfd_.readSubIfd(iopIfd_, data_, byteOrder(), 0xa005);
rc = exifIfd_.readSubIfd(iopIfd_, pData_, byteOrder(), 0xa005);
if (rc) return rc;
// Find and read GPSInfo sub-IFD in IFD0
rc = ifd0_.readSubIfd(gpsIfd_, data_, byteOrder(), 0x8825);
rc = ifd0_.readSubIfd(gpsIfd_, pData_, byteOrder(), 0x8825);
if (rc) return rc;
// Read IFD1
if (ifd0_.next()) {
rc = ifd1_.read(data_ + ifd0_.next(), byteOrder(), ifd0_.next());
rc = ifd1_.read(pData_ + ifd0_.next(), byteOrder(), ifd0_.next());
if (rc) return rc;
}
// Find and delete ExifIFD sub-IFD of IFD1
@@ -596,7 +596,7 @@ namespace Exif {
//ahu Todo: remove debugging output
std::cerr << "->>>>>> using non-intrusive writing <<<<<<-\n";
memcpy(buf, data_, size_);
memcpy(buf, pData_, size_);
size = size_;
}
// Else we have to do it the hard way...
@@ -839,7 +839,7 @@ std::cerr << "->>>>>> writing from metadata <<<<<<-\n";
else {
pThumbnail_ = new TiffThumbnail;
}
rc = pThumbnail_->read(data_, *this, byteOrder());
rc = pThumbnail_->read(pData_, *this, byteOrder());
if (rc != 0) {
delete pThumbnail_;
pThumbnail_ = 0;
+24 -20
View File
@@ -21,7 +21,7 @@
/*!
@file exif.hpp
@brief Encoding and decoding of %Exif data
@version $Name: $ $Revision: 1.31 $
@version $Name: $ $Revision: 1.32 $
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 09-Jan-04, ahu: created
@@ -93,9 +93,10 @@ namespace Exif {
//! Assignment operator
Metadatum& operator=(const Metadatum& rhs);
/*!
@brief Set the value. This method copies (clones) the value.
@brief Set the value. This method copies (clones) the value pointed
to by pValue.
*/
void setValue(const Value* value);
void setValue(const Value* pValue);
/*!
@brief Set the value from an IFD entry.
*/
@@ -122,7 +123,7 @@ namespace Exif {
@return Number of characters written.
*/
long copy(char* buf, ByteOrder byteOrder) const
{ return value_ == 0 ? 0 : value_->copy(buf, byteOrder); }
{ return pValue_ == 0 ? 0 : pValue_->copy(buf, byteOrder); }
/*!
@brief Return the key of the metadatum. The key is of the form
'ifdItem.sectionName.tagName'. Note however that the key
@@ -139,15 +140,15 @@ namespace Exif {
uint16 tag() const { return tag_; }
//! Return the type id of the value
TypeId typeId() const
{ return value_ == 0 ? invalidTypeId : value_->typeId(); }
{ return pValue_ == 0 ? invalidTypeId : pValue_->typeId(); }
//! Return the name of the type
const char* typeName() const { return TypeInfo::typeName(typeId()); }
//! Return the size in bytes of one component of this type
long typeSize() const { return TypeInfo::typeSize(typeId()); }
//! Return the number of components in the value
long count() const { return value_ == 0 ? 0 : value_->count(); }
long count() const { return pValue_ == 0 ? 0 : pValue_->count(); }
//! Return the size of the value in bytes
long size() const { return value_ == 0 ? 0 : value_->size(); }
long size() const { return pValue_ == 0 ? 0 : pValue_->size(); }
//! Return the IFD id
IfdId ifdId() const { return ifdId_; }
//! Return the name of the IFD
@@ -158,7 +159,7 @@ namespace Exif {
MakerNote* makerNote() const { return pMakerNote_; }
//! Return the value as a string.
std::string toString() const
{ return value_ == 0 ? "" : value_->toString(); }
{ return pValue_ == 0 ? "" : pValue_->toString(); }
/*!
@brief Return the n-th component of the value converted to long. The
return value is -1 if the value of the Metadatum is not set and
@@ -166,7 +167,7 @@ namespace Exif {
component.
*/
long toLong(long n =0) const
{ return value_ == 0 ? -1 : value_->toLong(n); }
{ return pValue_ == 0 ? -1 : pValue_->toLong(n); }
/*!
@brief Return the n-th component of the value converted to float. The
return value is -1 if the value of the Metadatum is not set and
@@ -174,7 +175,7 @@ namespace Exif {
component.
*/
float toFloat(long n =0) const
{ return value_ == 0 ? -1 : value_->toFloat(n); }
{ return pValue_ == 0 ? -1 : pValue_->toFloat(n); }
/*!
@brief Return the n-th component of the value converted to
Rational. The return value is -1/1 if the value of the
@@ -182,7 +183,7 @@ namespace Exif {
undefined if there is no n-th component.
*/
Rational toRational(long n =0) const
{ return value_ == 0 ? Rational(-1, 1) : value_->toRational(n); }
{ return pValue_ == 0 ? Rational(-1, 1) : pValue_->toRational(n); }
/*!
@brief Return a pointer to a copy (clone) of the value. The caller
is responsible to delete this copy when it's no longer needed.
@@ -195,7 +196,7 @@ namespace Exif {
@return A pointer to a copy (clone) of the value, 0 if the value is
not set.
*/
Value* getValue() const { return value_ == 0 ? 0 : value_->clone(); }
Value* getValue() const { return pValue_ == 0 ? 0 : pValue_->clone(); }
/*!
@brief Return a constant reference to the value.
@@ -216,15 +217,16 @@ namespace Exif {
@throw Error ("Value not set") if the value is not set.
*/
const Value& value() const
{ if (value_) return *value_; throw Error("Value not set"); }
{ if (pValue_) return *pValue_; throw Error("Value not set"); }
//@}
private:
// DATA
uint16 tag_; //!< Tag value
IfdId ifdId_; //!< The IFD associated with this tag
int idx_; //!< Unique id of an entry within one IFD
MakerNote* pMakerNote_; //!< Pointer to the associated MakerNote
Value* value_; //!< Pointer to the value
Value* pValue_; //!< Pointer to the value
std::string key_; //!< Key
}; // class Metadatum
@@ -278,12 +280,14 @@ namespace Exif {
there is no thumbnail image to write.
*/
virtual int write(const std::string& path) const =0;
/*
@brief Return a short string for the format of the thumbnail (TIFF, JPEG).
/*!
@brief Return a short string for the format of the thumbnail
("TIFF", "JPEG").
*/
virtual const char* format() const =0;
/*
@brief Return the file extension for the format of the thumbnail.
/*!
@brief Return the file extension for the format of the thumbnail
(".tif", ".jpg").
*/
virtual const char* extension() const =0;
/*!
@@ -740,8 +744,8 @@ namespace Exif {
Ifd gpsIfd_;
Ifd ifd1_;
long size_; // Size of the Exif raw data in bytes
char* data_; // Exif raw data buffer
long size_; //!< Size of the Exif raw data in bytes
char* pData_; //!< Exif raw data buffer
}; // class ExifData
+29 -29
View File
@@ -20,14 +20,14 @@
*/
/*
File: ifd.cpp
Version: $Name: $ $Revision: 1.14 $
Version: $Name: $ $Revision: 1.15 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 26-Jan-04, ahu: created
11-Feb-04, ahu: isolated as a component
*/
// *****************************************************************************
#include "rcsid.hpp"
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.14 $ $RCSfile: ifd.cpp,v $")
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.15 $ $RCSfile: ifd.cpp,v $")
// *****************************************************************************
// included header files
@@ -50,30 +50,30 @@ EXIV2_RCSID("@(#) $Name: $ $Revision: 1.14 $ $RCSfile: ifd.cpp,v $")
namespace Exif {
Entry::Entry(bool alloc)
: alloc_(alloc), ifdId_(ifdIdNotSet), idx_(0), makerNote_(0),
tag_(0), type_(0), count_(0), offset_(0), size_(0), data_(0)
: alloc_(alloc), ifdId_(ifdIdNotSet), idx_(0), pMakerNote_(0),
tag_(0), type_(0), count_(0), offset_(0), size_(0), pData_(0)
{
}
Entry::~Entry()
{
if (alloc_) delete[] data_;
if (alloc_) delete[] pData_;
// do *not* delete the MakerNote
}
Entry::Entry(const Entry& rhs)
: alloc_(rhs.alloc_), ifdId_(rhs.ifdId_), idx_(rhs.idx_),
makerNote_(rhs.makerNote_), tag_(rhs.tag_), type_(rhs.type_),
count_(rhs.count_), offset_(rhs.offset_), size_(rhs.size_), data_(0)
pMakerNote_(rhs.pMakerNote_), tag_(rhs.tag_), type_(rhs.type_),
count_(rhs.count_), offset_(rhs.offset_), size_(rhs.size_), pData_(0)
{
if (alloc_) {
if (rhs.data_) {
data_ = new char[rhs.size()];
memcpy(data_, rhs.data_, rhs.size());
if (rhs.pData_) {
pData_ = new char[rhs.size()];
memcpy(pData_, rhs.pData_, rhs.size());
}
}
else {
data_ = rhs.data_;
pData_ = rhs.pData_;
}
}
@@ -83,35 +83,35 @@ namespace Exif {
alloc_ = rhs.alloc_;
ifdId_ = rhs.ifdId_;
idx_ = rhs.idx_;
makerNote_ = rhs.makerNote_;
pMakerNote_ = rhs.pMakerNote_;
tag_ = rhs.tag_;
type_ = rhs.type_;
count_ = rhs.count_;
offset_ = rhs.offset_;
size_ = rhs.size_;
if (alloc_) {
delete[] data_;
data_ = 0;
if (rhs.data_) {
data_ = new char[rhs.size()];
memcpy(data_, rhs.data_, rhs.size());
delete[] pData_;
pData_ = 0;
if (rhs.pData_) {
pData_ = new char[rhs.size()];
memcpy(pData_, rhs.pData_, rhs.size());
}
}
else {
data_ = rhs.data_;
pData_ = rhs.pData_;
}
return *this;
} // Entry::operator=
void Entry::setValue(uint32 data, ByteOrder byteOrder)
{
if (data_ == 0 || size_ < 4) {
if (pData_ == 0 || size_ < 4) {
assert(alloc_);
size_ = 4;
delete[] data_;
data_ = new char[size_];
delete[] pData_;
pData_ = new char[size_];
}
ul2Data(data_, data, byteOrder);
ul2Data(pData_, data, byteOrder);
// do not change size_
type_ = unsignedLong;
count_ = 1;
@@ -125,23 +125,23 @@ namespace Exif {
throw Error("Size too small");
}
if (alloc_) {
delete[] data_;
data_ = new char[len];
memset(data_, 0x0, len);
memcpy(data_, buf, dataSize);
delete[] pData_;
pData_ = new char[len];
memset(pData_, 0x0, len);
memcpy(pData_, buf, dataSize);
size_ = len;
}
else {
if (size_ == 0) {
// Set the data pointer of a virgin entry
data_ = const_cast<char*>(buf);
pData_ = const_cast<char*>(buf);
size_ = len;
}
else {
// Overwrite existing data if it fits into the buffer
if (dataSize > size_) throw Error("Value too large");
memset(data_, 0x0, size_);
memcpy(data_, buf, dataSize);
memset(pData_, 0x0, size_);
memcpy(pData_, buf, dataSize);
// do not change size_
}
}
+8 -6
View File
@@ -21,7 +21,7 @@
/*!
@file ifd.hpp
@brief Encoding and decoding of IFD (Image File Directory) data
@version $Name: $ $Revision: 1.12 $
@version $Name: $ $Revision: 1.13 $
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 09-Jan-04, ahu: created
@@ -83,7 +83,7 @@ namespace Exif {
//! Set the index (unique id of an entry within one IFD)
void setIdx(int idx) { idx_ = idx; }
//! Set the pointer to the MakerNote
void setMakerNote(MakerNote* makerNote) { makerNote_ = makerNote; }
void setMakerNote(MakerNote* makerNote) { pMakerNote_ = makerNote; }
//! Set the offset. The offset is relative to the start of the IFD.
void setOffset(uint32 offset) { offset_ = offset; }
/*!
@@ -146,7 +146,7 @@ namespace Exif {
//! Return the index (unique id >0 of an entry within an IFD, 0 if not set)
int idx() const { return idx_; }
//! Return the pointer to the associated MakerNote
MakerNote* makerNote() const { return makerNote_; }
MakerNote* makerNote() const { return pMakerNote_; }
//! Return the number of components in the value
uint32 count() const { return count_; }
/*!
@@ -161,7 +161,7 @@ namespace Exif {
@brief Return a pointer to the data area. Do not attempt to write
to this pointer.
*/
const char* data() const { return data_; }
const char* data() const { return pData_; }
/*!
@brief Return a pointer to the n-th component, 0 if there is no
n-th component. Do not attempt to write to this pointer.
@@ -172,6 +172,7 @@ namespace Exif {
//@}
private:
// DATA
/*!
True: Requires memory allocation and deallocation,<BR>
False: No memory management needed.
@@ -182,7 +183,7 @@ namespace Exif {
//! Unique id of an entry within an IFD (0 if not set)
int idx_;
//! Pointer to the associated MakerNote
MakerNote* makerNote_;
MakerNote* pMakerNote_;
//! Tag
uint16 tag_;
//! Type
@@ -197,7 +198,7 @@ namespace Exif {
*/
long size_;
//! Pointer to the data buffer
char* data_;
char* pData_;
}; // class Entry
@@ -451,6 +452,7 @@ namespace Exif {
//! Container for 'pre-entries'
typedef std::vector<PreEntry> PreEntries;
// DATA
/*!
True: requires memory allocation and deallocation,
False: no memory management needed.
+12 -12
View File
@@ -20,14 +20,14 @@
*/
/*
File: image.cpp
Version: $Name: $ $Revision: 1.2 $
Version: $Name: $ $Revision: 1.3 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 26-Jan-04, ahu: created
11-Feb-04, ahu: isolated as a component
*/
// *****************************************************************************
#include "rcsid.hpp"
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.2 $ $RCSfile: image.cpp,v $")
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.3 $ $RCSfile: image.cpp,v $")
// *****************************************************************************
// included header files
@@ -47,13 +47,13 @@ EXIV2_RCSID("@(#) $Name: $ $Revision: 1.2 $ $RCSfile: image.cpp,v $")
namespace Exif {
JpegImage::JpegImage()
: sizeExifData_(0), exifData_(0)
: sizeExifData_(0), pExifData_(0)
{
}
JpegImage::~JpegImage()
{
delete[] exifData_;
delete[] pExifData_;
}
const uint16 JpegImage::soi_ = 0xffd8;
@@ -107,11 +107,11 @@ namespace Exif {
// Read the rest of the APP1 field (Exif data)
long sizeExifData = size - 8;
exifData_ = new char[sizeExifData];
is.read(exifData_, sizeExifData);
pExifData_ = new char[sizeExifData];
is.read(pExifData_, sizeExifData);
if (!is.good()) {
delete[] exifData_;
exifData_ = 0;
delete[] pExifData_;
pExifData_ = 0;
return 1;
}
// Finally, set the size and offset of the Exif data buffer
@@ -173,7 +173,7 @@ namespace Exif {
us2Data(tmpbuf + 4, sizeExifData_ + 8, bigEndian);
memcpy(tmpbuf + 6, exifId_, 6);
os.write(tmpbuf, 12);
os.write(exifData_, sizeExifData_);
os.write(pExifData_, sizeExifData_);
if (!os.good()) return 4;
// Copy rest of the stream
is.ignore(size - 8);
@@ -188,9 +188,9 @@ namespace Exif {
void JpegImage::setExifData(const char* buf, long size)
{
sizeExifData_ = size;
delete[] exifData_;
exifData_ = new char[size];
memcpy(exifData_, buf, size);
delete[] pExifData_;
pExifData_ = new char[size];
memcpy(pExifData_, buf, size);
}
TiffHeader::TiffHeader(ByteOrder byteOrder)
+4 -3
View File
@@ -21,7 +21,7 @@
/*!
@file image.hpp
@brief Class JpegImage to access JPEG images
@version $Name: $ $Revision: 1.2 $
@version $Name: $ $Revision: 1.3 $
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 09-Jan-04, ahu: created
@@ -137,7 +137,7 @@ namespace Exif {
//! Return the size of the %Exif data buffer
long sizeExifData() const { return sizeExifData_; }
//! Return a read-only pointer to the %Exif data buffer
const char* exifData() const { return exifData_; }
const char* exifData() const { return pExifData_; }
//@}
/*!
@@ -155,6 +155,7 @@ namespace Exif {
static bool isJpeg(std::istream& is);
private:
// DATA
static const uint16 soi_; // SOI marker
static const uint16 app0_; // APP0 marker
static const uint16 app1_; // APP1 marker
@@ -162,7 +163,7 @@ namespace Exif {
static const char jfifId_[]; // JFIF identifier
long sizeExifData_; // Size of the Exif data buffer
char* exifData_; // Exif data buffer
char* pExifData_; // Exif data buffer
}; // class JpegImage
+14 -14
View File
@@ -20,13 +20,13 @@
*/
/*
File: makernote.cpp
Version: $Name: $ $Revision: 1.12 $
Version: $Name: $ $Revision: 1.13 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 18-Feb-04, ahu: created
*/
// *****************************************************************************
#include "rcsid.hpp"
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.12 $ $RCSfile: makernote.cpp,v $")
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.13 $ $RCSfile: makernote.cpp,v $")
// Define DEBUG_MAKERNOTE to output debug information to std::cerr
#undef DEBUG_MAKERNOTE
@@ -81,10 +81,10 @@ namespace Exif {
std::string MakerNote::tagName(uint16 tag) const
{
std::string tagName;
if (mnTagInfo_) {
for (int i = 0; mnTagInfo_[i].tag_ != 0xffff; ++i) {
if (mnTagInfo_[i].tag_ == tag) {
tagName = mnTagInfo_[i].name_;
if (pMnTagInfo_) {
for (int i = 0; pMnTagInfo_[i].tag_ != 0xffff; ++i) {
if (pMnTagInfo_[i].tag_ == tag) {
tagName = pMnTagInfo_[i].name_;
break;
}
}
@@ -101,10 +101,10 @@ namespace Exif {
uint16 MakerNote::tag(const std::string& tagName) const
{
uint16 tag = 0xffff;
if (mnTagInfo_) {
for (int i = 0; mnTagInfo_[i].tag_ != 0xffff; ++i) {
if (mnTagInfo_[i].name_ == tagName) {
tag = mnTagInfo_[i].tag_;
if (pMnTagInfo_) {
for (int i = 0; pMnTagInfo_[i].tag_ != 0xffff; ++i) {
if (pMnTagInfo_[i].name_ == tagName) {
tag = pMnTagInfo_[i].tag_;
break;
}
}
@@ -173,14 +173,14 @@ namespace Exif {
return ifd_.size() + ifd_.dataSize();
}
MakerNoteFactory* MakerNoteFactory::instance_ = 0;
MakerNoteFactory* MakerNoteFactory::pInstance_ = 0;
MakerNoteFactory& MakerNoteFactory::instance()
{
if (0 == instance_) {
instance_ = new MakerNoteFactory;
if (0 == pInstance_) {
pInstance_ = new MakerNoteFactory;
}
return *instance_;
return *pInstance_;
} // MakerNoteFactory::instance
void MakerNoteFactory::registerMakerNote(const std::string& make,
+7 -7
View File
@@ -22,7 +22,7 @@
@file makernote.hpp
@brief Contains the %Exif %MakerNote interface, IFD %MakerNote and a
MakerNote factory
@version $Name: $ $Revision: 1.11 $
@version $Name: $ $Revision: 1.12 $
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 18-Feb-04, ahu: created
@@ -112,8 +112,8 @@ namespace Exif {
allows to choose whether or not memory management is required
for the Entries.
*/
MakerNote(const MnTagInfo* mnTagInfo =0, bool alloc =true)
: mnTagInfo_(mnTagInfo), alloc_(alloc), byteOrder_(invalidByteOrder) {}
MakerNote(const MnTagInfo* pMnTagInfo =0, bool alloc =true)
: pMnTagInfo_(pMnTagInfo), alloc_(alloc), byteOrder_(invalidByteOrder) {}
//! Virtual destructor.
virtual ~MakerNote() {}
//@}
@@ -204,7 +204,7 @@ namespace Exif {
protected:
//! Pointer to an array of makernote tag infos
const MnTagInfo* mnTagInfo_;
const MnTagInfo* pMnTagInfo_;
/*!
Memory management
True: requires memory allocation and deallocation,
@@ -230,8 +230,8 @@ namespace Exif {
allows to choose whether or not memory management is required
for the Entries.
*/
IfdMakerNote(const MakerNote::MnTagInfo* mnTagInfo =0, bool alloc =true)
: MakerNote(mnTagInfo, alloc),
IfdMakerNote(const MakerNote::MnTagInfo* pMnTagInfo =0, bool alloc =true)
: MakerNote(pMnTagInfo, alloc),
absOffset_(true), ifd_(makerIfd, 0, alloc) {}
//! Virtual destructor
virtual ~IfdMakerNote() {}
@@ -385,7 +385,7 @@ namespace Exif {
// DATA
//! Pointer to the one and only instance of this class.
static MakerNoteFactory* instance_;
static MakerNoteFactory* pInstance_;
//! List of makernote types and corresponding makernote create functions.
Registry registry_;