Rhino C++ API  8.13
Classes | Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
CRhRdkContentField Class Reference

#include <RhRdkContentField.h>

Inheritance diagram for CRhRdkContentField:
CRhRdkDynamicContentField CRhRdkFilenameContentField CRhRdkSolarContentField CRhRdkTexturedContentField

Classes

class  CChangeInfo
 

Public Types

enum  : unsigned int { conv_none = 0x0000, conv_percentile = 0x0001, conv_one_minus = 0x0002, conv_radians = 0x0004 }
 
typedef Filter eFilter
 
enum  Filter : unsigned int {
  None = 0x00, Serialization = 0x01, Harvesting = 0x02, Rendering = 0x04,
  All = 0xFF
}
 

Public Member Functions

 CRhRdkContentField (CRhRdkContent &c, const wchar_t *wszInternalName, const wchar_t *wszFriendlyName, eFilter setFilter=All, eFilter getFilter=All, INT_PTR reserved=0)
 
 CRhRdkContentField (CRhRdkContent &c, const wchar_t *wszInternalName, const wchar_t *wszLocalName, const wchar_t *wszEnglishName, Filter setFilter=All, Filter getFilter=All, int sectionId=0, bool bDynamic=false, INT_PTR reserved=0)
 
virtual ~CRhRdkContentField ()
 
const void * AsBuffer (size_t &sizeOut) const
 
void * AsPointer (void) const
 
virtual CRhRdkContentContent (void) const
 
virtual UINT Conversion (void) const
 
virtual CRhRdkVariant ConvertFromDisplay (const CRhRdkVariant &v) const
 
virtual CRhRdkVariant ConvertToDisplay (const CRhRdkVariant &v) const
 
virtual ON_wString EnglishName (void) const
 
virtual void * EVF (const wchar_t *, void *)
 
virtual RDK_DEPRECATED ON_wString FriendlyName (void) const
 
virtual Filter GetFilter (void) const
 
virtual bool GetLimits (CRhRdkVariant &vMin, CRhRdkVariant &vMax) const
 
virtual void GetValueFromSection (const IRhRdk_XMLSection &section)
 
void Initialize (const CRhRdkVariant &v)
 
virtual ON_wString InternalName (void) const
 
bool IsDynamic (void) const
 
bool IsHiddenInAutoUI (void) const
 
virtual ON_wString LocalName (void) const
 
virtual CRhRdkContentFieldMakeCopy (CRhRdkContent &) const
 
 operator bool (void) const
 
 operator const wchar_t * (void) const
 
 operator CRhRdkColor (void) const
 
 operator CRhRdkVariant (void) const
 
 operator double (void) const
 
 operator float (void) const
 
 operator int (void) const
 
 operator ON_2dVector (void) const
 
 operator ON_3dVector (void) const
 
 operator ON_4dPoint (void) const
 
 operator ON_Color (void) const
 
 operator ON_Xform (void) const
 
 operator time_t (void) const
 
 operator UUID (void) const
 
bool operator!= (const CRhRdkContentField &v) const
 
bool operator< (const CRhRdkContentField &v) const
 
const CRhRdkContentFieldoperator= (bool b)
 
const CRhRdkContentFieldoperator= (const char *sz)
 
const CRhRdkContentFieldoperator= (const CRhRdkContentField &f)
 
const CRhRdkContentFieldoperator= (const CRhRdkVariant &v)
 
const CRhRdkContentFieldoperator= (const ON_2dVector &v)
 
const CRhRdkContentFieldoperator= (const ON_3dVector &v)
 
const CRhRdkContentFieldoperator= (const ON_4dPoint &p)
 
const CRhRdkContentFieldoperator= (const ON_Color &c)
 
const CRhRdkContentFieldoperator= (const ON_Xform &xform)
 
const CRhRdkContentFieldoperator= (const time_t &time)
 
const CRhRdkContentFieldoperator= (const UUID &uuid)
 
const CRhRdkContentFieldoperator= (const wchar_t *wsz)
 
const CRhRdkContentFieldoperator= (double d)
 
const CRhRdkContentFieldoperator= (float f)
 
const CRhRdkContentFieldoperator= (int i)
 
const CRhRdkContentFieldoperator= (void *p)
 
bool operator== (const CRhRdkContentField &v) const
 
bool operator> (const CRhRdkContentField &v) const
 
virtual int SectionId (void) const
 
virtual void SetConversion (UINT uFlags)
 
virtual Filter SetFilter (void) const
 
void SetIsHiddenInAutoUI (bool bHidden)
 
virtual bool SetLimits (const CRhRdkVariant &vMin, const CRhRdkVariant &vMax)
 
