packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmTest.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmTest_h
13 #define cmTest_h
14
15 #include "cmCustomCommand.h"
16 #include "cmPropertyMap.h"
17 class cmMakefile;
18 class cmListFileBacktrace;
19
20 /** \class cmTest
21  * \brief Represent a test
22  *
23  * cmTest is representation of a test.
24  */
25 class cmTest
26 {
27 public:
28   /**
29    */
30   cmTest(cmMakefile* mf);
31   ~cmTest();
32
33   ///! Set the test name
34   void SetName(const char* name);
35   const char* GetName() const { return this->Name.c_str(); }
36
37   void SetCommand(std::vector<std::string> const& command);
38   std::vector<std::string> const& GetCommand() const
39     {
40     return this->Command;
41     }
42
43   /**
44    * Print the structure to std::cout.
45    */
46   void Print() const;
47
48   ///! Set/Get a property of this source file
49   void SetProperty(const char *prop, const char *value);
50   void AppendProperty(const char* prop, const char* value,bool asString=false);
51   const char *GetProperty(const char *prop) const;
52   bool GetPropertyAsBool(const char *prop) const;
53   cmPropertyMap &GetProperties() { return this->Properties; };
54
55   // Define the properties
56   static void DefineProperties(cmake *cm);
57
58   /** Get the cmMakefile instance that owns this test.  */
59   cmMakefile *GetMakefile() { return this->Makefile;};
60
61   /** Get the backtrace of the command that created this test.  */
62   cmListFileBacktrace const& GetBacktrace() const;
63
64   /** Get/Set whether this is an old-style test.  */
65   bool GetOldStyle() const { return this->OldStyle; }
66   void SetOldStyle(bool b) { this->OldStyle = b; }
67
68 private:
69   cmPropertyMap Properties;
70   cmStdString Name;
71   std::vector<std::string> Command;
72
73   bool OldStyle;
74
75   cmMakefile* Makefile;
76   cmListFileBacktrace* Backtrace;
77 };
78
79 #endif
80