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.

111 lines
2.2 KiB

  1. // IParser.cpp: implementation of the CIParser class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "Html2Bmp.h"
  6. #include "IParser.h"
  7. #ifdef _DEBUG
  8. #undef THIS_FILE
  9. static char THIS_FILE[]=__FILE__;
  10. #define new DEBUG_NEW
  11. #endif
  12. //////////////////////////////////////////////////////////////////////
  13. // Construction/Destruction
  14. //////////////////////////////////////////////////////////////////////
  15. CIParser::CIParser(CString& Source)
  16. {
  17. m_Source = Source + _T(" ");
  18. LexAnalyse();
  19. }
  20. CIParser::~CIParser()
  21. {
  22. }
  23. void CIParser::LexAnalyse()
  24. {
  25. // <table border="0" width="648" cellspacing="0" cellpadding="0"
  26. // height="530" background="template.bmp">
  27. int len = m_Source.GetLength()-1;
  28. int i = 0;
  29. CString word;
  30. while(i < len)
  31. {
  32. // start with an HTML tag
  33. if(isHTMLopenBracket(m_Source[i]))
  34. {
  35. word = _T("");
  36. while(i < len)
  37. {
  38. word += m_Source[i++];
  39. if(!isNameOrNumber(m_Source[i]))
  40. {
  41. // we are in the table
  42. if(!word.CompareNoCase(_T("<table")))
  43. {
  44. word = _T("");
  45. while(i < len)
  46. {
  47. if(isWhiteSpace(m_Source[i]))
  48. i++;
  49. else
  50. word += m_Source[i++];
  51. if(!isNameOrNumber(m_Source[i]))
  52. {
  53. // is it the background attribute?
  54. if(!word.CompareNoCase(_T("background")))
  55. {
  56. // skip the assignment operator and the first quote (if any)
  57. word = _T("");
  58. while(i < len)
  59. {
  60. if(isNameOrNumber(m_Source[i]))
  61. break;
  62. i++;
  63. }
  64. // extract the file name
  65. while(i < len)
  66. {
  67. if(isHochKomma(m_Source[i])
  68. || isHTMLclosingBracket(m_Source[i]))
  69. break;
  70. word += m_Source[i];
  71. i++;
  72. }
  73. // Done!
  74. TemplateBitmapName = word;
  75. return;
  76. }
  77. word = _T("");
  78. }
  79. if(isHTMLclosingBracket(m_Source[i]))
  80. break;
  81. }
  82. }
  83. }
  84. if(isHTMLclosingBracket(m_Source[i]))
  85. break;
  86. }
  87. continue;
  88. }
  89. i++;
  90. }
  91. }