ConfigReader.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. EQ2Emulator 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. EQ2Emulator is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef __CONFIG_READER__
  17. #define __CONFIG_READER__
  18. #include <stdio.h>
  19. #include "PacketStruct.h"
  20. #include <map>
  21. #include <string>
  22. #include <vector>
  23. #include "xmlParser.h"
  24. #include "Mutex.h"
  25. using namespace std;
  26. class ConfigReader{
  27. public:
  28. ~ConfigReader();
  29. void addStruct(const char* name, int16 version, PacketStruct* new_struct);
  30. PacketStruct* getStruct(const char* name, int16 version);
  31. PacketStruct* getStructByVersion(const char* name, int16 version);
  32. void loadDataStruct(PacketStruct* packet, XMLNode parentNode, bool array_packet = false);
  33. bool processXML_Elements(const char* fileName);
  34. int16 GetStructVersion(const char* name, int16 version);
  35. void DestroyStructs();
  36. void ReloadStructs();
  37. bool LoadFile(const char* name);
  38. private:
  39. Mutex MStructs;
  40. vector<string> load_files;
  41. map<string, vector<PacketStruct*>*> structs;
  42. //vector<PacketStruct*> structs;
  43. };
  44. #endif