Team Fortress 2 Source Code as on 22/4/2020
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.

42 lines
1.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "dmserializers.h"
  7. #include "dmebaseimporter.h"
  8. CDmeBaseImporter::CDmeBaseImporter( char const *formatName, char const *nextFormatName ) :
  9. m_pFormatName( formatName ),
  10. m_pNextSerializer( nextFormatName )
  11. {
  12. }
  13. bool CDmeBaseImporter::IsLatestVersion() const
  14. {
  15. return g_pDataModel->FindLegacyUpdater( m_pNextSerializer ) == NULL;
  16. }
  17. // Updates ppRoot to first non-legacy generic dmx format, returns false if the conversion fails
  18. bool CDmeBaseImporter::Update( CDmElement **ppRoot )
  19. {
  20. if ( !DoFixup( *ppRoot ) )
  21. return false;
  22. if ( !m_pNextSerializer )
  23. return true;
  24. // Chain
  25. IDmLegacyUpdater *pUpdater = g_pDataModel->FindLegacyUpdater( m_pNextSerializer );
  26. if ( !pUpdater )
  27. return true;
  28. return pUpdater->Update( ppRoot );
  29. }
  30. CSFMBaseImporter::CSFMBaseImporter( char const *formatName, char const *nextFormatName ) :
  31. BaseClass( formatName, nextFormatName )
  32. {
  33. }