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.

93 lines
1.5 KiB

  1. //=======================================================================
  2. //
  3. // Copyright (c) 1999 Microsoft Corporation. All Rights Reserved.
  4. //
  5. // File: template.h
  6. //
  7. // Purpose: DHTML template support
  8. //
  9. //=======================================================================
  10. #ifndef _TEMPLATE_H
  11. #define _TEMPLATE_H
  12. #include "stdafx.h"
  13. #include "WUV3IS.h"
  14. #include <stdio.h>
  15. #define USEWUV3INCLUDES
  16. #include <wuv3.h>
  17. #undef USEWUV3INCLUDES
  18. #include "safearr.h"
  19. //
  20. // we are currently not using this feature
  21. // the code has been wrapped in this the following define
  22. //
  23. #undef HTML_TEMPLATE
  24. #ifdef HTML_TEMPLATE
  25. HRESULT MakeCatalogHTML(CCatalog *pCatalog, long lFilters, VARIANT *pvaVariant);
  26. class CParseTemplate
  27. {
  28. public:
  29. CParseTemplate(LPCSTR pszTemplate);
  30. ~CParseTemplate();
  31. BOOL Invalid()
  32. {
  33. return m_bInvalid;
  34. }
  35. BOOL MakeItemString(PINVENTORY_ITEM pItem);
  36. LPCSTR GetString()
  37. {
  38. return m_pszStrBuf;
  39. }
  40. DWORD GetStringLen()
  41. {
  42. return m_cStrUsed;
  43. }
  44. private:
  45. enum FRAG_TYPE {FRAG_STR, FRAG_REPLACE, FRAG_CONDITION};
  46. enum {FRAG_EXPAND = 16, STR_EXPAND = 2048};
  47. struct FRAGMENT
  48. {
  49. FRAG_TYPE FragType;
  50. char chCode;
  51. DWORD dwVal;
  52. LPSTR pszStrVal;
  53. DWORD dwStrLen;
  54. };
  55. LPSTR m_pTemplateBuf;
  56. BOOL m_bInvalid;
  57. // fragment
  58. FRAGMENT* m_pFrag;
  59. int m_cFragAlloc;
  60. int m_cFragUsed;
  61. // internal string
  62. LPSTR m_pszStrBuf;
  63. DWORD m_cStrAlloc;
  64. DWORD m_cStrUsed;
  65. CParseTemplate() {}
  66. void AddFrag(FRAGMENT* pfrag);
  67. void ClearStr();
  68. void AppendStr(LPCSTR pszStr, DWORD cLen);
  69. };
  70. #endif
  71. #endif // _TEMPLATE_H