Source code of Windows XP (NT5)
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.

91 lines
1.6 KiB

  1. // output.cpp
  2. //
  3. #include "stdpch.h"
  4. #pragma hdrstop
  5. #include "output.h"
  6. #include "tchar.h"
  7. void __cdecl COutput::warnErr(LPCTSTR szFmt, ...)
  8. {
  9. TCHAR szBuffer[1024];
  10. va_list valMarker;
  11. va_start(valMarker, szFmt);
  12. _vstprintf(szBuffer, szFmt, valMarker);
  13. va_end(valMarker);
  14. auto_leave leave(m_cs);
  15. leave.EnterCriticalSection();
  16. m_strWarnErr += szBuffer;
  17. leave.LeaveCriticalSection();
  18. }
  19. void __cdecl COutput::good(LPCTSTR szFmt, ...)
  20. {
  21. TCHAR szBuffer[1024];
  22. va_list valMarker;
  23. va_start(valMarker, szFmt);
  24. _vstprintf(szBuffer, szFmt, valMarker);
  25. va_end(valMarker);
  26. auto_leave leave(m_cs);
  27. leave.EnterCriticalSection();
  28. m_strGood += szBuffer;
  29. leave.LeaveCriticalSection();
  30. }
  31. void __cdecl COutput::err(LPCTSTR szFmt, ...)
  32. {
  33. TCHAR szBuffer[1024];
  34. va_list valMarker;
  35. va_start(valMarker, szFmt);
  36. _vstprintf(szBuffer, szFmt, valMarker);
  37. va_end(valMarker);
  38. auto_leave leave(m_cs);
  39. leave.EnterCriticalSection();
  40. m_strErr += szBuffer;
  41. leave.LeaveCriticalSection();
  42. }
  43. LPCTSTR COutput::Status()
  44. {
  45. static TCHAR szOutput[4096];
  46. lstrcpy(szOutput, m_strGood.c_str());
  47. lstrcat(szOutput, m_strWarn.c_str());
  48. lstrcat(szOutput, m_strErr.c_str());
  49. lstrcat(szOutput, m_strWarnErr.c_str());
  50. return szOutput;
  51. }
  52. void COutput::Reset()
  53. {
  54. m_strGood.resize(0);
  55. m_strWarn.resize(0);
  56. m_strWarnErr.resize(0);
  57. m_strErr.resize(0);
  58. }
  59. COutput& COutput::operator+= (const COutput& rhs)
  60. {
  61. m_strGood += rhs.m_strGood;
  62. m_strWarn += rhs.m_strWarn;
  63. m_strWarnErr += rhs.m_strWarnErr;
  64. m_strErr += rhs.m_strErr;
  65. return *this;
  66. }