1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
2 
3 #ifndef SKIRMISH_AI_KEY_H
4 #define SKIRMISH_AI_KEY_H
5 
6 // this is needed when compiling with MinGW,
7 // cause it has interface defined somewhere in its base files
8 // it is not needed on GCC eg.
9 #ifdef interface
10 #undef interface
11 #endif
12 
13 #include "AIInterfaceKey.h"
14 
15 #include "System/creg/creg_cond.h"
16 #include <string>
17 
18 
19 /**
20  * Used to uniquely identify a Skirmish AI within the engine.
21  */
22 class SkirmishAIKey {
23 	CR_DECLARE_STRUCT(SkirmishAIKey)
24 
25 public:
26 	SkirmishAIKey(
27 			const std::string& shortName = "",
28 			const std::string& version = "",
29 			const AIInterfaceKey& interface = AIInterfaceKey());
30 	SkirmishAIKey(const SkirmishAIKey& base, const AIInterfaceKey& interface);
31 	SkirmishAIKey(const SkirmishAIKey& toCopy);
32 	~SkirmishAIKey();
33 
34 	const std::string& GetShortName() const;
35 	const std::string& GetVersion() const;
36 	const AIInterfaceKey& GetInterface() const;
37 
38 	bool IsUnspecified() const;
39 	bool IsFullySpecified() const;
40 	std::string ToString() const;
41 
42 	bool operator==(const SkirmishAIKey& otherKey) const;
43 	bool operator!=(const SkirmishAIKey& otherKey) const;
44 	bool operator<(const SkirmishAIKey& otherKey) const;
45 	bool operator>(const SkirmishAIKey& otherKey) const;
46 	bool operator<=(const SkirmishAIKey& otherKey) const;
47 	bool operator>=(const SkirmishAIKey& otherKey) const;
48 
49 private:
50 	bool isEqual(const SkirmishAIKey& otherKey) const;
51 	bool isLessThen(const SkirmishAIKey& otherKey) const;
52 
53 	std::string shortName;
54 	std::string version;
55 	AIInterfaceKey interface;
56 };
57 
58 #endif // SKIRMISH_AI_KEY_H
59