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.

56 lines
1.5 KiB

  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmObject_h
  14. #define cmObject_h
  15. #include "cmStandardIncludes.h"
  16. /** \class cmObject
  17. * \brief Superclass for all commands and other classes in CMake.
  18. *
  19. * cmObject is the base class for all classes in CMake. It defines some
  20. * methods such as GetNameOfClass, IsA, SafeDownCast.
  21. */
  22. class cmObject
  23. {
  24. public:
  25. /**
  26. * Need virtual destructor to destroy real command type.
  27. */
  28. virtual ~cmObject() {}
  29. /**
  30. * The class name of the command.
  31. */
  32. virtual const char* GetNameOfClass() = 0;
  33. /**
  34. * Returns true if this class is the given class, or a subclass of it.
  35. */
  36. static bool IsTypeOf(const char *type)
  37. { return !strcmp("cmObject", type); }
  38. /**
  39. * Returns true if this object is an instance of the given class or
  40. * a subclass of it.
  41. */
  42. virtual bool IsA(const char *type)
  43. { return cmObject::IsTypeOf(type); }
  44. };
  45. #endif