1
///////////////////////////////////////////////////////////////////////////
3
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
6
// All rights reserved.
8
// Redistribution and use in source and binary forms, with or without
9
// modification, are permitted provided that the following conditions are
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
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.
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.
33
///////////////////////////////////////////////////////////////////////////
36
//-----------------------------------------------------------------------------
40
//-----------------------------------------------------------------------------
42
#include <ImfKeyCode.h>
48
KeyCode::KeyCode (int filmMfcCode,
56
setFilmMfcCode (filmMfcCode);
57
setFilmType (filmType);
60
setPerfOffset (perfOffset);
61
setPerfsPerFrame (perfsPerFrame);
62
setPerfsPerCount (perfsPerCount);
66
KeyCode::KeyCode (const KeyCode &other)
68
_filmMfcCode = other._filmMfcCode;
69
_filmType = other._filmType;
70
_prefix = other._prefix;
71
_count = other._count;
72
_perfOffset = other._perfOffset;
73
_perfsPerFrame = other._perfsPerFrame;
74
_perfsPerCount = other._perfsPerCount;
79
KeyCode::operator = (const KeyCode &other)
81
_filmMfcCode = other._filmMfcCode;
82
_filmType = other._filmType;
83
_prefix = other._prefix;
84
_count = other._count;
85
_perfOffset = other._perfOffset;
86
_perfsPerFrame = other._perfsPerFrame;
87
_perfsPerCount = other._perfsPerCount;
94
KeyCode::filmMfcCode () const
101
KeyCode::setFilmMfcCode (int filmMfcCode)
103
if (filmMfcCode < 0 || filmMfcCode > 99)
104
throw Iex::ArgExc ("Invalid key code film manufacturer code "
105
"(must be between 0 and 99).");
107
_filmMfcCode = filmMfcCode;
111
KeyCode::filmType () const
118
KeyCode::setFilmType (int filmType)
120
if (filmType < 0 || filmType > 99)
121
throw Iex::ArgExc ("Invalid key code film type "
122
"(must be between 0 and 99).");
124
_filmType = filmType;
128
KeyCode::prefix () const
135
KeyCode::setPrefix (int prefix)
137
if (prefix < 0 || prefix > 999999)
138
throw Iex::ArgExc ("Invalid key code prefix "
139
"(must be between 0 and 999999).");
146
KeyCode::count () const
153
KeyCode::setCount (int count)
155
if (count < 0 || count > 9999)
156
throw Iex::ArgExc ("Invalid key code count "
157
"(must be between 0 and 9999).");
164
KeyCode::perfOffset () const
171
KeyCode::setPerfOffset (int perfOffset)
173
if (perfOffset < 0 || perfOffset > 119)
174
throw Iex::ArgExc ("Invalid key code perforation offset "
175
"(must be between 0 and 119).");
177
_perfOffset = perfOffset;
182
KeyCode::perfsPerFrame () const
184
return _perfsPerFrame;
189
KeyCode::setPerfsPerFrame (int perfsPerFrame)
191
if (perfsPerFrame < 1 || perfsPerFrame > 15)
192
throw Iex::ArgExc ("Invalid key code number of perforations per frame "
193
"(must be between 1 and 15).");
195
_perfsPerFrame = perfsPerFrame;
200
KeyCode::perfsPerCount () const
202
return _perfsPerCount;
207
KeyCode::setPerfsPerCount (int perfsPerCount)
209
if (perfsPerCount < 20 || perfsPerCount > 120)
210
throw Iex::ArgExc ("Invalid key code number of perforations per count "
211
"(must be between 20 and 120).");
213
_perfsPerCount = perfsPerCount;