Tawara  0.1.0
exceptions.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, 2012, Geoffrey Biggs, geoffrey.biggs@aist.go.jp
5  * RT-Synthesis Research Group
6  * Intelligent Systems Research Institute,
7  * National Institute of Advanced Industrial Science and Technology (AIST),
8  * Japan
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  *
15  * * Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  * * Redistributions in binary form must reproduce the above
18  * copyright notice, this list of conditions and the following
19  * disclaimer in the documentation and/or other materials provided
20  * with the distribution.
21  * * Neither the name of Geoffrey Biggs nor AIST, nor the names of its
22  * contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #if !defined(TAWARA_EXCEPTIONS_H_)
40 #define TAWARA_EXCEPTIONS_H_
41 
42 #include <tawara/el_ids.h>
43 #include <tawara/win_dll.h>
44 
45 #include <boost/exception/all.hpp>
46 #include <exception>
47 #include <stdint.h>
48 #include <vector>
49 
52 
53 namespace tawara
54 {
56  struct TawaraError : virtual std::exception, virtual boost::exception {};
57 
59 // Error types
61 
63  struct NotImplemented : virtual TawaraError {};
64 
70  struct NotEBML : virtual TawaraError {};
71 
78  struct NotTawara : virtual TawaraError {};
79 
87  struct BadReadVersion : virtual TawaraError {};
88 
96  struct BadDocReadVersion : virtual TawaraError {};
97 
110  struct InvalidEBMLID : virtual TawaraError {};
111 
121  struct InvalidVarInt : virtual TawaraError {};
122 
135  struct VarIntTooBig : virtual TawaraError {};
136 
153  struct SpecSizeTooSmall : virtual TawaraError {};
154 
165  struct BufferTooSmall : virtual TawaraError {};
166 
181  struct ReadError : virtual TawaraError {};
182 
194  struct WriteError : virtual TawaraError {};
195 
203  struct InvalidElementID : virtual TawaraError {};
204 
224  struct BadElementLength : virtual TawaraError {};
225 
234  struct BadBodySize : virtual TawaraError {};
235 
249  struct InvalidChildID : virtual TawaraError {};
250 
264  struct MissingChild : virtual TawaraError{};
265 
281  struct ValueOutOfRange : virtual TawaraError{};
282 
295  struct ValueSizeOutOfRange : virtual TawaraError{};
296 
306  struct EmptyTracksElement : virtual TawaraError{};
307 
320  struct DuplicateTrackNumber : virtual TawaraError{};
321 
333  struct DuplicateUID : virtual TawaraError{};
334 
340  struct EmptyBlock : virtual TawaraError{};
341 
350  struct EmptyFrame : virtual TawaraError{};
351 
366  struct MaxLaceSizeExceeded : virtual TawaraError{};
367 
381  struct BadLacedFrameSize : virtual TawaraError{};
382 
393 
402  struct MultipleSeekHeads : virtual TawaraError{};
403 
412  struct NoSegmentInfo : virtual TawaraError{};
413 
422  struct NoTracks : virtual TawaraError{};
423 
432  struct NoClusters : virtual TawaraError{};
433 
440  struct NotWriting : virtual TawaraError{};
441 
449  struct VoidTooSmall : virtual TawaraError{};
450 
459  struct NoAttachments : virtual TawaraError{};
460 
469  struct NoAttachedData : virtual TawaraError{};
470 
480  struct DuplicateTimecode : virtual TawaraError{};
481 
491  struct EmptyCuesElement : virtual TawaraError{};
492 
503  struct EmptyCuePointElement : virtual TawaraError{};
504 
505 
507 // Error information tags
509 
511  typedef boost::error_info<struct tag_ver, std::streamsize> err_ver;
512 
514  typedef boost::error_info<struct tag_pos, std::streamsize> err_pos;
515 
517  typedef boost::error_info<struct tag_varint, uint64_t> err_varint;
518 
520  typedef boost::error_info<struct tag_bufsize, std::streamsize> err_bufsize;
521 
523  typedef boost::error_info<struct tag_reqsize, std::streamsize> err_reqsize;
524 
526  typedef boost::error_info<struct tag_specsize, std::streamsize>
528 
530  typedef boost::error_info<struct tag_id, ids::ID> err_id;
531 
533  typedef boost::error_info<struct tag_par_id, uint32_t> err_par_id;
534 
536  typedef boost::error_info<struct tag_valid_sizes,
537  std::vector<std::streamsize> > err_valid_sizes;
538 
540  typedef boost::error_info<struct tag_el_size, std::streamsize> err_el_size;
541 
543  typedef boost::error_info<struct tag_track_num, uint64_t> err_track_num;
544 
546  typedef boost::error_info<struct tag_int_uid, uint64_t> err_int_uid;
547 
549  typedef boost::error_info<struct tag_max_lace, unsigned int> err_max_lace;
550 
552  typedef boost::error_info<struct tag_req_lace, unsigned int> err_req_lace;
553 
555  typedef boost::error_info<struct tag_frame_size, std::streamsize>
557 }; // namespace tawara
558 
560 // group exceptions
561 
562 #endif // TAWARA_EXCEPTIONS_H_
563 
A write error was encountered during a write.
Definition: exceptions.h:194
An empty frame was encountered.
Definition: exceptions.h:350
A duplicate timecode was encountered in the cues.
Definition: exceptions.h:480
A child element's value was set outside the allowable range.
Definition: exceptions.h:281
boost::error_info< struct tag_el_size, std::streamsize > err_el_size
The size of an element.
Definition: exceptions.h:540
A fixed-length element is truncated or lengthened in the file.
Definition: exceptions.h:224
An empty Cues element was read or written.
Definition: exceptions.h:491
The requested size of a void element is too small.
Definition: exceptions.h:449
The required Tawara read version is too high.
Definition: exceptions.h:96
File is not an EBML file.
Definition: exceptions.h:70
An empty BlockAdditions element was read or written.
Definition: exceptions.h:392
A buffer was too small for the data.
Definition: exceptions.h:165
An invalid Element ID was provided.
Definition: exceptions.h:203
A segment was found without at least one cluster.
Definition: exceptions.h:432
boost::error_info< struct tag_reqsize, std::streamsize > err_reqsize
The required size of a buffer or a file read.
Definition: exceptions.h:523
An attachments element with no attachments was read or written.
Definition: exceptions.h:459
boost::error_info< struct tag_bufsize, std::streamsize > err_bufsize
The size of a buffer.
Definition: exceptions.h:520
boost::error_info< struct tag_max_lace, unsigned int > err_max_lace
The maximum size of a lace.
Definition: exceptions.h:549
A child element was found where it doesn't belong.
Definition: exceptions.h:249
boost::error_info< struct tag_track_num, uint64_t > err_track_num
A track number.
Definition: exceptions.h:543
An empty CuePoint element was read or written.
Definition: exceptions.h:503
A frame with a bad size was added to a block.
Definition: exceptions.h:381
boost::error_info< struct tag_ver, std::streamsize > err_ver
A version.
Definition: exceptions.h:511
An invalid EBML class ID was found.
Definition: exceptions.h:110
A child element's size is below or above the required size.
Definition: exceptions.h:295
Something is not supported.
Definition: exceptions.h:63
boost::error_info< struct tag_valid_sizes, std::vector< std::streamsize > > err_valid_sizes
A set of valid element sizes.
Definition: exceptions.h:537
boost::error_info< struct tag_par_id, uint32_t > err_par_id
A parent element ID.
Definition: exceptions.h:533
boost::error_info< struct tag_frame_size, std::streamsize > err_frame_size
The size of a frame.
Definition: exceptions.h:556
boost::error_info< struct tag_specsize, std::streamsize > err_specsize
The specified size to encode a variable-length integer into.
Definition: exceptions.h:527
boost::error_info< struct tag_varint, uint64_t > err_varint
Value of a variable-length integer.
Definition: exceptions.h:517
A read error was encountered during a read.
Definition: exceptions.h:181
An empty Tracks element was read or written.
Definition: exceptions.h:306
A UID collision was encountered.
Definition: exceptions.h:333
An invalid variable-length integer was found.
Definition: exceptions.h:121
A segment was found without a segment info element.
Definition: exceptions.h:412
A segment was found with multiple meta-seeks.
Definition: exceptions.h:402
boost::error_info< struct tag_id, ids::ID > err_id
An Element ID.
Definition: exceptions.h:530
A necessary child element was missing.
Definition: exceptions.h:264
boost::error_info< struct tag_int_uid, uint64_t > err_int_uid
An integer UID.
Definition: exceptions.h:546
boost::error_info< struct tag_pos, std::streamsize > err_pos
Position in a Tawara file.
Definition: exceptions.h:514
A segment was found without a tracks information element.
Definition: exceptions.h:422
File is not a Tawara file.
Definition: exceptions.h:78
Base error type.
Definition: exceptions.h:56
The maximum lace size for a block was exceeded.
Definition: exceptions.h:366
A duplicate track number was encountered.
Definition: exceptions.h:320
A variable-length integer is too large to be encoded.
Definition: exceptions.h:135
boost::error_info< struct tag_req_lace, unsigned int > err_req_lace
The requested size of a lace.
Definition: exceptions.h:552
An attached file with no data was read or written.
Definition: exceptions.h:469
The required EBML read version is too high.
Definition: exceptions.h:87
An empty block was encountered.
Definition: exceptions.h:340
A read body size does not match the actual body size in the file.
Definition: exceptions.h:234
A specified size for a variable-length integer is too small.
Definition: exceptions.h:153
A segment or cluster was finalised before being started.
Definition: exceptions.h:440