SECondition.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4#pragma once
6
7class CDM_DECL SECondition : public Loggable
8{
9 friend class PBCondition;//friend the serialization class
10public:
11
12 SECondition(Logger* logger);
13 virtual ~SECondition();
14
15 virtual std::string GetName() const = 0;
16 static constexpr char const* ConditionType = "Condition";
17 virtual std::string GetConditionType() const { return ConditionType; }
18
19 virtual void Clear();
20
21 virtual bool SerializeToString(std::string& dst, eSerializationFormat fmt) const;
22 static SECondition* SerializeFromString(const std::string src, eSerializationFormat fmt, const SESubstanceManager& subMgr);
23
24 virtual bool IsValid() const = 0;
25 virtual bool IsActive() const = 0;
26 virtual void Activate() { }
27
28 virtual std::string GetComment() const;
29 virtual void SetComment(const std::string& comment);
30 virtual bool HasComment()const;
31 virtual void InvalidateComment();
32
33 static std::string PrettyPrint(const std::string& str);
34
35 virtual std::string ToJSON() const;
36 virtual std::string ToString() const;
37
38protected:
39
40 std::string m_Comment;
41};
42
43inline std::ostream& operator<< (std::ostream& out, const SECondition& c)
44{
45 out << c.ToString();
46 return out;
47}
Definition: Logger.h:23
Definition: Logger.h:71
Definition: PBConditions.h:10
static SECondition * SerializeFromString(const std::string &src, eSerializationFormat fmt, const SESubstanceManager &subMgr)
Definition: PBConditions.cpp:67
static bool SerializeToString(const SECondition &c, std::string &output, eSerializationFormat fmt=eSerializationFormat::JSON)
Definition: PBConditions.cpp:62
Definition: SECondition.h:8
virtual bool IsActive() const =0
virtual void Activate()
Definition: SECondition.h:26
virtual std::string GetName() const =0
virtual std::string ToString() const
Definition: SECondition.cpp:59
std::string m_Comment
Definition: SECondition.h:40
virtual std::string GetConditionType() const
Definition: SECondition.h:17
virtual bool IsValid() const =0
Definition: SESubstanceManager.h:9

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.