Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

  1. // scuExcHelp.h -- Exception helper for clients defining exceptions
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 1999. This computer program includes Confidential, Proprietary
  4. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  5. // use, disclosure, and/or reproduction is prohibited unless authorized
  6. // in writing. All Rights Reserved.
  7. #if !defined(SCU_EXCHELP_H)
  8. #define SCU_EXCHELP_H
  9. #include <string>
  10. #include <wtypes.h>
  11. namespace scu
  12. {
  13. template<class CauseCode>
  14. struct CauseCodeDescriptionTable
  15. {
  16. typename CauseCode m_cc;
  17. LPCTSTR m_lpDescription;
  18. };
  19. template<class CauseCode>
  20. LPCTSTR
  21. FindDescription(typename CauseCode cc,
  22. CauseCodeDescriptionTable<typename CauseCode> const *ccdt,
  23. size_t cTableLength)
  24. {
  25. bool fFound = false;
  26. LPCTSTR lpDescription = 0;
  27. for (size_t i = 0; !fFound && (i < cTableLength); i++)
  28. {
  29. if (cc == ccdt[i].m_cc)
  30. {
  31. lpDescription = ccdt[i].m_lpDescription;
  32. fFound = true;
  33. }
  34. }
  35. return lpDescription;
  36. }
  37. } // namespace scu
  38. #endif // SCU_EXCHELP_H