translateobj.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : wwtranslatedb *
  23. * *
  24. * $Archive:: /Commando/Code/wwtranslatedb/translateobj.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 9/10/01 8:43a $*
  29. * *
  30. * $Revision:: 8 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __TRANSLATE_OBJ_H
  39. #define __TRANSLATE_OBJ_H
  40. #include "persist.h"
  41. #include "bittype.h"
  42. #include "wwstring.h"
  43. #include "widestring.h"
  44. #include "vector.h"
  45. //////////////////////////////////////////////////////////////////////////
  46. // Forward declarations
  47. //////////////////////////////////////////////////////////////////////////
  48. class ChunkSaveClass;
  49. class ChunkLoadClass;
  50. class StringTwiddlerClass;
  51. //////////////////////////////////////////////////////////////////////////
  52. //
  53. // TDBObjClass
  54. //
  55. //////////////////////////////////////////////////////////////////////////
  56. class TDBObjClass : public PersistClass
  57. {
  58. public:
  59. //////////////////////////////////////////////////////////////
  60. // Public constructors/destructors
  61. //////////////////////////////////////////////////////////////
  62. TDBObjClass (void);
  63. TDBObjClass (const TDBObjClass &src);
  64. virtual ~TDBObjClass (void);
  65. //////////////////////////////////////////////////////////////
  66. // Public operators
  67. //////////////////////////////////////////////////////////////
  68. const TDBObjClass & operator= (const TDBObjClass &src);
  69. //////////////////////////////////////////////////////////////
  70. // Public methods
  71. //////////////////////////////////////////////////////////////
  72. //
  73. // RTTI
  74. //
  75. virtual StringTwiddlerClass * As_StringTwiddlerClass (void) { return NULL; }
  76. //
  77. // From PersistClass
  78. //
  79. const PersistFactoryClass & Get_Factory (void) const;
  80. bool Save (ChunkSaveClass &csave);
  81. bool Load (ChunkLoadClass &cload);
  82. //
  83. // Copy methods
  84. //
  85. virtual TDBObjClass * Clone (void) const { return new TDBObjClass (*this); }
  86. //
  87. // TranslateObj specific
  88. //
  89. virtual const WideStringClass & Get_String (uint32 lang_id);
  90. virtual const WideStringClass & Get_String (void);
  91. virtual const StringClass & Get_English_String (void) { return EnglishString; }
  92. virtual uint32 Get_ID (void) { return ID; }
  93. virtual const StringClass & Get_ID_Desc (void) { return IDDesc; }
  94. virtual uint32 Get_Sound_ID (void) { return SoundID; }
  95. virtual const StringClass & Get_Animation_Name (void) { return AnimationName; }
  96. virtual uint32 Get_Category_ID (void) { return CategoryID; }
  97. virtual void Set_String (uint32 lang_id, const WCHAR *string);
  98. virtual void Set_English_String (const TCHAR *string);
  99. virtual void Set_ID (uint32 id);
  100. virtual void Set_ID_Desc (const TCHAR *desc);
  101. virtual void Set_Animation_Name (const TCHAR *name) { AnimationName = name; }
  102. virtual void Set_Sound_ID (uint32 id) { SoundID = id; }
  103. virtual void Set_Category_ID (uint32 id) { CategoryID = id; }
  104. //
  105. // Informational
  106. //
  107. virtual bool Contains_Translation (uint32 lang_id);
  108. protected:
  109. //////////////////////////////////////////////////////////////
  110. // Protected methods
  111. //////////////////////////////////////////////////////////////
  112. void Save_Variables (ChunkSaveClass &csave);
  113. void Load_Variables (ChunkLoadClass &cload);
  114. //////////////////////////////////////////////////////////////
  115. // Protected member data
  116. //////////////////////////////////////////////////////////////
  117. StringClass EnglishString;
  118. StringClass IDDesc;
  119. uint32 ID;
  120. uint32 SoundID;
  121. uint32 CategoryID;
  122. StringClass AnimationName;
  123. DynamicVectorClass<WideStringClass> TranslatedStrings;
  124. };
  125. #endif //__TRANSLATE_OBJ_H