AcPlPlotErrorHandler.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. // DESCRIPTION: Interface for Plot Error Handler.
  12. //
  13. #ifndef ACPLPLOTERRORHANDLER_H
  14. #define ACPLPLOTERRORHANDLER_H
  15. #include "AcPlObject.h"
  16. class AcPlSystemInternals;
  17. class AcPlPlotErrorHandler : public AcPlObject
  18. {
  19. public:
  20. enum ErrorResult {
  21. kAbort,
  22. kRetry,
  23. kIgnore
  24. };
  25. enum Handler {
  26. kInfo,
  27. kWarning,
  28. kError,
  29. kARI,
  30. kSevere,
  31. kTerminal,
  32. kNone
  33. };
  34. ACPL_PORT AcPlPlotErrorHandler();
  35. ACPL_PORT ~AcPlPlotErrorHandler();
  36. ACPL_DECLARE_MEMBERS(AcPlPlotErrorHandler);
  37. public:
  38. // Start of functions which may delegate to the application handler.
  39. ACPL_PORT virtual void infoMessage(const ACHAR *pMessage);
  40. ACPL_PORT virtual int messageBox(const ACHAR *pText,
  41. const ACHAR *pCaption,
  42. unsigned int uType,
  43. int defaultReturn);
  44. //info error handler.
  45. ACPL_PORT virtual void info(ULONG_PTR category,
  46. const unsigned int specific,
  47. const ACHAR *pLocation,
  48. const ACHAR *pContextData,
  49. const ACHAR *pRevision);
  50. //warning error handler.
  51. ACPL_PORT virtual ErrorResult warning(ULONG_PTR category,
  52. const unsigned int specific,
  53. const ACHAR *pLocation,
  54. const ACHAR *pContextData,
  55. const ACHAR *pRevision);
  56. //Severe handler
  57. ACPL_PORT virtual void severeError(ULONG_PTR category,
  58. const unsigned int specific,
  59. const ACHAR *pLocation,
  60. const ACHAR *pContextData,
  61. const ACHAR *pRevision);
  62. //Error handler
  63. ACPL_PORT virtual ErrorResult error(ULONG_PTR category,
  64. const unsigned int specific,
  65. const ACHAR *pLocation,
  66. const ACHAR *pContextData,
  67. const ACHAR *pRevision);
  68. //Abort/Retry/Ignore handler
  69. ACPL_PORT virtual ErrorResult ariError(ULONG_PTR category,
  70. const unsigned int specific,
  71. const ACHAR *pLocation,
  72. const ACHAR *pContextData,
  73. const ACHAR *pRevision);
  74. // Terminal error handler
  75. ACPL_PORT virtual void terminalError(ULONG_PTR category,
  76. const unsigned int specific,
  77. const ACHAR *pLocation,
  78. const ACHAR *pContextData,
  79. const ACHAR *pRevision);
  80. // log a message to the log file
  81. ACPL_PORT virtual void logMessage(const ACHAR *pTitle, const ACHAR *pMsg);
  82. // End of functions which may delegate to the application handler
  83. // true if this error handler takes responsibility for a class of errors
  84. ACPL_PORT virtual bool takeResponsibility(Handler kind) ;
  85. // set the log file name
  86. ACPL_PORT virtual bool setLogHandle(const ACHAR *pFilePathName) ;
  87. // set quiet mode
  88. ACPL_PORT virtual void setQuietMode(bool bQuiet);
  89. // set error logging mode
  90. ACPL_PORT virtual void setLogMode(bool bLog);
  91. // get the quiet mode of this error handler
  92. ACPL_PORT virtual bool quietMode() const;
  93. // get the logging mode of this error handler
  94. ACPL_PORT virtual bool logMode() const;
  95. // OEM strings : product, program, and company
  96. ACPL_PORT void getProductString(ACHAR*& pProductString) const;
  97. ACPL_PORT void getProgramString(ACHAR*& pProgramString) const;
  98. ACPL_PORT void getCompanyString(ACHAR*& pCompanyString) const;
  99. ACPL_PORT virtual const ACHAR* warningTitle() const;
  100. ACPL_PORT virtual const ACHAR* severeTitle() const;
  101. ACPL_PORT virtual const ACHAR* errorTitle() const;
  102. ACPL_PORT virtual const ACHAR* ariTitle() const;
  103. ACPL_PORT virtual const ACHAR* terminalTitle() const;
  104. ACPL_PORT virtual const ACHAR* infoTitle() const;
  105. protected:
  106. // The following parent functions call the corresponding function on the
  107. // link handler.
  108. // If no link handler exists, their behavior is undefined.
  109. // These functions exist as a service to potential child classes.
  110. ACPL_PORT void appInfoMessage(const ACHAR *pMessage);
  111. ACPL_PORT int appMessageBox(const ACHAR *pText,
  112. const ACHAR *pCaption,
  113. unsigned int uType,
  114. int defaultReturn);
  115. //info error handler.
  116. ACPL_PORT void appInfo(ULONG_PTR category,
  117. const unsigned int specific,
  118. const ACHAR *pLocation,
  119. const ACHAR *pContextData,
  120. const ACHAR *pRevision);
  121. //warning error handler.
  122. ACPL_PORT ErrorResult appWarning(ULONG_PTR category,
  123. const unsigned int specific,
  124. const ACHAR *pLocation,
  125. const ACHAR *pContextData,
  126. const ACHAR *pRevision);
  127. //Severe handler
  128. ACPL_PORT void appSevereError(ULONG_PTR category,
  129. const unsigned int specific,
  130. const ACHAR *pLocation,
  131. const ACHAR *pContextData,
  132. const ACHAR *pRevision);
  133. //Error handler
  134. ACPL_PORT ErrorResult appError(ULONG_PTR category,
  135. const unsigned int specific,
  136. const ACHAR *pLocation,
  137. const ACHAR *pContextData,
  138. const ACHAR *pRevision);
  139. //Abort/Retry/Ignore handler
  140. ACPL_PORT ErrorResult appARIError(ULONG_PTR category,
  141. const unsigned int specific,
  142. const ACHAR *pLocation,
  143. const ACHAR *pContextData,
  144. const ACHAR *pRevision);
  145. // Terminal error handler
  146. ACPL_PORT void appTerminalError(ULONG_PTR category,
  147. const unsigned int specific,
  148. const ACHAR *pLocation,
  149. const ACHAR *pContextData,
  150. const ACHAR *pRevision);
  151. // log a message to the log file
  152. ACPL_PORT void appLogMessage(const ACHAR *pTitle, const ACHAR *pMsg);
  153. ACPL_PORT bool appSetLogHandle(const ACHAR *pFilePathName);
  154. };
  155. #endif // ACPLPLOTERRORHANDLER_H