summaryrefslogtreecommitdiff
path: root/XMPFiles/source/FormatSupport/WAVE/DISPMetadata.h
blob: 7db189122c0d1fc89ba72b365d40cd97795d2572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// =================================================================================================
// ADOBE SYSTEMS INCORPORATED
// Copyright 2010 Adobe Systems Incorporated
// All Rights Reserved
//
// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
// of the Adobe license agreement accompanying it.
// =================================================================================================

#ifndef _DISPMetadata_h_
#define _DISPMetadata_h_

#include "public/include/XMP_Environment.h"	// ! XMP_Environment.h must be the first included header.
#include "public/include/XMP_Const.h"
#include "public/include/XMP_IO.hpp"

#include "XMPFiles/source/NativeMetadataSupport/IMetadata.h"

namespace IFF_RIFF
{

/**
 *	DISP Metadata model.
 *	Implements the IMetadata interface
 */
class DISPMetadata : public IMetadata
{
public:
	enum
	{
		kTitle			// std::string
	};

public:
	/**
	 * Return true if the type is 0x0001 and it's large enough for 
	 * more content
	 *
	 * @param chunkData		Data area of chunk
	 * @param size			Size of data area
	 *
	 * @return				True if it's a valid DISP chunk
	 */
	static bool		isValidDISP( const XMP_Uns8* chunkData, XMP_Uns64 size );

public:
	/**
	 *ctor/dtor
	 */
						DISPMetadata();
	virtual			   ~DISPMetadata();

	/**
	 * Parses the given memory block and creates a data model representation
	 * The implementation expects that the memory block is the data area of
	 * the DISP chunk.
	 * Throws exceptions if parsing is not possible
	 *
	 * @param input		The byte buffer to parse
	 * @param size		Size of the given byte buffer
	 */
	void		parse( const XMP_Uns8* chunkData, XMP_Uns64 size );

	/**
	 * See IMetadata::parse( const LFA_FileRef input )
	 */
	void		parse( XMP_IO* input ) { IMetadata::parse( input ); }
	
	/**
	 * Serializes the data model to a memory block. 
	 * The method creates a buffer and pass it to the parameter 'buffer'. The callee of
	 * the method is responsible to delete the buffer later on.
	 * The memory block will be the data area of a DISP chunk.
	 * Throws exceptions if serializing is not possible
	 *
	 * @param buffer	Buffer that gets filled with serialized data
	 * @param size		Size of passed in buffer
	 *
	 * @ return			Buffer size
	 */
	virtual XMP_Uns64 serialize( XMP_Uns8** buffer );

protected:
	/**
	 * @see IMetadata::isEmptyValue
	 */
	virtual	bool isEmptyValue( XMP_Uns32 id, ValueObject& valueObj );

private:
	// Operators hidden on purpose
	DISPMetadata( const DISPMetadata& ) {};
	DISPMetadata& operator=( const DISPMetadata& ) { return *this; };
};

}

#endif