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.

34 lines
656 B

  1. // tempary sub string class
  2. #ifndef __PP_SMART_CLASSES__
  3. #define __PP_SMART_CLASSES__
  4. struct TempSubStr
  5. {
  6. TempSubStr(LPCSTR p = NULL, DWORD l = 0):
  7. m_p(p), m_l(l), m_tempChar(0)
  8. {
  9. Set(p, l);
  10. };
  11. void Set(LPCSTR p, DWORD l)
  12. {
  13. if(!p || !l) return;
  14. m_p = p;
  15. m_l = l;
  16. LPSTR t = (LPSTR)(p + l);
  17. m_tempChar = *t;
  18. *(t) = 0;
  19. };
  20. ~TempSubStr()
  21. {
  22. if(!m_p || !m_l) return;
  23. LPSTR t = (LPSTR)(m_p + m_l);
  24. *(t) = m_tempChar;
  25. };
  26. LPCSTR m_p;
  27. DWORD m_l;
  28. char m_tempChar;
  29. };
  30. #endif // #ifndef __PP_SMART_CLASSES__