1
1
// ***************************************************************** -*- C++ -*-
3
* Copyright (C) 2004-2009 Andreas Huggel <ahuggel@gmx.net>
3
* Copyright (C) 2004-2010 Andreas Huggel <ahuggel@gmx.net>
5
5
* This program is part of the Exiv2 distribution.
23
23
@brief Value interface and concrete subclasses
25
25
@author Andreas Huggel (ahu)
26
26
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
27
27
@date 09-Jan-04, ahu: created
529
529
const char* code_; //!< Code of the charset
530
530
}; // struct CharsetTable
531
531
//! Charset information lookup functions. Implemented as a static class.
532
class EXIV2API CharsetInfo {
533
533
//! Prevent construction: not implemented.
535
535
//! Prevent copy-construction: not implemented.
580
579
1 if an invalid character set is encountered
582
581
int read(const std::string& comment);
583
@brief Read the comment from a byte buffer.
585
int read(const byte* buf, long len, ByteOrder byteOrder);
585
588
//! @name Accessors
587
590
AutoPtr clone() const { return AutoPtr(clone_()); }
591
long copy(byte* buf, ByteOrder byteOrder) const;
589
593
@brief Write the comment in a format which can be read by
590
594
read(const std::string& comment).
592
596
std::ostream& write(std::ostream& os) const;
593
//! Return the comment (without a charset="..." prefix)
594
std::string comment() const;
595
//! Return the charset id of the comment
598
@brief Return the comment (without a charset="..." prefix)
600
The comment is decoded to UTF-8. For Exif UNICODE comments, the
601
function makes an attempt to correctly determine the character
602
encoding of the value. Alternatively, the optional \em encoding
603
parameter can be used to specify it.
605
@param encoding Optional argument to specify the character encoding
606
that the comment is encoded in, as an iconv(3) name. Only used
607
for Exif UNICODE comments.
609
@return A string containing the comment converted to UTF-8.
611
std::string comment(const char* encoding =0) const;
613
@brief Determine the character encoding that was used to encode the
614
UNICODE comment value as an iconv(3) name.
616
If the comment \em c starts with a BOM, the BOM is interpreted and
617
removed from the string.
619
Todo: Implement rules to guess if the comment is UTF-8 encoded.
621
const char* detectCharset(std::string& c) const;
622
//! Return the Exif charset id of the comment
596
623
CharsetId charsetId() const;