home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / h / vd2 / system / Error.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  3.1 KB  |  120 lines

  1. //    VirtualDub - Video processing and capture application
  2. //    System library component
  3. //    Copyright (C) 1998-2004 Avery Lee, All Rights Reserved.
  4. //
  5. //    Beginning with 1.6.0, the VirtualDub system library is licensed
  6. //    differently than the remainder of VirtualDub.  This particular file is
  7. //    thus licensed as follows (the "zlib" license):
  8. //
  9. //    This software is provided 'as-is', without any express or implied
  10. //    warranty.  In no event will the authors be held liable for any
  11. //    damages arising from the use of this software.
  12. //
  13. //    Permission is granted to anyone to use this software for any purpose,
  14. //    including commercial applications, and to alter it and redistribute it
  15. //    freely, subject to the following restrictions:
  16. //
  17. //    1.    The origin of this software must not be misrepresented; you must
  18. //        not claim that you wrote the original software. If you use this
  19. //        software in a product, an acknowledgment in the product
  20. //        documentation would be appreciated but is not required.
  21. //    2.    Altered source versions must be plainly marked as such, and must
  22. //        not be misrepresented as being the original software.
  23. //    3.    This notice may not be removed or altered from any source
  24. //        distribution.
  25.  
  26. #ifndef f_VD2_ERROR_H
  27. #define f_VD2_ERROR_H
  28.  
  29. #ifdef _MSC_VER
  30.     #pragma once
  31. #endif
  32.  
  33. #include <vd2/system/vdtypes.h>
  34.  
  35. class MyError;
  36.  
  37. ///////////////////////////////////////////////////////////////////////////
  38. //    IVDAsyncErrorCallback
  39. //
  40. class IVDAsyncErrorCallback {
  41. public:
  42.     virtual bool OnAsyncError(MyError& e) = 0;
  43. };
  44.  
  45. ///////////////////////////////////////////////////////////////////////////
  46. //    MyError
  47. //
  48. class MyError {
  49. private:
  50.     const MyError& operator=(const MyError&);        // protect against accidents
  51.  
  52. protected:
  53.     char *buf;
  54.  
  55. public:
  56.     MyError();
  57.     MyError(const MyError& err);
  58.     MyError(const char *f, ...);
  59.     ~MyError();
  60.     void clear();
  61.     void assign(const MyError& e);
  62.     void assign(const char *s);
  63.     void setf(const char *f, ...);
  64.     void vsetf(const char *f, va_list val);
  65.     void post(struct HWND__ *hWndParent, const char *title) const;
  66.     char *gets() const {
  67.         return buf;
  68.     }
  69.     char *c_str() const {
  70.         return buf;
  71.     }
  72.     bool empty() const { return !buf; }
  73.     void discard();
  74.     void swap(MyError& err);
  75.     void TransferFrom(MyError& err);
  76. };
  77.  
  78. class MyICError : public MyError {
  79. public:
  80.     MyICError(const char *s, uint32 icErr);
  81.     MyICError(uint32 icErr, const char *format, ...);
  82. };
  83.  
  84. class MyMMIOError : public MyError {
  85. public:
  86.     MyMMIOError(const char *s, uint32 icErr);
  87. };
  88.  
  89. class MyAVIError : public MyError {
  90. public:
  91.     MyAVIError(const char *s, uint32 aviErr);
  92. };
  93.  
  94. class MyMemoryError : public MyError {
  95. public:
  96.     MyMemoryError();
  97. };
  98.  
  99. class MyWin32Error : public MyError {
  100. public:
  101.     MyWin32Error(const char *format, uint32 err, ...);
  102. };
  103.  
  104. class MyCrashError : public MyError {
  105. public:
  106.     MyCrashError(const char *format, uint32 dwExceptionCode);
  107. };
  108.  
  109. class MyUserAbortError : public MyError {
  110. public:
  111.     MyUserAbortError();
  112. };
  113.  
  114. class MyInternalError : public MyError {
  115. public:
  116.     MyInternalError(const char *format, ...);
  117. };
  118.  
  119. #endif
  120.