ufe  4.2
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
ufeExcept.h
Go to the documentation of this file.
1 #line 1 "S:/jenkins/workspace/ECP/ufe/ufe-full-python3.10-windows/ufe/include/ufeExcept.h"
2 #ifndef _ufeExcept
3 #define _ufeExcept
4 // ===========================================================================
5 // Copyright 2018 Autodesk, Inc. All rights reserved.
6 //
7 // Use of this software is subject to the terms of the Autodesk license
8 // agreement provided at the time of installation or download, or which
9 // otherwise accompanies this software in either electronic or hard copy form.
10 // ===========================================================================
11 
12 #include "rtid.h"
13 #include "path.h"
14 #include "pathSegment.h"
15 #include "value.h"
16 
17 #include <stdexcept>
18 
19 UFE_NS_DEF {
20 
22 //
23 // This class is fully inline, as its base class is in the Standard Library.
24 // On Windows, exporting a class from a DLL requires exporting all its bases.
25 // This post
26 //
27 // https://stackoverflow.com/questions/24511376/how-to-dllexport-a-class-derived-from-stdruntime-error
28 //
29 // suggests that different Standard Library exception class implementations
30 // have different export linkage characteristics, so we avoid these differences
31 // with a fully inline implementation, which is therefore not exported.
32 //
33 // This does cause clang to warn about the class having "no out-of-line virtual
34 // method definitions; its vtable will be emitted in every translation unit
35 // [-Werror,-Wweak-vtables]". As per
36 //
37 // http://llvm.org/docs/CodingStandards.html#provide-a-virtual-method-anchor-for-classes-in-headers
38 //
39 // this will cause the vtable and RTTI information to be emitted into every .o
40 // (translation unit) that incluces this header, increasing .o size and link
41 // time, so this header file should be included only as necessary.
42 
43 #ifdef __clang__
44 #pragma clang diagnostic push
45 #pragma clang diagnostic ignored "-Wweak-vtables"
46 #endif
47 
48 class InvalidRunTimeName : public std::runtime_error
49 {
50 public:
52  std::runtime_error(rtName) {}
53  InvalidRunTimeName(const InvalidRunTimeName&) = default;
54  ~InvalidRunTimeName() override {}
55 };
56 
57 class InvalidRunTimeId : public std::out_of_range
58 {
59 public:
60  InvalidRunTimeId(const Rtid& rtId) :
61  std::out_of_range(std::to_string(rtId)) {}
62  InvalidRunTimeId(const InvalidRunTimeId&) = default;
63  ~InvalidRunTimeId() override {}
64 };
65 
67 //
68 // This class is fully inline. See InvalidRunTimeId class description for
69 // details.
70 
71 class InvalidOperationOnPath : public std::out_of_range
72 {
73 public:
75  std::out_of_range(path.string()) {}
78 };
79 
81 //
82 // This class is fully inline. See InvalidRunTimeId class description for
83 // details.
84 
85 class InvalidOperationOnPathSegment : public std::out_of_range
86 {
87 public:
89  std::out_of_range(pathSegment.string()) {}
92 };
93 
94 class InvalidValueGet : public std::invalid_argument
95 {
96 public:
97  InvalidValueGet(const Value& v) : std::invalid_argument(v.typeName()) {}
98  InvalidValueGet(const InvalidValueGet&) = default;
99  ~InvalidValueGet() override {}
100 };
101 
102 #ifdef __clang__
103 #pragma clang diagnostic pop
104 #endif
105 
106 }
107 
108 #endif /* _ufeExcept */
InvalidOperationOnPath(const Path &path)
Definition: ufeExcept.h:74
~InvalidRunTimeId() override
Definition: ufeExcept.h:63
A segment of a path within a single runtime.
Definition: pathSegment.h:35
Exception class to signal unknown runtime ID.
Definition: ufeExcept.h:48
Exception class to signal an invalid path.
Definition: ufeExcept.h:85
std::string string(const Path &path)
InvalidRunTimeId(const Rtid &rtId)
Definition: ufeExcept.h:60
Definition: path.h:197
InvalidRunTimeName(const std::string &rtName)
Definition: ufeExcept.h:51
Identify an object or 3D path in the scene.
Definition: path.h:37
uint32_t Rtid
Definition: rtid.h:26
Value class that can hold a wide set of types.
Definition: value.h:34
~InvalidOperationOnPath() override
Definition: ufeExcept.h:77
#define UFE_NS_DEF
Definition: ufe.h:35
InvalidOperationOnPathSegment(const PathSegment &pathSegment)
Definition: ufeExcept.h:88
~InvalidValueGet() override
Definition: ufeExcept.h:99
InvalidValueGet(const Value &v)
Definition: ufeExcept.h:97
~InvalidRunTimeName() override
Definition: ufeExcept.h:54
Path path(const std::string &pathString)
Exception class to signal an invalid path.
Definition: ufeExcept.h:71