Coverage Report

Created: 2023-12-08 06:53

/src/freeimage-svn/FreeImage/trunk/Source/OpenEXR/IlmImf/ImfKeyCode.cpp
Line
Count
Source (jump to first uncovered line)
1
///////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright (c) 2004, 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
//
38
//  class KeyCode
39
//
40
//-----------------------------------------------------------------------------
41
42
#include <ImfKeyCode.h>
43
#include "Iex.h"
44
#include "ImfNamespace.h"
45
46
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
47
48
   
49
KeyCode::KeyCode (int filmMfcCode,
50
      int filmType,
51
      int prefix,
52
      int count,
53
      int perfOffset,
54
      int perfsPerFrame,
55
      int perfsPerCount)
56
0
{
57
0
    setFilmMfcCode (filmMfcCode);
58
0
    setFilmType (filmType);
59
0
    setPrefix (prefix);
60
0
    setCount (count);
61
0
    setPerfOffset (perfOffset);
62
0
    setPerfsPerFrame (perfsPerFrame);
63
0
    setPerfsPerCount (perfsPerCount);
64
0
}
65
66
67
KeyCode::KeyCode (const KeyCode &other)
68
0
{
69
0
    _filmMfcCode = other._filmMfcCode;
70
0
    _filmType = other._filmType;
71
0
    _prefix = other._prefix;
72
0
    _count = other._count;
73
0
    _perfOffset = other._perfOffset;
74
0
    _perfsPerFrame = other._perfsPerFrame;
75
0
    _perfsPerCount = other._perfsPerCount;
76
0
}
77
78
79
KeyCode &
80
KeyCode::operator = (const KeyCode &other)
81
0
{
82
0
    _filmMfcCode = other._filmMfcCode;
83
0
    _filmType = other._filmType;
84
0
    _prefix = other._prefix;
85
0
    _count = other._count;
86
0
    _perfOffset = other._perfOffset;
87
0
    _perfsPerFrame = other._perfsPerFrame;
88
0
    _perfsPerCount = other._perfsPerCount;
89
90
0
    return *this;
91
0
}
92
93
94
int   
95
KeyCode::filmMfcCode () const
96
0
{
97
0
    return _filmMfcCode;
98
0
}
99
100
101
void  
102
KeyCode::setFilmMfcCode (int filmMfcCode)
103
0
{
104
0
    if (filmMfcCode < 0 || filmMfcCode > 99)
105
0
  throw IEX_NAMESPACE::ArgExc ("Invalid key code film manufacturer code "
106
0
         "(must be between 0 and 99).");
107
108
0
    _filmMfcCode = filmMfcCode;
109
0
}
110
111
int   
112
KeyCode::filmType () const
113
0
{
114
0
    return _filmType;
115
0
}
116
117
118
void  
119
KeyCode::setFilmType (int filmType)
120
0
{
121
0
    if (filmType < 0 || filmType > 99)
122
0
  throw IEX_NAMESPACE::ArgExc ("Invalid key code film type "
123
0
         "(must be between 0 and 99).");
124
125
0
    _filmType = filmType;
126
0
}
127
128
int   
129
KeyCode::prefix () const
130
0
{
131
0
    return _prefix;
132
0
}
133
134
135
void  
136
KeyCode::setPrefix (int prefix)
137
0
{
138
0
    if (prefix < 0 || prefix > 999999)
139
0
  throw IEX_NAMESPACE::ArgExc ("Invalid key code prefix "
140
0
         "(must be between 0 and 999999).");
141
142
0
    _prefix = prefix;
143
0
}
144
145
146
int   
147
KeyCode::count () const
148
0
{
149
0
    return _count;
150
0
}
151
152
153
void  
154
KeyCode::setCount (int count)
155
0
{
156
0
    if (count < 0 || count > 9999)
157
0
  throw IEX_NAMESPACE::ArgExc ("Invalid key code count "
158
0
         "(must be between 0 and 9999).");
159
160
0
    _count = count;
161
0
}
162
163
164
int   
165
KeyCode::perfOffset () const
166
0
{
167
0
    return _perfOffset;
168
0
}
169
170
171
void  
172
KeyCode::setPerfOffset (int perfOffset)
173
0
{
174
0
    if (perfOffset < 0 || perfOffset > 119)
175
0
  throw IEX_NAMESPACE::ArgExc ("Invalid key code perforation offset "
176
0
         "(must be between 0 and 119).");
177
178
0
    _perfOffset = perfOffset;
179
0
}
180
181
182
int 
183
KeyCode::perfsPerFrame () const
184
0
{
185
0
    return _perfsPerFrame;
186
0
}
187
188
189
void
190
KeyCode::setPerfsPerFrame (int perfsPerFrame)
191
0
{
192
0
    if (perfsPerFrame < 1 || perfsPerFrame > 15)
193
0
  throw IEX_NAMESPACE::ArgExc ("Invalid key code number of perforations per frame "
194
0
         "(must be between 1 and 15).");
195
196
0
    _perfsPerFrame = perfsPerFrame;
197
0
}
198
199
200
int 
201
KeyCode::perfsPerCount () const
202
0
{
203
0
    return _perfsPerCount;
204
0
}
205
206
207
void
208
KeyCode::setPerfsPerCount (int perfsPerCount)
209
0
{
210
0
    if (perfsPerCount < 20 || perfsPerCount > 120)
211
0
  throw IEX_NAMESPACE::ArgExc ("Invalid key code number of perforations per count "
212
0
         "(must be between 20 and 120).");
213
214
0
    _perfsPerCount = perfsPerCount;
215
0
}
216
217
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT