Skip to content

Commit

Permalink
Add assignment operator
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Mar 10, 2024
1 parent 6f63b70 commit 08cbf57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmEnumField.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ class PdmEnumField : public PdmValueField

T value() const { return m_fieldValue; }

// Required to be able to assign a class enum to a PdmEnumField
PdmEnumField& operator=( T value )
{
m_fieldValue = value;
return *this;
}

private:
caf::AppEnum<T> m_fieldValue;
};
Expand Down
2 changes: 2 additions & 0 deletions Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,8 @@ class SmallDemoPdmObjectA : public caf::PdmObject
"" );

CAF_PDM_InitFieldNoDefault( &m_testEnumField, "TestAppEnumValue", "AppEnum Field" );
m_testEnumField = TestEnumType::T2;

CAF_PDM_InitFieldNoDefault( &m_ptrField, "m_ptrField", "PtrField", "", "", "" );

CAF_PDM_InitFieldNoDefault( &m_proxyEnumField, "ProxyEnumValue", "ProxyEnum", "", "", "" );
Expand Down

0 comments on commit 08cbf57

Please sign in to comment.