ufe  3.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.9-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 
16 #include <stdexcept>
17 
18 UFE_NS_DEF {
19 
21 //
22 // This class is fully inline, as its base class is in the Standard Library.
23 // On Windows, exporting a class from a DLL requires exporting all its bases.
24 // This post
25 //
26 // https://stackoverflow.com/questions/24511376/how-to-dllexport-a-class-derived-from-stdruntime-error
27 //
28 // suggests that different Standard Library exception class implementations
29 // have different export linkage characteristics, so we avoid these differences
30 // with a fully inline implementation, which is therefore not exported.
31 //
32 // This does cause clang to warn about the class having "no out-of-line virtual
33 // method definitions; its vtable will be emitted in every translation unit
34 // [-Werror,-Wweak-vtables]". As per
35 //
36 // http://llvm.org/docs/CodingStandards.html#provide-a-virtual-method-anchor-for-classes-in-headers
37 //
38 // this will cause the vtable and RTTI information to be emitted into every .o
39 // (translation unit) that incluces this header, increasing .o size and link
40 // time, so this header file should be included only as necessary.
41 
42 #ifdef __clang__
43 #pragma clang diagnostic push
44 #pragma clang diagnostic ignored "-Wweak-vtables"
45 #endif
46 
47 class InvalidRunTimeName : public std::runtime_error
48 {
49 public:
51  std::runtime_error(rtName) {}
52  InvalidRunTimeName(const InvalidRunTimeName&) = default;
53  ~InvalidRunTimeName() override {}
54 };
55 
56 class InvalidRunTimeId : public std::out_of_range
57 {
58 public:
59  InvalidRunTimeId(const Rtid& rtId) :
60  std::out_of_range(std::to_string(rtId)) {}
61  InvalidRunTimeId(const InvalidRunTimeId&) = default;
62  ~InvalidRunTimeId() override {}
63 };
64 
66 //
67 // This class is fully inline. See InvalidRunTimeId class description for
68 // details.
69 
70 class InvalidOperationOnPath : public std::out_of_range
71 {
72 public:
74  std::out_of_range(path.string()) {}
77 };
78 
80 //
81 // This class is fully inline. See InvalidRunTimeId class description for
82 // details.
83 
84 class InvalidOperationOnPathSegment : public std::out_of_range
85 {
86 public:
88  std::out_of_range(pathSegment.string()) {}
91 };
92 
93 #ifdef __clang__
94 #pragma clang diagnostic pop
95 #endif
96 
97 }
98 
99 #endif /* _ufeExcept */
InvalidOperationOnPath(const Path &path)
Definition: ufeExcept.h:73
~InvalidRunTimeId() override
Definition: ufeExcept.h:62
A segment of a path within a single runtime.
Definition: pathSegment.h:35
Exception class to signal unknown runtime ID.
Definition: ufeExcept.h:47
Exception class to signal an invalid path.
Definition: ufeExcept.h:84
std::string string(const Path &path)
InvalidRunTimeId(const Rtid &rtId)
Definition: ufeExcept.h:59
Definition: path.h:197
InvalidRunTimeName(const std::string &rtName)
Definition: ufeExcept.h:50
Identify an object or 3D path in the scene.
Definition: path.h:37
uint32_t Rtid
Definition: rtid.h:26
~InvalidOperationOnPath() override
Definition: ufeExcept.h:76
#define UFE_NS_DEF
Definition: ufe.h:35
InvalidOperationOnPathSegment(const PathSegment &pathSegment)
Definition: ufeExcept.h:87
~InvalidRunTimeName() override
Definition: ufeExcept.h:53
Path path(const std::string &pathString)
Exception class to signal an invalid path.
Definition: ufeExcept.h:70