virtual bool SetValue (const CRhRdkVariant &vNewValue)
 
virtual RDK_DEPRECATED bool SetValue (const CRhRdkVariant &vNewValue, CRhRdkContent::eChangeContext cc)
 
virtual void SetValueToSection (IRhRdk_XMLSection &section) const
 
virtual ON_wString UndoString (void) const
 
virtual const CRhRdkVariantValue (void) const
 

Protected Member Functions

CImpl & Impl (void) const
 
CRhRdkContentFieldNewField (CRhRdkContent &c) const
 

Friends

class CRhRdkContentFields
 
class CRhRdkDynamicContentFieldManager
 

Detailed Description

RDK content fields are essentially smart variants which have an internal name and local name and English name along with the usual variant data. By using fields to store your content's data items instead of using plain bools, floats and so on, you get automatic parameter undo support, support for transferring to and from IRhRdk_XMLSection and a few other features that should reduce the amount of work involved in implementing your content.

If you want to use fields to store your content's data items, you must make sure it overrides BitFlags() and sets the bfFields flag.

See also
CRhRdkContent.
CRhRdkContentFields.
CRhRdkContent::BitFlags().
CRhRdkContent::SetParameter().
CRhRdkContent::GetParameter().

Member Typedef Documentation

◆ eFilter

This constructor is deprecated in favor of the one below.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : unsigned int
Enumerator
conv_none 
conv_percentile 
conv_one_minus 
conv_radians 

◆ Filter

enum CRhRdkContentField::Filter : unsigned int
Enumerator
None 
Serialization 
Harvesting 
Rendering 
All 

Constructor & Destructor Documentation

◆ CRhRdkContentField() [1/2]

CRhRdkContentField::CRhRdkContentField ( CRhRdkContent c,
const wchar_t *  wszInternalName,
const wchar_t *  wszFriendlyName,
eFilter  setFilter = All,
eFilter  getFilter = All,
INT_PTR  reserved = 0 
)

◆ CRhRdkContentField() [2/2]

CRhRdkContentField::CRhRdkContentField ( CRhRdkContent c,
const wchar_t *  wszInternalName,
const wchar_t *  wszLocalName,
const wchar_t *  wszEnglishName,
Filter  setFilter = All,
Filter  getFilter = All,
int  sectionId = 0,
bool  bDynamic = false,
INT_PTR  reserved = 0 
)

Fields are always constructed the same way. After construction they are null and must be initialized to a type/value before use by using an assignment operator or the Initialize() method.

Parameters
cis the content that the field belongs to.
wszInternalNameis the internal name of the field. Not localized.
wszLocalNameis the localized user-friendly name of the field.
wszEnglishNameis the English user-friendly name of the field.
setFilteris a filter for use during CRhRdkContentFields::SetValuesToSection(). The field is skipped if setFilter does not match at least one item in the call's filter.
getFilteris a filter for use during CRhRdkContentFields::GetValuesFromSection(). The field is skipped if getFilter does not match at least one item in the call's filter.
sectionIdis used for filtering fields between sections. Zero if not needed.
bDynamicindicates that this field is dynamic.
See also
IsDynamic()
Parameters
reservedis reserved for future use. Must be zero.

◆ ~CRhRdkContentField()

virtual CRhRdkContentField::~CRhRdkContentField ( )
virtual

Member Function Documentation

◆ AsBuffer()

const void* CRhRdkContentField::AsBuffer ( size_t &  sizeOut) const

Retrieve the value as a buffer.

◆ AsPointer()

void* CRhRdkContentField::AsPointer ( void  ) const

Retrieve the value as a pointer.

◆ Content()

virtual CRhRdkContent& CRhRdkContentField::Content ( void  ) const
virtual
Returns
The content that this field belongs to.

◆ Conversion()

virtual UINT CRhRdkContentField::Conversion ( void  ) const
virtual

Get the conversion that describes how the field should be displayed.

◆ ConvertFromDisplay()

virtual CRhRdkVariant CRhRdkContentField::ConvertFromDisplay ( const CRhRdkVariant v) const
virtual

Converts to a field value from a display value using the conversion.

◆ ConvertToDisplay()

virtual CRhRdkVariant CRhRdkContentField::ConvertToDisplay ( const CRhRdkVariant v) const
virtual

Converts from a field value to a display value using the conversion.

◆ EnglishName()

virtual ON_wString CRhRdkContentField::EnglishName ( void  ) const
virtual
Returns
The English friendly name of the field.

◆ EVF()

virtual void* CRhRdkContentField::EVF ( const wchar_t *  ,
void *   
)
virtual

Emergency virtual function for future expansion.

Reimplemented in CRhRdkSolarContentField, CRhRdkFilenameContentField, CRhRdkTexturedContentField, and CRhRdkDynamicContentField.

◆ FriendlyName()

virtual RDK_DEPRECATED ON_wString CRhRdkContentField::FriendlyName ( void  ) const
virtual
Returns
The localized friendly name of the field. Deprecated in favor of LocalName().

◆ GetFilter()

virtual Filter CRhRdkContentField::GetFilter ( void  ) const
virtual

The 'get filter' is a filter for use during CRhRdkContentFields::GetValuesFromSection(). The field is skipped if this filter does not match at least one item in the call's filter.

◆ GetLimits()

virtual bool CRhRdkContentField::GetLimits ( CRhRdkVariant vMin,
CRhRdkVariant vMax 
) const
virtual

Get the limits that the field value should be within.

Parameters
vMinaccepts the minimum value.
vMaxaccepts the maximum value.
Note
If SetLimits() has not been called, both results will be null.
See also
SetLimits().
Returns
true if successful, else false.

◆ GetValueFromSection()

virtual void CRhRdkContentField::GetValueFromSection ( const IRhRdk_XMLSection section)
virtual

Get a value from a section into the field if the value, as specified by the field's internal name, is in the section. Does not create an undo record or call CRhRdkContent::Changed().

◆ Impl()

CImpl& CRhRdkContentField::Impl ( void  ) const
protected

◆ Initialize()

void CRhRdkContentField::Initialize ( const CRhRdkVariant v)

Initialize the field's variant directly from a variant.

◆ InternalName()

virtual ON_wString CRhRdkContentField::InternalName ( void  ) const
virtual
Returns
The internal name of the field.

◆ IsDynamic()

bool CRhRdkContentField::IsDynamic ( void  ) const

Fields are traditionally static and embedded in the content as member variables. Static fields are created when the content is created and deleted when the content is deleted; they are owned by the content. Static fields are expected to exist when the content is created and they can load themselves from XML. Dynamic fields on the other hand do not exist until they are loaded, either from XML or by some other means (e.g., a content I/O plug-in), or until they are added by an override of Initialize(). Dynamic fields are owned by the CRhRdkContentFields collection.

Returns
true if the field is dynamic.

◆ IsHiddenInAutoUI()

bool CRhRdkContentField::IsHiddenInAutoUI ( void  ) const

When fields are used by the automatic UI, they can be hidden from it by calling SetIsHidden(). This method returns the hidden state for when the field is used in the automatic UI.

◆ LocalName()

virtual ON_wString CRhRdkContentField::LocalName ( void  ) const
virtual
Returns
The localized friendly name of the field.

◆ MakeCopy()

virtual CRhRdkContentField* CRhRdkContentField::MakeCopy ( CRhRdkContent ) const
virtual

Return an exact copy of this field, with the same value and type.

Reimplemented in CRhRdkTexturedContentField, and CRhRdkDynamicContentField.

◆ NewField()

CRhRdkContentField* CRhRdkContentField::NewField ( CRhRdkContent c) const
protected

◆ operator bool()

CRhRdkContentField::operator bool ( void  ) const

Retrieve the value as a boolean.

◆ operator const wchar_t *()

CRhRdkContentField::operator const wchar_t * ( void  ) const

Retrieve the value as a wide string.

◆ operator CRhRdkColor()

CRhRdkContentField::operator CRhRdkColor ( void  ) const

Retrieve the value as a CRhRdkColor.

◆ operator CRhRdkVariant()

CRhRdkContentField::operator CRhRdkVariant ( void  ) const

Get the value of the field.

◆ operator double()

CRhRdkContentField::operator double ( void  ) const

Retrieve the value as a double.

◆ operator float()

CRhRdkContentField::operator float ( void  ) const

Retrieve the value as a float.

◆ operator int()

CRhRdkContentField::operator int ( void  ) const

Retrieve the value as an integer.

◆ operator ON_2dVector()

CRhRdkContentField::operator ON_2dVector ( void  ) const

Retrieve the value as a 2 dimensional vector.

◆ operator ON_3dVector()

CRhRdkContentField::operator ON_3dVector ( void  ) const

Retrieve the value as a 3 dimensional vector.

◆ operator ON_4dPoint()

CRhRdkContentField::operator ON_4dPoint ( void  ) const

Retrieve the value as a 4 dimensional point..

◆ operator ON_Color()

CRhRdkContentField::operator ON_Color ( void  ) const

Retrieve the value as an ON_Color.

◆ operator ON_Xform()

CRhRdkContentField::operator ON_Xform ( void  ) const

Retrieve the value as a matrix.

◆ operator time_t()

CRhRdkContentField::operator time_t ( void  ) const

Retrieve the value as a time. Null or varying returns zero time.

◆ operator UUID()

CRhRdkContentField::operator UUID ( void  ) const

Retrieve the value as a UUID.

◆ operator!=()

bool CRhRdkContentField::operator!= ( const CRhRdkContentField v) const

Inequality check.

◆ operator<()

bool CRhRdkContentField::operator< ( const CRhRdkContentField v) const

Less-than check.

◆ operator=() [1/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( bool  b)

Assign from a boolean.

◆ operator=() [2/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( const char *  sz)

Assign from a string.

◆ operator=() [3/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( const CRhRdkContentField f)

Copy the field value. The type must be null or the same as the type of 'f'.

◆ operator=() [4/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( const CRhRdkVariant v)

Assign from another variant.

◆ operator=() [5/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( const ON_2dVector v)

Assign from a 2 dimensional vector.

◆ operator=() [6/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( const ON_3dVector v)

Assign from a 3 dimensional vector.

◆ operator=() [7/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( const ON_4dPoint p)

Assign from a 4 dimensional point.

◆ operator=() [8/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( const ON_Color c)

Assign from a color.

◆ operator=() [9/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( const ON_Xform xform)

Assign from a matrix.

◆ operator=() [10/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( const time_t &  time)

Assign from a time.

◆ operator=() [11/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( const UUID &  uuid)

Assign from a UUID.

◆ operator=() [12/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( const wchar_t *  wsz)

Assign from a wide string.

◆ operator=() [13/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( double  d)

Assign from a double.

◆ operator=() [14/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( float  f)

Assign from a float.

◆ operator=() [15/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( int  i)

Assign from an integer.

◆ operator=() [16/16]

const CRhRdkContentField& CRhRdkContentField::operator= ( void *  p)

Assign from a pointer. The field treats the pointer as an opaque 32-bit value.

◆ operator==()

bool CRhRdkContentField::operator== ( const CRhRdkContentField v) const

Equality check.

◆ operator>()

bool CRhRdkContentField::operator> ( const CRhRdkContentField v) const

Greater-than check.

◆ SectionId()

virtual int CRhRdkContentField::SectionId ( void  ) const
virtual

Get the automatic UI section id for this field.

◆ SetConversion()

virtual void CRhRdkContentField::SetConversion ( UINT  uFlags)
virtual

Set the conversion that describes how the field should be displayed.

◆ SetFilter()

virtual Filter CRhRdkContentField::SetFilter ( void  ) const
virtual

The 'set filter' is a filter for use during CRhRdkContentFields::SetValuesToSection(). The field is skipped if this filter does not match at least one item in the call's filter.

◆ SetIsHiddenInAutoUI()

void CRhRdkContentField::SetIsHiddenInAutoUI ( bool  bHidden)

When fields are used by the automatic UI, they can be hidden from it by calling this method.

◆ SetLimits()

virtual bool CRhRdkContentField::SetLimits ( const CRhRdkVariant vMin,
const CRhRdkVariant vMax 
)
virtual

Set the limits that the field value should be within.

Parameters
vMinis the minimum value.
vMaxis the maximum value.
Returns
true if successful, else false.

◆ SetValue() [1/2]

virtual bool CRhRdkContentField::SetValue ( const CRhRdkVariant vNewValue)
virtual

Set the value of the field. If the value changes, this may create an undo record and it will call CRhRdkContent::Changed() and return true. Otherwise it will return false.

Parameters
vNewValueis the value to set into the field.
Returns
true if value was changed, false if not changed because it wasn't different.

◆ SetValue() [2/2]

virtual RDK_DEPRECATED bool CRhRdkContentField::SetValue ( const CRhRdkVariant vNewValue,
CRhRdkContent::eChangeContext  cc 
)
virtual

This method is deprecated in favor of the one below.

◆ SetValueToSection()

virtual void CRhRdkContentField::SetValueToSection ( IRhRdk_XMLSection section) const
virtual

Set a value into a section using the field's internal name.

Reimplemented in CRhRdkFilenameContentField.

◆ UndoString()

virtual ON_wString CRhRdkContentField::UndoString ( void  ) const
virtual
Returns
The string used when recording undo for the field.

◆ Value()

virtual const CRhRdkVariant& CRhRdkContentField::Value ( void  ) const
virtual
Returns
The value of the field.

Reimplemented in CRhRdkFilenameContentField.

Friends And Related Function Documentation

◆ CRhRdkContentFields

friend class CRhRdkContentFields
friend

◆ CRhRdkDynamicContentFieldManager

friend class CRhRdkDynamicContentFieldManager
friend