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.

127 lines
4.3 KiB

  1. //
  2. // MODULE: APGTSCMD.CPP
  3. //
  4. // PURPOSE: Template string memory manager/allocator
  5. //
  6. // PROJECT: Generic Troubleshooter DLL for Microsoft AnswerPoint
  7. //
  8. // COMPANY: Saltmine Creative, Inc. (206)-633-4743 [email protected]
  9. //
  10. // AUTHOR: Victor Moore
  11. // further work by Roman Mach (RM), Richard Meadows (RWM), Joe Mabel, Oleg Kalosha
  12. //
  13. // ORIGINAL DATE: 8-2-96
  14. //
  15. // NOTES:
  16. // 1. Based on Print Troubleshooter DLL
  17. //
  18. // Version Date By Comments
  19. //--------------------------------------------------------------------
  20. // V0.1 - VM Original
  21. // V0.2 6/4/97 RWM Local Version for Memphis
  22. // V0.3 3/24/98 JM Local Version for NT5//
  23. class HTXCommand {
  24. public:
  25. HTXCommand(UINT type, const TCHAR *idstr);
  26. virtual ~HTXCommand();
  27. Add( HTXCommand command);
  28. virtual HTXCommand *Execute(CString *cstr, CInfer *infer);
  29. virtual HTXCommand *GetElse();
  30. virtual HTXCommand *GetEndIf();
  31. virtual HTXCommand *GetEndFor();
  32. virtual void SetElse(HTXCommand *elseif);
  33. virtual void SetEndIf(HTXCommand *endif);
  34. virtual void SetEndFor(HTXCommand *endfor);
  35. virtual void GetResource(CString &str, const CString& chm);
  36. void SetStart(UINT pos);
  37. void SetEnd(UINT pos);
  38. UINT GetStart();
  39. UINT GetEnd();
  40. const TCHAR *GetIDStr();
  41. UINT ReadBeforeStr(UINT before, UINT after, LPCTSTR startstr);
  42. UINT ReadAfterStr(UINT before, UINT after, LPCTSTR startstr);
  43. TCHAR *GetBeforeStr();
  44. TCHAR *GetAfterStr();
  45. UINT GetBeforeLen();
  46. UINT GetAfterLen();
  47. UINT GetType();
  48. UINT GetStatus();
  49. HTXCommand *GetNext();
  50. void SetNext(HTXCommand *next);
  51. protected:
  52. UINT m_type; // ID which identifies this command (e.g. HTX_TYPEENDIF)
  53. BOOL m_error; // can be set true on certain out-of-memory errors
  54. // once set, cannot be cleared
  55. const TCHAR *m_idstr; // string which identifies this command (e.g. HTX_ENDIFSTR, "endif")
  56. // The next 2 are used in identical ways. Might want to abstract an object here.
  57. TCHAR *m_beforehtmlstr; // with m_beforelen, m_beforesize implements a "before" string,
  58. TCHAR *m_afterhtmlstr; // with m_afterlen, m_aftersize implements an "after" string,
  59. protected:
  60. UINT m_beforelen; // Logical size in chars
  61. UINT m_afterlen; // Logical size in chars
  62. UINT m_beforesize; // Physical size in bytes
  63. UINT m_aftersize; // Physical size in bytes
  64. UINT m_start; // pointer into HTI file where the "after" text of this command begins
  65. UINT m_end; // pointer into HTI file where the "after" text of this command ends
  66. HTXCommand *m_next; // link to next command (in textual sequence in file).
  67. };
  68. class HTXForCommand: public HTXCommand {
  69. public:
  70. HTXForCommand(UINT type, TCHAR *idstr, UINT variable);
  71. ~HTXForCommand();
  72. HTXCommand *Execute(CString *cstr, CInfer *infer);
  73. HTXCommand *GetEndFor();
  74. void SetEndFor(HTXCommand *endfor);
  75. protected:
  76. UINT m_var_index; // variable over whose range we iterate
  77. HTXCommand *m_endfor; // associate the corresponding "endfor"
  78. };
  79. class HTXIfCommand: public HTXCommand {
  80. public:
  81. HTXIfCommand(UINT type, TCHAR *idstr, UINT variable);
  82. ~HTXIfCommand();
  83. HTXCommand *Execute(CString *cstr, CInfer *infer);
  84. HTXCommand *GetElse();
  85. HTXCommand *GetEndIf();
  86. void SetElse(HTXCommand *elseif);
  87. void SetEndIf(HTXCommand *endif);
  88. protected:
  89. UINT m_var_index; // conditional variable which determines whether "then" case
  90. // or "else" case appplies
  91. HTXCommand *m_endif; // associate the corresponding "endif"
  92. HTXCommand *m_else; // associate the corresponding "else", if any
  93. };
  94. class HTXDisplayCommand: public HTXCommand {
  95. public:
  96. HTXDisplayCommand(UINT type, TCHAR *idstr, UINT variable);
  97. ~HTXDisplayCommand();
  98. HTXCommand *Execute(CString *cstr, CInfer *infer);
  99. protected:
  100. UINT m_var_index; // ID of variable whose value will be displayed in the HTML
  101. };
  102. class HTXResourceCommand: public HTXCommand {
  103. public:
  104. HTXResourceCommand(UINT type, TCHAR *idstr);
  105. virtual ~HTXResourceCommand();
  106. virtual HTXCommand *Execute(CString *cstr, CInfer *infer);
  107. virtual void GetResource(CString &str, const CString& chm);
  108. void GetResName(LPCTSTR var_name);
  109. protected:
  110. UINT m_var_index; // value to evaluate, e.g. PROBLEM_ASK_INDEX,
  111. // RECOMMENDATIONS_INDEX
  112. CString m_strFileName; // file from which we will copy HTML
  113. CString m_strResource; // in-memory copy of that file's contents
  114. };