PageRenderTime 16ms CodeModel.GetById 2ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/src/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCode.cpp

https://bitbucket.org/cabalistic/ogredeps/
C++ | 216 lines | 133 code | 45 blank | 38 comment | 14 complexity | 1ec42d6478424eba52feb8105b007aa8 MD5 | raw file
  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
 45namespace Imf {
 46
 47   
 48KeyCode::KeyCode (int filmMfcCode,
 49		  int filmType,
 50		  int prefix,
 51		  int count,
 52		  int perfOffset,
 53		  int perfsPerFrame,
 54		  int perfsPerCount)
 55{
 56    setFilmMfcCode (filmMfcCode);
 57    setFilmType (filmType);
 58    setPrefix (prefix);
 59    setCount (count);
 60    setPerfOffset (perfOffset);
 61    setPerfsPerFrame (perfsPerFrame);
 62    setPerfsPerCount (perfsPerCount);
 63}
 64
 65
 66KeyCode::KeyCode (const KeyCode &other)
 67{
 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;
 75}
 76
 77
 78KeyCode &
 79KeyCode::operator = (const KeyCode &other)
 80{
 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;
 88
 89    return *this;
 90}
 91
 92
 93int		
 94KeyCode::filmMfcCode () const
 95{
 96    return _filmMfcCode;
 97}
 98
 99
100void	
101KeyCode::setFilmMfcCode (int filmMfcCode)
102{
103    if (filmMfcCode < 0 || filmMfcCode > 99)
104	throw Iex::ArgExc ("Invalid key code film manufacturer code "
105			   "(must be between 0 and 99).");
106
107    _filmMfcCode = filmMfcCode;
108}
109
110int		
111KeyCode::filmType () const
112{
113    return _filmType;
114}
115
116
117void	
118KeyCode::setFilmType (int filmType)
119{
120    if (filmType < 0 || filmType > 99)
121	throw Iex::ArgExc ("Invalid key code film type "
122			   "(must be between 0 and 99).");
123
124    _filmType = filmType;
125}
126
127int		
128KeyCode::prefix () const
129{
130    return _prefix;
131}
132
133
134void	
135KeyCode::setPrefix (int prefix)
136{
137    if (prefix < 0 || prefix > 999999)
138	throw Iex::ArgExc ("Invalid key code prefix "
139			   "(must be between 0 and 999999).");
140
141    _prefix = prefix;
142}
143
144
145int		
146KeyCode::count () const
147{
148    return _count;
149}
150
151
152void	
153KeyCode::setCount (int count)
154{
155    if (count < 0 || count > 9999)
156	throw Iex::ArgExc ("Invalid key code count "
157			   "(must be between 0 and 9999).");
158
159    _count = count;
160}
161
162
163int		
164KeyCode::perfOffset () const
165{
166    return _perfOffset;
167}
168
169
170void	
171KeyCode::setPerfOffset (int perfOffset)
172{
173    if (perfOffset < 0 || perfOffset > 119)
174	throw Iex::ArgExc ("Invalid key code perforation offset "
175			   "(must be between 0 and 119).");
176
177    _perfOffset = perfOffset;
178}
179
180
181int	
182KeyCode::perfsPerFrame () const
183{
184    return _perfsPerFrame;
185}
186
187
188void
189KeyCode::setPerfsPerFrame (int perfsPerFrame)
190{
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).");
194
195    _perfsPerFrame = perfsPerFrame;
196}
197
198
199int	
200KeyCode::perfsPerCount () const
201{
202    return _perfsPerCount;
203}
204
205
206void
207KeyCode::setPerfsPerCount (int perfsPerCount)
208{
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).");
212
213    _perfsPerCount = perfsPerCount;
214}
215
216} // namespace Imf