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.

130 lines
2.2 KiB

  1. #pragma once
  2. /*
  3. class ImportsModule : public CString {
  4. public:
  5. ImportsModule (LPCSTR name);
  6. void AddImport (LPCSTR name);
  7. void AddImport (LPCSTR name, LPCSTR msg);
  8. BOOL Lookup (LPCSTR name);
  9. int CountImports (void);
  10. private:
  11. CStringList m_illegal;
  12. CMapStringToString m_messages;
  13. };
  14. */
  15. class ModulesAndImports {
  16. public:
  17. ModulesAndImports();
  18. virtual ~ModulesAndImports();
  19. void SetModule (LPCSTR name);
  20. void AddImport (LPCSTR name, LPCSTR msg = "");
  21. // LPCSTR CurrentModule (void);
  22. // BOOL AnyImports (void); // are any imports disallowed with the last module defined?
  23. BOOL IsModule (LPCSTR name);
  24. BOOL Lookup (LPCSTR name, CString& msg);
  25. BOOL Lookup (LPCSTR name);
  26. private:
  27. // ImportsModule* m_curr_module;
  28. CString m_curr_module;
  29. // CPtrList m_modules;
  30. CMapStringToString m_imports;
  31. };
  32. /*
  33. inline
  34. ImportsModule::ImportsModule (LPCSTR name) :
  35. CString (name)
  36. {
  37. }
  38. inline
  39. void
  40. ImportsModule::AddImport (LPCSTR name)
  41. {
  42. m_illegal.AddTail (name);
  43. }
  44. inline
  45. void
  46. ImportsModule::AddImport (LPCSTR name, LPCSTR msg)
  47. {
  48. this->AddImport (name);
  49. m_messages[msg] = name;
  50. }
  51. inline
  52. BOOL
  53. ImportsModule::Lookup (LPCSTR name)
  54. {
  55. return (m_illegal.Find (name) != NULL);
  56. }
  57. inline
  58. int
  59. ImportsModule::CountImports (void)
  60. {
  61. return m_illegal.GetCount();
  62. }
  63. */
  64. inline
  65. ModulesAndImports::ModulesAndImports () :
  66. m_curr_module ("")
  67. {
  68. }
  69. inline
  70. void
  71. ModulesAndImports::SetModule (LPCSTR name)
  72. {
  73. /*
  74. m_curr_module = new ImportsModule (name);
  75. // if (!m_curr_module) ...
  76. m_curr_module->MakeUpper();
  77. m_modules.AddTail(m_curr_module);
  78. */
  79. m_curr_module = name;
  80. m_imports.SetAt (m_curr_module, "");
  81. }
  82. inline
  83. void
  84. ModulesAndImports::AddImport (LPCSTR name, LPCSTR msg)
  85. {
  86. /*
  87. if (m_curr_module)
  88. m_curr_module->AddImport (name);
  89. */
  90. m_imports.SetAt (m_curr_module+CString("!")+CString(name), msg);
  91. }
  92. /*
  93. inline
  94. BOOL
  95. ModulesAndImports::AnyImports (void)
  96. {
  97. return (m_imports->CountImports () != 0);
  98. }
  99. */
  100. /*
  101. inline
  102. LPCSTR
  103. ModulesAndImports::CurrentModule (void)
  104. {
  105. if (m_curr_module)
  106. return (LPCSTR)(CString)(*m_curr_module);
  107. }
  108. */
  109. inline
  110. BOOL
  111. ModulesAndImports::Lookup (LPCSTR name)
  112. {
  113. CString msg;
  114. return Lookup (name, msg);
  115. }