|
|
@ -21,7 +21,7 @@
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
@file value.hpp
|
|
|
|
@file value.hpp
|
|
|
|
@brief Value interface and concrete subclasses
|
|
|
|
@brief Value interface and concrete subclasses
|
|
|
|
@version $Name: $ $Revision: 1.6 $
|
|
|
|
@version $Name: $ $Revision: 1.7 $
|
|
|
|
@author Andreas Huggel (ahu)
|
|
|
|
@author Andreas Huggel (ahu)
|
|
|
|
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
|
|
|
|
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
|
|
|
|
@date 09-Jan-04, ahu: created
|
|
|
|
@date 09-Jan-04, ahu: created
|
|
|
@ -48,12 +48,13 @@ namespace Exif {
|
|
|
|
// class definitions
|
|
|
|
// class definitions
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
@brief Common interface for all values. The interface provides a uniform
|
|
|
|
@brief Common interface for all types of values used with metadata.
|
|
|
|
way to access values independent from their actual C++ type for
|
|
|
|
|
|
|
|
simple tasks like reading the values from a string or data buffer.
|
|
|
|
The interface provides a uniform way to access values independent from
|
|
|
|
For other tasks, like modifying values you may need to downcast it
|
|
|
|
their actual C++ type for simple tasks like reading the values from a
|
|
|
|
to the actual subclass of %Value so that you can access the
|
|
|
|
string or data buffer. For other tasks, like modifying values you may
|
|
|
|
subclass specific interface.
|
|
|
|
need to downcast it to the actual subclass of %Value so that you can
|
|
|
|
|
|
|
|
access the subclass specific interface.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
class Value {
|
|
|
|
class Value {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
@ -154,7 +155,7 @@ namespace Exif {
|
|
|
|
The following Value subclasses are created depending on typeId:<BR><BR>
|
|
|
|
The following Value subclasses are created depending on typeId:<BR><BR>
|
|
|
|
<TABLE>
|
|
|
|
<TABLE>
|
|
|
|
<TR><TD><B>typeId</B></TD><TD><B>%Value subclass</B></TD></TR>
|
|
|
|
<TR><TD><B>typeId</B></TD><TD><B>%Value subclass</B></TD></TR>
|
|
|
|
<TR><TD>invalid</TD><TD>%DataValue(invalid)</TD></TR>
|
|
|
|
<TR><TD>invalidTypeId</TD><TD>%DataValue(invalidTypeId)</TD></TR>
|
|
|
|
<TR><TD>unsignedByte</TD><TD>%DataValue(unsignedByte)</TD></TR>
|
|
|
|
<TR><TD>unsignedByte</TD><TD>%DataValue(unsignedByte)</TD></TR>
|
|
|
|
<TR><TD>asciiString</TD><TD>%AsciiValue</TD></TR>
|
|
|
|
<TR><TD>asciiString</TD><TD>%AsciiValue</TD></TR>
|
|
|
|
<TR><TD>unsignedShort</TD><TD>%ValueType < uint16 ></TD></TR>
|
|
|
|
<TR><TD>unsignedShort</TD><TD>%ValueType < uint16 ></TD></TR>
|
|
|
@ -208,14 +209,18 @@ namespace Exif {
|
|
|
|
//! Assignment operator.
|
|
|
|
//! Assignment operator.
|
|
|
|
DataValue& operator=(const DataValue& rhs);
|
|
|
|
DataValue& operator=(const DataValue& rhs);
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
@brief Read the value from a character buffer. The byte order is
|
|
|
|
@brief Read the value from a character buffer.
|
|
|
|
required by the interface but not used by this method.
|
|
|
|
|
|
|
|
|
|
|
|
@note The byte order is required by the interface but not
|
|
|
|
|
|
|
|
used by this method, so just use the default.
|
|
|
|
|
|
|
|
|
|
|
|
@param buf Pointer to the data buffer to read from
|
|
|
|
@param buf Pointer to the data buffer to read from
|
|
|
|
@param len Number of bytes in the data buffer
|
|
|
|
@param len Number of bytes in the data buffer
|
|
|
|
@param byteOrder Byte order. Not used.
|
|
|
|
@param byteOrder Byte order. Not needed.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
virtual void read(const char* buf, long len, ByteOrder byteOrder);
|
|
|
|
virtual void read(const char* buf,
|
|
|
|
|
|
|
|
long len,
|
|
|
|
|
|
|
|
ByteOrder byteOrder =invalidByteOrder);
|
|
|
|
//! Set the data from a string of integer values (e.g., "0 1 2 3")
|
|
|
|
//! Set the data from a string of integer values (e.g., "0 1 2 3")
|
|
|
|
virtual void read(const std::string& buf);
|
|
|
|
virtual void read(const std::string& buf);
|
|
|
|
//@}
|
|
|
|
//@}
|
|
|
@ -223,17 +228,19 @@ namespace Exif {
|
|
|
|
//! @name Accessors
|
|
|
|
//! @name Accessors
|
|
|
|
//@{
|
|
|
|
//@{
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
@brief Write value to a character data buffer. The byte order is
|
|
|
|
@brief Write value to a character data buffer.
|
|
|
|
required by the interface but not used by this method.
|
|
|
|
|
|
|
|
|
|
|
|
@note The byte order is required by the interface but not used by this
|
|
|
|
|
|
|
|
method, so just use the default.
|
|
|
|
|
|
|
|
|
|
|
|
The user must ensure that the buffer has enough memory. Otherwise
|
|
|
|
The user must ensure that the buffer has enough memory. Otherwise
|
|
|
|
the call results in undefined behaviour.
|
|
|
|
the call results in undefined behaviour.
|
|
|
|
|
|
|
|
|
|
|
|
@param buf Data buffer to write to.
|
|
|
|
@param buf Data buffer to write to.
|
|
|
|
@param byteOrder Byte order. Not used.
|
|
|
|
@param byteOrder Byte order. Not needed.
|
|
|
|
@return Number of characters written.
|
|
|
|
@return Number of characters written.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
virtual long copy(char* buf, ByteOrder byteOrder) const;
|
|
|
|
virtual long copy(char* buf, ByteOrder byteOrder =invalidByteOrder) const;
|
|
|
|
virtual long count() const { return size(); }
|
|
|
|
virtual long count() const { return size(); }
|
|
|
|
virtual long size() const;
|
|
|
|
virtual long size() const;
|
|
|
|
virtual Value* clone() const;
|
|
|
|
virtual Value* clone() const;
|
|
|
@ -265,14 +272,18 @@ namespace Exif {
|
|
|
|
//! Assignment operator.
|
|
|
|
//! Assignment operator.
|
|
|
|
AsciiValue& operator=(const AsciiValue& rhs);
|
|
|
|
AsciiValue& operator=(const AsciiValue& rhs);
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
@brief Read the value from a character buffer. The byte order is
|
|
|
|
@brief Read the value from a character buffer.
|
|
|
|
required by the interface but not used by this method.
|
|
|
|
|
|
|
|
|
|
|
|
@note The byte order is required by the interface but not used by this
|
|
|
|
|
|
|
|
method, so just use the default.
|
|
|
|
|
|
|
|
|
|
|
|
@param buf Pointer to the data buffer to read from
|
|
|
|
@param buf Pointer to the data buffer to read from
|
|
|
|
@param len Number of bytes in the data buffer
|
|
|
|
@param len Number of bytes in the data buffer
|
|
|
|
@param byteOrder Byte order. Not used.
|
|
|
|
@param byteOrder Byte order. Not needed.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
virtual void read(const char* buf, long len, ByteOrder byteOrder);
|
|
|
|
virtual void read(const char* buf,
|
|
|
|
|
|
|
|
long len,
|
|
|
|
|
|
|
|
ByteOrder byteOrder =invalidByteOrder);
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
@brief Set the value to that of the string buf. A terminating
|
|
|
|
@brief Set the value to that of the string buf. A terminating
|
|
|
|
'\\0' character is appended to the value if buf doesn't
|
|
|
|
'\\0' character is appended to the value if buf doesn't
|
|
|
@ -284,17 +295,19 @@ namespace Exif {
|
|
|
|
//! @name Accessors
|
|
|
|
//! @name Accessors
|
|
|
|
//@{
|
|
|
|
//@{
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
@brief Write value to a character data buffer. The byte order is
|
|
|
|
@brief Write value to a character data buffer.
|
|
|
|
required by the interface but not used by this method.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The user must ensure that the buffer has enough memory. Otherwise
|
|
|
|
The user must ensure that the buffer has enough memory. Otherwise
|
|
|
|
the call results in undefined behaviour.
|
|
|
|
the call results in undefined behaviour.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@note The byte order is required by the interface but not used by this
|
|
|
|
|
|
|
|
method, so just use the default.
|
|
|
|
|
|
|
|
|
|
|
|
@param buf Data buffer to write to.
|
|
|
|
@param buf Data buffer to write to.
|
|
|
|
@param byteOrder Byte order. Not used.
|
|
|
|
@param byteOrder Byte order. Not used.
|
|
|
|
@return Number of characters written.
|
|
|
|
@return Number of characters written.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
virtual long copy(char* buf, ByteOrder byteOrder) const;
|
|
|
|
virtual long copy(char* buf, ByteOrder byteOrder =invalidByteOrder) const;
|
|
|
|
virtual long count() const { return size(); }
|
|
|
|
virtual long count() const { return size(); }
|
|
|
|
virtual long size() const;
|
|
|
|
virtual long size() const;
|
|
|
|
virtual Value* clone() const;
|
|
|
|
virtual Value* clone() const;
|
|
|
|