HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GABC_Error.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) COPYRIGHTYEAR
3  * Side Effects Software Inc. All rights reserved.
4  *
5  * Redistribution and use of Houdini Development Kit samples in source and
6  * binary forms, with or without modification, are permitted provided that the
7  * following conditions are met:
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. The name of Side Effects Software may not be used to endorse or
11  * promote products derived from this software without specific prior
12  * written permission.
13  *
14  * THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE `AS IS' AND ANY EXPRESS
15  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17  * NO EVENT SHALL SIDE EFFECTS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  *----------------------------------------------------------------------------
26  */
27 
28 #ifndef __GABC_Error__
29 #define __GABC_Error__
30 
31 #include "GABC_API.h"
32 #include <SYS/SYS_Types.h>
33 
34 class UT_Interrupt;
35 
36 namespace GABC_NAMESPACE
37 {
38 
39 /// This class reports info/warning/error messages that occur during Alembic
40 /// import/export.
42 {
43 public:
45  : mySuccess(true)
46  , myInterrupt(interrupt)
47  {}
48  virtual ~GABC_Error() {}
49 
50  void clear();
51 
52  UT_Interrupt *getInterrupt() const { return myInterrupt; }
53  bool wasInterrupted() const;
54 
55  bool success() const { return mySuccess; }
56 
57  /// @c errorString() always returns false
58  bool errorString(const char *msg);
59  void warningString(const char *msg);
60  void infoString(const char *msg);
61 
62  /// @c error() always returns false
63  bool error(const char *format, ...)
65  void warning(const char *format, ...)
67  void info(const char *format, ...)
68  SYS_PRINTF_CHECK_ATTRIBUTE(2, 3);
69 protected:
70  /// @{
71  /// Callbacks to process error, warning, info and clear
72  virtual void handleError(const char *msg);
73  virtual void handleWarning(const char *msg);
74  virtual void handleInfo(const char *msg);
75  virtual void handleClear();
76  /// @}
77 
78 private:
79  UT_Interrupt *myInterrupt;
80  bool mySuccess;
81 };
82 
83 } // end GABC_NAMESPACE
84 
85 #endif
#define GABC_NAMESPACE
Definition: GABC_API.h:42
< returns > If no error
Definition: snippets.dox:2
#define SYS_PRINTF_CHECK_ATTRIBUTE(string_index, first_to_check)
Definition: SYS_Types.h:447
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:108
UT_Interrupt * getInterrupt() const
Definition: GABC_Error.h:52
#define GABC_API
Definition: GABC_API.h:37
GABC_Error(UT_Interrupt *interrupt)
Definition: GABC_Error.h:44
#define const
Definition: zconf.h:214
bool wasInterrupted(T *i, int percent=-1)