Coverage Report

Created: 2025-06-12 06:52

/src/opencv/3rdparty/openexr/IlmImf/ImfName.h
Line
Count
Source (jump to first uncovered line)
1
///////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
4
// Digital Ltd. LLC
5
// 
6
// All rights reserved.
7
// 
8
// Redistribution and use in source and binary forms, with or without
9
// modification, are permitted provided that the following conditions are
10
// met:
11
// *       Redistributions of source code must retain the above copyright
12
// notice, this list of conditions and the following disclaimer.
13
// *       Redistributions in binary form must reproduce the above
14
// copyright notice, this list of conditions and the following disclaimer
15
// in the documentation and/or other materials provided with the
16
// distribution.
17
// *       Neither the name of Industrial Light & Magic nor the names of
18
// its contributors may be used to endorse or promote products derived
19
// from this software without specific prior written permission. 
20
// 
21
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
//
33
///////////////////////////////////////////////////////////////////////////
34
35
36
37
#ifndef INCLUDED_IMF_NAME_H
38
#define INCLUDED_IMF_NAME_H
39
40
//-----------------------------------------------------------------------------
41
//
42
//  class ImfName -- a zero-terminated string
43
//  with a fixed, small maximum length
44
//
45
//-----------------------------------------------------------------------------
46
47
#include <string.h>
48
#include "ImfNamespace.h"
49
#include "ImfExport.h"
50
51
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
52
53
54
class Name
55
{
56
  public:
57
58
    //-------------
59
    // Constructors
60
    //-------------
61
62
    IMF_EXPORT
63
    Name ();
64
    IMF_EXPORT
65
    Name (const char text[]);
66
67
68
    //--------------------
69
    // Assignment operator
70
    //--------------------
71
72
    IMF_EXPORT
73
    Name &    operator = (const char text[]);
74
75
76
    //---------------------
77
    // Access to the string
78
    //---------------------
79
80
    IMF_EXPORT
81
0
    const char *  text () const   {return _text;}
82
    IMF_EXPORT
83
0
    const char *  operator * () const {return _text;}
84
85
    //---------------
86
    // Maximum length
87
    //---------------
88
89
    static const int  SIZE = 256;
90
    static const int  MAX_LENGTH = SIZE - 1;
91
92
  private:
93
94
    char    _text[SIZE];
95
};
96
97
98
IMF_EXPORT
99
bool operator == (const Name &x, const Name &y);
100
IMF_EXPORT
101
bool operator != (const Name &x, const Name &y);
102
IMF_EXPORT
103
bool operator < (const Name &x, const Name &y);
104
105
106
//-----------------
107
// Inline functions
108
//-----------------
109
110
inline Name &
111
Name::operator = (const char text[])
112
0
{
113
0
    strncpy (_text, text, MAX_LENGTH);
114
0
    return *this;
115
0
}
116
117
118
inline
119
Name::Name ()
120
{
121
    _text[0] = 0;
122
}
123
124
125
inline
126
Name::Name (const char text[])
127
0
{
128
0
    *this = text;
129
0
    _text [MAX_LENGTH] = 0;
130
0
}
131
132
133
inline bool
134
operator == (const Name &x, const Name &y)
135
0
{
136
0
    return strcmp (*x, *y) == 0;
137
0
}
138
139
140
inline bool
141
operator != (const Name &x, const Name &y)
142
0
{
143
0
    return !(x == y);
144
0
}
145
146
147
inline bool
148
operator < (const Name &x, const Name &y)
149
0
{
150
0
    return strcmp (*x, *y) < 0;
151
0
}
152
153
154
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
155
156
157
158
159
#endif