本文整理汇总了C++中GetFieldHandlePtr::size方法的典型用法代码示例。如果您正苦于以下问题:C++ GetFieldHandlePtr::size方法的具体用法?C++ GetFieldHandlePtr::size怎么用?C++ GetFieldHandlePtr::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GetFieldHandlePtr
的用法示例。
在下文中一共展示了GetFieldHandlePtr::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: changed
//.........这里部分代码省略.........
}
else
{
SWARNING << "There is no Field Container defined to Animate" << std::endl;
return;
}
}
else if((whichField & FieldIdFieldMask) ||
(whichField & ContainerFieldMask))
{
if(getContainer() != NULL)
{
FieldDescriptionBase * f = getContainer()->getFieldDescription(getFieldId());
if( f == NULL )
{
SWARNING << "Could not find Field ID"<< getFieldId() << " in Field Container " << getContainer()->getTypeName() << std::endl;
return;
}
else
{
if(getAnimator()->getDataType() == NULL)
{
SWARNING << "Cannot update animation, because the animator attached to this animation does not work on any data types." << std::endl;
return;
}
//Check if it's the right type
if(getContainer()->getFieldDescription(getFieldId())->getFieldType().getContentType()
!= *getAnimator()->getDataType())
{
SWARNING << "The data type of the field: "
<< getContainer()->getFieldDescription(getFieldId())->getName()
<< " with type: "
<< getContainer()->getFieldDescription(getFieldId())->getFieldType().getContentType().getCName()
<< " connected to this animation is not the same data type: "
<< getAnimator()->getDataType()->getCName()
<< ", that the animator works on." << std::endl;
return;
}
}
}
else
{
SWARNING << "There is no Field Container defined to Animate" << std::endl;
return;
}
}
if(whichField & IndexFieldMask)
{
if(getContainer() != NULL)
{
FieldDescriptionBase * f = getContainer()->getFieldDescription(getFieldId());
if( f == NULL )
{
SWARNING << "Could not find Field ID"<< getFieldId() << " in Field Container " << getContainer()->getTypeName() << std::endl;
}
else
{
//Check if animator supports any types
if(getAnimator()->getDataType() == NULL)
{
SWARNING << "Cannot update animation, because the animator attached to this animation does not work on any data types." << std::endl;
}
//Check if it's the right type
if(getContainer()->getFieldDescription(getFieldId())->getFieldType().getContentType()
!= *getAnimator()->getDataType())
{
SWARNING << "The data type of the field: "
<< getContainer()->getFieldDescription(getFieldId())->getName()
<< " with type: "
<< getContainer()->getFieldDescription(getFieldId())->getFieldType().getContentType().getCName()
<< " connected to this animation is not the same data type: "
<< getAnimator()->getDataType()->getCName()
<< ", that the animator works on." << std::endl;
}
GetFieldHandlePtr TheFieldHandle = getContainer()->getField( getFieldId() );
if( getIndex() > 0 )
{
if(TheFieldHandle->getCardinality() != FieldType::MultiField)
{
SWARNING << "Cannot attach to index: " << getIndex()
<< " of field " << getContainer()->getFieldDescription(getFieldId())->getName()
<< " because it has cardinality 1." << std::endl;
}
else if(getIndex() < TheFieldHandle->size())
{
SWARNING << "Cannot attach to index: " << getIndex()
<< " of field " << getContainer()->getFieldDescription(getFieldId())->getName()
<< " because that index is out of bounds on a field of size " << TheFieldHandle->size() << "." << std::endl;
}
}
}
}
else
{
SWARNING << "There is no Field Container defined to Animate" << std::endl;
}
}
}
示例2: execute
void SetFieldValueCommand::execute(void)
{
//Check for a valid Field Container
if(_FC == NULL)
{
SWARNING << "FieldContainer is NULL." << std::endl;
return;
}
//Check for valid Field
GetFieldHandlePtr TheFieldHandle = _FC->getField(_FieldId);
if(!TheFieldHandle->isValid())
{
SWARNING << "No Field with Id: " << _FieldId << " in FieldContainers of type " << _FC->getType().getName() << std::endl;
return;
}
//Check for valid indexing
if(TheFieldHandle->getCardinality() == FieldType::SingleField && _Index != 0)
{
SWARNING << "Cannot reference index " << _Index << ", on field " << TheFieldHandle->getDescription()->getName()
<< ", on FieldContianer of type " << _FC->getType().getName()
<< " because that field is a SingleField." << std::endl;
return;
}
else if(TheFieldHandle->getCardinality() == FieldType::MultiField && _Index >= TheFieldHandle->size())
{
SWARNING << "Cannot set the value of index " << _Index << ", on field " << TheFieldHandle->getDescription()->getName()
<< ", on FieldContianer of type " << _FC->getType().getName()
<< " because that field has size " << TheFieldHandle->size() << std::endl;
return;
}
//Get the previous value
if(_PrevValue.empty())
{
std::ostringstream StrStream;
OutStream TheOutStream(StrStream);
if(TheFieldHandle->getCardinality() == FieldType::SingleField)
{
if(TheFieldHandle->isPointerField())
{
_PrevPtrValue = dynamic_cast<GetSFieldHandle<FieldContainerPtrSFieldBase>*>(TheFieldHandle.get())->get();
if(dynamic_cast<GetSFieldHandle<FieldContainerPtrSFieldBase>*>(TheFieldHandle.get())->get())
{
_PrevValue = boost::lexical_cast<std::string>(dynamic_cast<GetSFieldHandle<FieldContainerPtrSFieldBase>*>(TheFieldHandle.get())->get()->getId());
}
else
{
_PrevValue = "0";
}
}
else
{
TheFieldHandle->pushValueToStream(TheOutStream);
_PrevValue = StrStream.str();
}
}
else
{
if(TheFieldHandle->isPointerField())
{
_PrevPtrValue = dynamic_cast<GetMFieldHandle<FieldContainerPtrMFieldBase>*>(TheFieldHandle.get())->get(_Index);
if(_PrevPtrValue)
{
_PrevValue = boost::lexical_cast<std::string>(dynamic_cast<GetMFieldHandle<FieldContainerPtrMFieldBase>*>(TheFieldHandle.get())->get(_Index)->getId());
}
else
{
_PrevValue = "0";
}
}
else
{
TheFieldHandle->pushIndexedValueToStream(TheOutStream, _Index);
_PrevValue = StrStream.str();
}
}
//Remove quotes from strings
if(TheFieldHandle->getType().getContentType() == FieldTraits<std::string>::getType())
{
_PrevValue = _PrevValue.substr(1,StrStream.str().size()-2);
}
}
//Set the value
if(TheFieldHandle->getCardinality() == FieldType::SingleField)
{
if(TheFieldHandle->isPointerField())
{
_PtrValue = FieldContainerFactory::the()->getContainer(boost::lexical_cast<UInt32>(_Value));
//Check the pointer types match
if(_PtrValue != NULL &&
!isFieldContentDerivedFrom(TheFieldHandle->getType(),&_PtrValue->getType()))
{
SWARNING << "Cannot set the value of field " << TheFieldHandle->getDescription()->getName()
<< ", on FieldContianer of type " << _FC->getType().getName()
//.........这里部分代码省略.........