3ds Max C++ API Reference
Loading...
Searching...
No Matches
IParamBlock2::ParameterIterator Class Reference

Provides standard C++ iteration functionality for the parameters stored by an IParamBlock2. More...

#include <C:/adskgit/3dsmax/3dsmax/3dswin/src/maxsdk/include/iparamb2.h>

Public Member Functions

 ParameterIterator (IParamBlock2 &param_block, const unsigned int parameter_index)
 Constructs an iterator for the given parameter index of the given parameter block.
const ParamDefoperator* () const
 Dereferences the iterator, returning a ParamDef.
ParameterIteratoroperator++ ()
ParameterIterator operator++ (int)
bool operator== (const ParameterIterator &rhs) const
bool operator!= (const ParameterIterator &rhs) const

Detailed Description

Provides standard C++ iteration functionality for the parameters stored by an IParamBlock2.

Iterator Validity
The iterator remains valid if parameters are either added or removed from the parameter block, but will continue referring to the same parameter index, and therefore may fall out of bounds in the process.
See also
IParamBlock2::begin(), IParamBlock2::end()

Constructor & Destructor Documentation

◆ ParameterIterator()

ParameterIterator ( IParamBlock2 & param_block,
const unsigned int parameter_index )
inline

Constructs an iterator for the given parameter index of the given parameter block.

253 : m_param_block(&param_block),
254 m_num_params(std::max(param_block.NumParams(), 0)),
255 m_parameter_index(std::min(parameter_index, m_num_params))
256{
257}
virtual int NumParams()=0

Member Function Documentation

◆ operator*()

const ParamDef & operator* ( ) const
inline

Dereferences the iterator, returning a ParamDef.

Like standard C++ iterators, this should not be called on out-of-bounds iterators.

260{
261 DbgAssert(m_parameter_index < m_num_params);
262 const ParamDef* param_def = m_param_block->GetParamDefByIndex(m_parameter_index);
263 // The parameter should never be null if the parameter index is valid. The caller should never try to dereference
264 // this iterator if the parameter index is out of bounds.
265 DbgAssert(param_def != nullptr);
266 return *param_def;
267}
#define DbgAssert(expr)
Definition assert1.h:83

◆ operator++() [1/2]

IParamBlock2::ParameterIterator & operator++ ( )
inline
270{
271 if(DbgVerify(m_parameter_index < m_num_params))
272 {
273 ++m_parameter_index;
274 }
275 return *this;
276}
#define DbgVerify(expr)
Definition assert1.h:85

◆ operator++() [2/2]

IParamBlock2::ParameterIterator operator++ ( int )
inline
279{
280 ParameterIterator ret = *this;
281 if(DbgVerify(m_parameter_index < m_num_params))
282 {
283 ++m_parameter_index;
284 }
285 return ret;
286}
ParameterIterator(IParamBlock2 &param_block, const unsigned int parameter_index)
Constructs an iterator for the given parameter index of the given parameter block.
Definition iparamb2.inline.h:252

◆ operator==()

bool operator== ( const ParameterIterator & rhs) const
inline
289{
290 return (m_param_block == rhs.m_param_block) && (m_parameter_index == rhs.m_parameter_index);
291}

◆ operator!=()

bool operator!= ( const ParameterIterator & rhs) const
inline
294{
295 return !(*this == rhs);
296}