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.

99 lines
2.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: K K S T L . H
  7. //
  8. // Contents:
  9. //
  10. // Notes:
  11. //
  12. // Author: kumarp
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "ncstring.h"
  17. typedef list<PVOID> TPtrList;
  18. typedef TPtrList::iterator TPtrListIter;
  19. typedef list<tstring*> TStringList;
  20. typedef TStringList::iterator TStringListIter;
  21. typedef vector<BYTE> TByteArray;
  22. typedef vector<tstring*> TStringArray;
  23. // ----------------------------------------------------------------------
  24. void FormatTString(IN OUT tstring& str, IN PCWSTR pszFormat, ...);
  25. inline void AddAtEndOfStringList(IN TStringList& sl,
  26. IN PCWSTR pszString)
  27. {
  28. sl.push_back(new tstring(pszString));
  29. }
  30. inline void AddAtEndOfStringList(IN TStringList& sl,
  31. IN const tstring* pstr)
  32. {
  33. sl.push_back(new tstring(*pstr));
  34. }
  35. inline void AddAtEndOfStringList(IN TStringList& sl,
  36. IN const tstring& pstr)
  37. {
  38. sl.push_back(new tstring(pstr));
  39. }
  40. inline void AddAtBeginningOfStringList(IN TStringList& sl,
  41. IN const tstring& pstr)
  42. {
  43. sl.push_front(new tstring(pstr));
  44. }
  45. BOOL FIsInStringList(IN const TStringList& sl, IN tstring& str,
  46. OUT TStringListIter* pos=NULL);
  47. BOOL FIsInStringList(IN const TStringList& sl, IN PCWSTR psz,
  48. OUT TStringListIter* pos=NULL);
  49. tstring* GetNthItem(IN TStringList& sl, IN DWORD dwIndex);
  50. // ----------------------------------------------------------------------
  51. inline TPtrListIter AddAtEndOfPtrList(IN TPtrList& pl, IN PVOID pv)
  52. {
  53. return pl.insert(pl.end(), pv);
  54. }
  55. inline TPtrListIter GetIterAtBack(IN const TPtrList* ppl)
  56. {
  57. TPtrListIter pliRet = ppl->end();
  58. pliRet--;
  59. return pliRet;
  60. }
  61. inline void EraseAll(IN TPtrList* ppl)
  62. {
  63. ppl->erase(ppl->begin(), ppl->end());
  64. }
  65. void EraseAndDeleteAll(IN TPtrList* ppl);
  66. void EraseAndDeleteAll(IN TPtrList& ppl);
  67. inline void EraseAll(IN TStringList* ppl)
  68. {
  69. ppl->erase(ppl->begin(), ppl->end());
  70. }
  71. void EraseAndDeleteAll(IN TStringList* ppl);
  72. void EraseAndDeleteAll(IN TStringList& ppl);
  73. // ----------------------------------------------------------------------
  74. void GetDataFromByteArray(IN const TByteArray& ba, OUT BYTE*& pb);