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.

142 lines
3.2 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2001, Microsoft Corporation All rights reserved.
  4. //
  5. // Module Name:
  6. //
  7. // FileLayoutExceptionList.h
  8. //
  9. // Abstract:
  10. //
  11. // This file contains the File Layout Exception List object definition.
  12. //
  13. // Revision History:
  14. //
  15. // 2001-06-20 lguindon Created.
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #ifndef _FILELAYOUTEXCEPTIONLIST_H_
  19. #define _FILELAYOUTEXCEPTIONLIST_H_
  20. ///////////////////////////////////////////////////////////////////////////////
  21. //
  22. // Includes Files.
  23. //
  24. ///////////////////////////////////////////////////////////////////////////////
  25. #include "infparser.h"
  26. #include "FileLayout.h"
  27. ///////////////////////////////////////////////////////////////////////////////
  28. //
  29. // Class definition.
  30. //
  31. ///////////////////////////////////////////////////////////////////////////////
  32. class FileLayoutExceptionList
  33. {
  34. public:
  35. FileLayoutExceptionList()
  36. {
  37. m_Head = NULL;
  38. m_Tail = NULL;
  39. m_Entries = 0;
  40. };
  41. ~FileLayoutExceptionList()
  42. {
  43. FileLayout* temp;
  44. while ((temp = getFirst()) != NULL)
  45. {
  46. remove(temp);
  47. }
  48. };
  49. DWORD getExceptionsNumber() { return (m_Entries); };
  50. FileLayout* getFirst() { return (m_Head); };
  51. void insert(FileLayout* item)
  52. {
  53. if ((m_Tail == NULL) && (m_Head == NULL))
  54. {
  55. m_Tail = item;
  56. m_Head = item;
  57. }
  58. else
  59. {
  60. item->setPrevious(m_Tail);
  61. m_Tail->setNext(item);
  62. m_Tail = item;
  63. }
  64. m_Entries++;
  65. };
  66. void remove(FileLayout* item)
  67. {
  68. if ((m_Tail == m_Head) && (m_Tail == item))
  69. {
  70. m_Tail = NULL;
  71. m_Head = NULL;
  72. }
  73. else
  74. {
  75. if (m_Head = item)
  76. {
  77. m_Head = item->getNext();
  78. (item->getNext())->setPrevious(NULL);
  79. }
  80. else if (m_Tail = item)
  81. {
  82. m_Tail = item->getPrevious();
  83. (item->getPrevious())->setNext(NULL);
  84. }
  85. else
  86. {
  87. (item->getPrevious())->setNext(item->getNext());
  88. (item->getNext())->setPrevious(item->getPrevious());
  89. }
  90. }
  91. delete item;
  92. item = NULL;
  93. m_Entries--;
  94. };
  95. FileLayout* search(LPSTR srcName)
  96. {
  97. FileLayout* item;
  98. item = getFirst();
  99. while (item != NULL)
  100. {
  101. if( _tcsicmp(srcName, item->getOriginFileName()) == 0)
  102. {
  103. return item;
  104. }
  105. item = item->getNext();
  106. }
  107. return NULL;
  108. }
  109. FileLayout* searchDestName(LPSTR destFileName)
  110. {
  111. FileLayout* item;
  112. item = getFirst();
  113. while (item != NULL)
  114. {
  115. if (_tcsicmp(destFileName, item->getDestFileName()) == 0)
  116. {
  117. return item;
  118. }
  119. item = item->getNext();
  120. }
  121. return NULL;
  122. }
  123. private:
  124. FileLayout *m_Head;
  125. FileLayout *m_Tail;
  126. DWORD m_Entries;
  127. };
  128. #endif //_FILELAYOUTEXCEPTIONLIST_H_