Coverage Report

Created: 2025-07-16 07:53

/src/openexr/src/lib/OpenEXR/ImfOpaqueAttribute.h
Line
Count
Source (jump to first uncovered line)
1
//
2
// SPDX-License-Identifier: BSD-3-Clause
3
// Copyright (c) Contributors to the OpenEXR Project.
4
//
5
6
#ifndef INCLUDED_IMF_OPAQUE_ATTRIBUTE_H
7
#define INCLUDED_IMF_OPAQUE_ATTRIBUTE_H
8
9
//-----------------------------------------------------------------------------
10
//
11
//  class OpaqueAttribute
12
//
13
//  When an image file is read, OpqaqueAttribute objects are used
14
//  to hold the values of attributes whose types are not recognized
15
//  by the reading program.  OpaqueAttribute objects can be read
16
//  from an image file, copied, and written back to to another image
17
//  file, but their values are inaccessible.
18
//
19
//-----------------------------------------------------------------------------
20
21
#include "ImfExport.h"
22
#include "ImfNamespace.h"
23
24
#include "ImfArray.h"
25
#include "ImfAttribute.h"
26
27
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
28
29
class IMF_EXPORT_TYPE OpaqueAttribute : public Attribute
30
{
31
public:
32
    //----------------------------
33
    // Constructors and destructor
34
    //----------------------------
35
36
    IMF_EXPORT OpaqueAttribute (const char typeName[]);
37
    IMF_EXPORT OpaqueAttribute (const char  typeName[],
38
                                long        dataSize,
39
                                const void* data);
40
    IMF_EXPORT OpaqueAttribute (const OpaqueAttribute& other);
41
    IMF_EXPORT virtual ~OpaqueAttribute ();
42
43
    //-------------------------------
44
    // Get this attribute's type name
45
    //-------------------------------
46
47
    IMF_EXPORT virtual const char* typeName () const;
48
49
    //------------------------------
50
    // Make a copy of this attribute
51
    //------------------------------
52
53
    IMF_EXPORT virtual Attribute* copy () const;
54
55
    //----------------
56
    // I/O and copying
57
    //----------------
58
59
    IMF_EXPORT virtual void writeValueTo (
60
        OPENEXR_IMF_INTERNAL_NAMESPACE::OStream& os, int version) const;
61
62
    IMF_EXPORT virtual void readValueFrom (
63
        OPENEXR_IMF_INTERNAL_NAMESPACE::IStream& is, int size, int version);
64
65
    IMF_EXPORT virtual void copyValueFrom (const Attribute& other);
66
67
0
    int                dataSize () const { return _dataSize; }
68
0
    const Array<char>& data () const { return _data; }
69
70
private:
71
    std::string _typeName;
72
    long        _dataSize;
73
    Array<char> _data;
74
};
75
76
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
77
78
#endif