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