1 /* 2 * Copyright 2015, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef CONDITIONS_H 6 #define CONDITIONS_H 7 8 9 #include <String.h> 10 11 12 class BMessage; 13 14 15 class ConditionContext { 16 public: 17 virtual bool IsSafeMode() const = 0; 18 virtual bool BootVolumeIsReadOnly() const = 0; 19 }; 20 21 22 class Condition { 23 public: 24 Condition(); 25 virtual ~Condition(); 26 27 virtual bool Test(ConditionContext& context) const = 0; 28 29 /*! Determines whether or not the result of this condition is fixed, 30 and will not change anymore. 31 */ 32 virtual bool IsConstant(ConditionContext& context) const; 33 34 virtual BString ToString() const = 0; 35 }; 36 37 38 class Conditions { 39 public: 40 static Condition* FromMessage(const BMessage& message); 41 static Condition* AddNotSafeMode(Condition* condition); 42 }; 43 44 45 #endif // CONDITIONS_H 46