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.

39 lines
1.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: schemainitutils: Helpful macros when initing stuff that you'll
  4. // want to record multiple errors from
  5. //
  6. //=============================================================================
  7. #ifndef SCHEMAINITUTILS_H
  8. #define SCHEMAINITUTILS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. // used for initialization functions. Adds an error message if we're recording
  13. // them or returns false if we're not
  14. #define SCHEMA_INIT_CHECK( expr, ... ) \
  15. if ( false == ( expr ) ) \
  16. { \
  17. CUtlString msg; \
  18. msg.Format( __VA_ARGS__ ); \
  19. if ( NULL == ( pVecErrors ) ) \
  20. { \
  21. AssertMsg( expr, "%s", msg.String() ); \
  22. } \
  23. else \
  24. { \
  25. pVecErrors->AddToTail( msg ); \
  26. } \
  27. return false; \
  28. }
  29. #define SCHEMA_INIT_SUCCESS( ) \
  30. ( NULL == pVecErrors ) || ( 0 == pVecErrors->Count() )
  31. #define SCHEMA_INIT_SUBSTEP( expr ) \
  32. if ( !( expr ) ) \
  33. return false;
  34. #endif // SCHEMAINITUTILS_H