tbx  0.7.6
tbxexcept.h
1 /*
2  * tbx RISC OS toolbox library
3  *
4  * Copyright (C) 2010-2021 Alan Buckley All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 
25 #ifndef TBXEXCEPT_H_
26 #define TBXEXCEPT_H_
27 
28 #include <stdexcept>
29 
30 namespace tbx
31 {
36 class ObjectClassError : public std::invalid_argument
37 {
38 public:
39  ObjectClassError() : std::invalid_argument("C++ object/toolbox object class mismatch") {}
40 };
41 
46 class GadgetClassError : public std::invalid_argument
47 {
48 public:
49  GadgetClassError() : std::invalid_argument("C++ gadget/toolbox gadget class mismatch") {}
50 };
51 
56 class ObjectNullError : public std::invalid_argument
57 {
58 public:
59  ObjectNullError() : std::invalid_argument("NULL toolbox object handle") {};
60 };
61 
66 class ComponentNullError : public std::invalid_argument
67 {
68 public:
69  ComponentNullError() : std::invalid_argument("NULL gagdet id") {};
70 };
71 
76 class ResMenuItemError : public std::invalid_argument
77 {
78 public:
79  ResMenuItemError() : std::invalid_argument("Component ID isn't in menu resource") {};
80 };
81 }
82 
83 #endif /* TBXEXCEPT_H_ */
tbx::ObjectClassError
Exception thrown when the underlying toolbox object class doesn't match the C++ class used to represe...
Definition: tbxexcept.h:37
tbx
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:35
tbx::ObjectNullError
Exception thrown when a C++ object representing a toolbox object uses a method that requires a non-nu...
Definition: tbxexcept.h:57
tbx::ResMenuItemError
Exception thrown is a component id does not refer to an item in a menu resource.
Definition: tbxexcept.h:77
tbx::ComponentNullError
Exception thrown when a C++ object representing a toolbox gadget uses a method that requires a non-nu...
Definition: tbxexcept.h:67
tbx::GadgetClassError
Exception thrown when an underlying toolbox gadget id doesn't match the C++ class used to represent t...
Definition: tbxexcept.h:47