HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
IexThrowErrnoExc.h
Go to the documentation of this file.
1
//
2
// SPDX-License-Identifier: BSD-3-Clause
3
// Copyright (c) Contributors to the OpenEXR Project.
4
//
5
6
#ifndef INCLUDED_IEXTHROWERRNOEXC_H
7
#define INCLUDED_IEXTHROWERRNOEXC_H
8
9
//----------------------------------------------------------
10
//
11
// A function which throws ExcErrno exceptions
12
//
13
//----------------------------------------------------------
14
15
#include "
IexBaseExc.h
"
16
#include "
IexExport.h
"
17
18
IEX_INTERNAL_NAMESPACE_HEADER_ENTER
19
20
//--------------------------------------------------------------------------
21
//
22
// Function throwErrnoExc() throws an exception which corresponds to
23
// error code errnum. The exception text is initialized with a copy
24
// of the string passed to throwErrnoExc(), where all occurrences of
25
// "%T" have been replaced with the output of strerror(oserror()).
26
//
27
// Example:
28
//
29
// If opening file /tmp/output failed with an ENOENT error code,
30
// calling
31
//
32
// throwErrnoExc ();
33
//
34
// or
35
//
36
// throwErrnoExc ("%T.");
37
//
38
// will throw an EnoentExc whose text reads
39
//
40
// No such file or directory.
41
//
42
// More detailed messages can be assembled using stringstreams:
43
//
44
// std::stringstream s;
45
// s << "Cannot open file " << name << " (%T).";
46
// throwErrnoExc (s);
47
//
48
// The resulting exception contains the following text:
49
//
50
// Cannot open file /tmp/output (No such file or directory).
51
//
52
// Alternatively, you may want to use the THROW_ERRNO macro defined
53
// in IexMacros.h:
54
//
55
// THROW_ERRNO ("Cannot open file " << name << " (%T).")
56
//
57
//--------------------------------------------------------------------------
58
59
IEX_EXPORT
void
throwErrnoExc
(
const
std::string
& txt,
int
errnum);
60
IEX_EXPORT
void
throwErrnoExc
(
const
std::string
& txt);
61
IEX_EXPORT
void
throwErrnoExc
();
62
63
IEX_INTERNAL_NAMESPACE_HEADER_EXIT
64
65
#endif // INCLUDED_IEXTHROWERRNOEXC_H
string
GLsizei const GLchar *const * string
Definition:
glcorearb.h:814
IEX_EXPORT
#define IEX_EXPORT
Definition:
IexExport.h:30
IexExport.h
throwErrnoExc
IEX_INTERNAL_NAMESPACE_HEADER_ENTER IEX_EXPORT void throwErrnoExc(const std::string &txt, int errnum)
IexBaseExc.h
IEX_INTERNAL_NAMESPACE_HEADER_ENTER
#define IEX_INTERNAL_NAMESPACE_HEADER_ENTER
Definition:
IexNamespace.h:79
IEX_INTERNAL_NAMESPACE_HEADER_EXIT
#define IEX_INTERNAL_NAMESPACE_HEADER_EXIT
Definition:
IexNamespace.h:82
OpenEXR
IexThrowErrnoExc.h
Generated on Sat Nov 23 2024 02:46:14 for HDK by
1.8.6