Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Exception.h
Go to the documentation of this file.
1 
2 /*
3  Copyright (c) 2014, The Cinder Project
4 
5  This code is intended to be used with the Cinder C++ library, http://libcinder.org
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted provided that
8  the following conditions are met:
9 
10  * Redistributions of source code must retain the above copyright notice, this list of conditions and
11  the following disclaimer.
12  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
13  the following disclaimer in the documentation and/or other materials provided with the distribution.
14 
15  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
16  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
17  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
18  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22  POSSIBILITY OF SUCH DAMAGE.
23  */
24 
25 #pragma once
26 
27 #include "cinder/Exception.h"
28 
29 #include <string>
30 
31 namespace cinder { namespace audio {
32 
34 class AudioExc : public Exception {
35  public:
36  AudioExc( const std::string &description, int32_t errorCode = 0 ) : mDescription( description ) {}
37  virtual const char* what() const throw() { return mDescription.c_str(); }
39  int32_t getCode() const { return mErrorCode; }
40  protected:
42  int32_t mErrorCode;
43 };
44 
46 class AudioDeviceExc : public AudioExc {
47  public:
48  AudioDeviceExc( const std::string &description ) : AudioExc( description ) {}
49 };
50 
52 class AudioContextExc : public AudioExc {
53  public:
54  AudioContextExc( const std::string &description ) : AudioExc( description ) {}
55 };
56 
58 class AudioFormatExc : public AudioExc {
59  public:
60  AudioFormatExc( const std::string &description ) : AudioExc( description ) {}
61 };
62 
64 class AudioFileExc : public AudioExc {
65  public:
66  AudioFileExc( const std::string &description, int32_t errorCode = 0 ) : AudioExc( description ) {}
67 };
68 
69 } } // namespace cinder::audio
int32_t getCode() const
Returns a platform-specific error code received. May be 0 (meaning none was available).
Definition: Exception.h:39
GLsizei const GLchar ** string
Definition: GLee.h:2427
Audio exception originating from within the Context.
Definition: Exception.h:52
General Audio exception.
Definition: Exception.h:34
std::string mDescription
Definition: Exception.h:41
AudioContextExc(const std::string &description)
Definition: Exception.h:54
Audio exception related to file i/o.
Definition: Exception.h:64
AudioDeviceExc(const std::string &description)
Definition: Exception.h:48
AudioFormatExc(const std::string &description)
Definition: Exception.h:60
Audio exception related to Device management.
Definition: Exception.h:46
virtual const char * what() const
Definition: Exception.h:37
Audio exception that occurs when the format of a Node leads to an irrecoverable error.
Definition: Exception.h:58
AudioExc(const std::string &description, int32_t errorCode=0)
Definition: Exception.h:36
Definition: Exception.h:32
AudioFileExc(const std::string &description, int32_t errorCode=0)
Definition: Exception.h:66
int32_t mErrorCode
Definition: Exception.h:42