0feaedf33f35e8b0ee42e4e02cf2e1008ee6a3fe
[platform/upstream/cmake.git] / Source / cmExecutionStatus.h
1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    file Copyright.txt or https://cmake.org/licensing for details.  */
3 #pragma once
4
5 #include <cmConfigure.h> // IWYU pragma: keep
6
7 #include <string>
8
9 class cmMakefile;
10
11 /** \class cmExecutionStatus
12  * \brief Superclass for all command status classes
13  *
14  * when a command is involked it may set values on a command status instance
15  */
16 class cmExecutionStatus
17 {
18 public:
19   cmExecutionStatus(cmMakefile& makefile)
20     : Makefile(makefile)
21     , Error("unknown error.")
22   {
23   }
24
25   cmMakefile& GetMakefile() { return this->Makefile; }
26
27   void SetError(std::string const& e) { this->Error = e; }
28   std::string const& GetError() const { return this->Error; }
29
30   void SetReturnInvoked() { this->ReturnInvoked = true; }
31   bool GetReturnInvoked() const { return this->ReturnInvoked; }
32
33   void SetBreakInvoked() { this->BreakInvoked = true; }
34   bool GetBreakInvoked() const { return this->BreakInvoked; }
35
36   void SetContinueInvoked() { this->ContinueInvoked = true; }
37   bool GetContinueInvoked() const { return this->ContinueInvoked; }
38
39   void SetNestedError() { this->NestedError = true; }
40   bool GetNestedError() const { return this->NestedError; }
41
42 private:
43   cmMakefile& Makefile;
44   std::string Error;
45   bool ReturnInvoked = false;
46   bool BreakInvoked = false;
47   bool ContinueInvoked = false;
48   bool NestedError = false;
49 };