summaryrefslogtreecommitdiff
path: root/XMPFiles/source/FormatSupport/IFF/IChunkContainer.h
blob: 60190094444cf7cbba2c7a5f3145fc56e3315ba3 (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
// =================================================================================================
// Copyright Adobe
// Copyright 2020 Adobe
// 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 _IChunkContainer_h_
#define _IChunkContainer_h_

#include "public/include/XMP_Environment.h"	// ! This must be the first include.

namespace IFF_RIFF
{

/**
	The interface IChunkContainer defines the access to child chunks of 
	an existing chunk.
*/

class Chunk;

class IChunkContainer
{
public:
	virtual ~IChunkContainer() {};

		/**
		 * @return	Returns the number children chunks.
		 */
		virtual	XMP_Uns32 numChildren() const															= 0;
		
		/**
		 * Returns a child node.
		 *
		 * @param	pos		position of the child node to return
		 * @return			Returns the child node at the given position.
		 */
		virtual	Chunk* getChildAt( XMP_Uns32 pos ) const												= 0;

		/**
		 * Appends a child node at the end of the children list.
		 *
		 * @param	node		the new node
		 * @param	adjustSizes	adjust size&offset of chunk and parents
		 * @return				Returns the added node.
		 */
		virtual	void appendChild( Chunk* node, XMP_Bool adjustSizes = true )							= 0;

		/**
		 * Inserts a child node at a certain position.
		 *
		 * @param	pos			position in the children list to add the new node
		 * @param	node		the new node
		 * @return				Returns the added node.
		 */
		virtual	void insertChildAt( XMP_Uns32 pos, Chunk* node )			= 0;

		/**
		 * Removes a child node at a given position.
		 *
		 * @param	pos				position of the node to delete in the children list
		 *
		 * @return					The removed chunk
		 */
		virtual	Chunk* removeChildAt( XMP_Uns32 pos )						= 0;

		/**
		 * Remove child at the passed position and insert the new chunk
		 *
		 * @param pos			Position of chunk that will be replaced
		 * @param chunk			New chunk
		 *
		 * @return				Replaced chunk
		 */
		virtual Chunk* replaceChildAt( XMP_Uns32 pos, Chunk* node )						= 0;

		/** creates a string representation of the chunk and its children. 
		*/
		virtual std::string toString( std::string tab = std::string() , XMP_Bool showOriginal = false ) = 0;
};

}

#endif