subtitleparser.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /****************************************************************************
  19. *
  20. * FILE
  21. * $Archive: /Commando/Code/BinkMovie/subtitleparser.h $
  22. *
  23. * DESCRIPTION
  24. * Subtitling control file parser
  25. *
  26. * PROGRAMMER
  27. * Denzil E. Long, Jr.
  28. *
  29. * VERSION INFO
  30. * $Author: Ian_l $
  31. * $Modtime: 8/24/01 2:36p $
  32. * $Revision: 1 $
  33. *
  34. ****************************************************************************/
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef _SUBTITLEPARSER_H_
  39. #define _SUBTITLEPARSER_H_
  40. #include "always.h"
  41. #include <wwlib\vector.h>
  42. #include <stddef.h>
  43. class Straw;
  44. class SubTitleClass;
  45. class SubTitleParserClass
  46. {
  47. public:
  48. SubTitleParserClass(Straw& input);
  49. ~SubTitleParserClass();
  50. DynamicVectorClass<SubTitleClass*>* Get_Sub_Titles(const char* moviename);
  51. private:
  52. enum {LINE_MAX = 1024};
  53. typedef struct tagTokenHook
  54. {
  55. const wchar_t* Token;
  56. void (*Handler)(wchar_t* param, SubTitleClass* subTitle);
  57. } TokenHook;
  58. // Prevent copy construction
  59. SubTitleParserClass(const SubTitleParserClass&);
  60. const SubTitleParserClass operator=(const SubTitleParserClass&);
  61. bool Find_Movie_Entry(const char* moviename);
  62. bool Parse_Sub_Title(wchar_t* string, SubTitleClass* subTitle);
  63. void Parse_Token(wchar_t* token, wchar_t* param, SubTitleClass* subTitle);
  64. wchar_t* Get_Next_Line(void);
  65. unsigned int Get_Line_Number(void) const {return mLineNumber;}
  66. static TokenHook mTokenHooks[];
  67. Straw& mInput;
  68. wchar_t mBuffer[LINE_MAX];
  69. unsigned int mLineNumber;
  70. };
  71. #endif // _SUBTITLEPARSER_H_