Game Development Reference
In-Depth Information
Listing 11-9. The Command Parameter Interface
struct IParameter
{
enum EDataType
{
eDataType_Unknown,
eDataType_Int8,
eDataType_Int16,
eDataType_Int32,
eDataType_Int64,
eDataType_Float,
eDataType_Double,
eDataType_Text,
eDataType_Handle
};
enum EDirection
{
eDirection_Input,
eDirection_Output,
eDirection_InputOutput
};
virtual ~IParameter(){}
virtual const char* GetName() const = 0;
virtual const char* GetDescription() const = 0;
virtual EDataType GetDataType() const = 0;
virtual EDirection GetDirection() const = 0;
virtual bool IsArray() const = 0;
};
The IParameter interface is implemented by the editor core DLL, so plug-in developers do not need to care
about the implementation, only what methods it provides, such as the name of the parameter, description, type,
direction (if it's an in/out parameter), and whether the parameter is an array of the type specified.
To keep the parameter information in one place, you declare an IParameterDefinitions interface, which holds
the parameter information list for a command, as seen in Listing 11-10.
Listing 11-10. The Parameter Definitions Container Interface
struct IParameterDefinitions
{
virtual size_t GetCount() const = 0;
virtual IParameter* Get(size_t aIndex) const = 0;
virtual bool Add(
const char* pName,
IParameter::EDataType aDataType,
const char* pDescription,
IParameter::EDirection aDirection,
bool bArray) = 0;
};
 
Search WWH ::




Custom Search