inisup.h 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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 : WWLib *
  23. * *
  24. * $Archive:: /G/wwlib/inisup.h $*
  25. * *
  26. * $Author:: Eric_c $*
  27. * *
  28. * $Modtime:: 4/02/99 11:59a $*
  29. * *
  30. * $Revision:: 2 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if _MSC_VER >= 1000
  36. #pragma once
  37. #endif // _MSC_VER >= 1000
  38. /*
  39. ** This header defines generally unused member structures used by the INI class.
  40. ** Previously these were member structures of the INI class but they were separated
  41. ** to help reduce header dependancies. -ehc
  42. */
  43. #include "listnode.h"
  44. #include "index.h"
  45. #include "crc.h"
  46. /*
  47. ** The value entries for the INI file are stored as objects of this type.
  48. ** The entry identifier and value string are combined into this object.
  49. */
  50. struct INIEntry : public Node<INIEntry *> {
  51. INIEntry(char * entry = NULL, char * value = NULL) : Entry(entry), Value(value) {}
  52. ~INIEntry(void);
  53. // ~INIEntry(void) {free(Entry);Entry = NULL;free(Value);Value = NULL;}
  54. // int Index_ID(void) const {return(CRCEngine()(Entry, strlen(Entry)));};
  55. int Index_ID(void) const { return CRC::String(Entry);};
  56. char * Entry;
  57. char * Value;
  58. };
  59. /*
  60. ** Each section (bracketed) is represented by an object of this type. All entries
  61. ** subordinate to this section are attached.
  62. */
  63. struct INISection : public Node<INISection *> {
  64. INISection(char * section) : Section(section) {}
  65. ~INISection(void);
  66. // ~INISection(void) {free(Section);Section = 0;EntryList.Delete();}
  67. INIEntry * Find_Entry(char const * entry) const;
  68. // int Index_ID(void) const {return(CRCEngine()(Section, strlen(Section)));};
  69. int Index_ID(void) const { return CRC::String(Section); };
  70. char * Section;
  71. List<INIEntry *> EntryList;
  72. IndexClass<int, INIEntry *> EntryIndex;
  73. private:
  74. INISection(INISection const & rvalue);
  75. INISection operator = (INISection const & rvalue);
  76. };