BindProperty function(get_lambda, set_lambda)(dbgmodel.h)

A binder which converts two lambdas to a read/write property accessor. The lambdas must hold reference on outer objects they reference through a by value capture.

Usage: BindProperty(get_lambda, set_lambda)

Syntax

Microsoft::WRL::ComPtr<IModelPropertyAccessor> BindProperty(
  const TGet & getFunctor,
  const TSet & setFunctor
);

Parameters

getFunctor

A functor of signature (PCWSTR, IModelObject *, IModelObject **) which will act as the getter for the newly created property accessor.

setFunctor

A functor of signature (PCWSTR, IModelObject *, IModelObject *) which will act as the setter for the newly created property accessor.

Return value

This function returns Microsoft::WRL::ComPtr<IModelPropertyAccessor>.

Remarks

This sample code shows usage.

// Define a native type that we wish to project into the data model
struct MyNativeType
{
    std::wstring Name;
    int Id;
    int WriteableValue;
};

// Declare a type factory for the type
class MyNativeTypeFactory : public TypedInstanceModel<MyNativeType>
{
public:
    MyNativeTypeFactory()
    {
        BindReadOnlyProperty(L"Name", &MyNativeType::Name);
        BindReadOnlyProperty(L"Id", &MyNativeType::Id);
        BindProperty(L"WriteableValue", &MyNativeType::WriteableValue);
    }
};

// Create the type factory and make an instance
MyNativeTypeFactory factory;
Object instance = factory.CreateInstance(MyNativeType { L"Foo", 42, 37 });

// There are "Name/Id" read-only properties on instance and a "WriteableValue" property.

Requirements

Requirement Value
Header dbgmodel.h

See also

Debugger Data Model C++ Overview