本文整理汇总了C++中GetFieldHandlePtr::isPointerField方法的典型用法代码示例。如果您正苦于以下问题:C++ GetFieldHandlePtr::isPointerField方法的具体用法?C++ GetFieldHandlePtr::isPointerField怎么用?C++ GetFieldHandlePtr::isPointerField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GetFieldHandlePtr
的用法示例。
在下文中一共展示了GetFieldHandlePtr::isPointerField方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: undo
void SetFieldValueCommand::undo(void)
{
Inherited::undo();
//reset the value
GetFieldHandlePtr TheFieldHandle = _FC->getField(_FieldId);
if(TheFieldHandle->getCardinality() == FieldType::SingleField)
{
if(TheFieldHandle->isPointerField())
{
FieldContainer* FC = FieldContainerFactory::the()->getContainer(boost::lexical_cast<UInt32>(_PrevValue));
dynamic_cast<EditSFieldHandle<FieldContainerPtrSFieldBase>*>(_FC->editField(_FieldId).get())->set(FC);
}
else
{
_FC->editField(_FieldId)->pushValueFromCString(_PrevValue.c_str());
}
}
else
{
if(TheFieldHandle->isPointerField())
{
FieldContainer* FC = FieldContainerFactory::the()->getContainer(boost::lexical_cast<UInt32>(_PrevValue));
dynamic_cast<EditMFieldHandle<FieldContainerPtrMFieldBase>*>(_FC->editField(_FieldId).get())->replace(_Index, FC);
}
else
{
_FC->editField(_FieldId)->pushIndexedValueFromCString(_PrevValue.c_str(), _Index);
}
}
}
示例2: internalFieldChanged
/***************************************************************************\
* Instance methods *
\***************************************************************************/
void GenericFieldEditor::internalFieldChanged (void)
{
GetFieldHandlePtr TheFieldHandle = getEditingFC()->getField(getEditingFieldId());
if(TheFieldHandle->isPointerField())
{
if(TheFieldHandle->getCardinality() == FieldType::SingleField)
{
GetSFieldHandle<FieldContainerPtrSFieldBase>* ThePtrFieldHandle(dynamic_cast<GetSFieldHandle<FieldContainerPtrSFieldBase>*>(TheFieldHandle.get()));
if(ThePtrFieldHandle->get() != NULL)
{
_EditingTextField->setText(boost::lexical_cast<std::string>(ThePtrFieldHandle->get()->getId()));
}
else
{
_EditingTextField->setText("0");
}
}
else
{
GetMFieldHandle<FieldContainerPtrMFieldBase>* ThePtrFieldHandle(dynamic_cast<GetMFieldHandle<FieldContainerPtrMFieldBase>*>(TheFieldHandle.get()));
if(ThePtrFieldHandle->size() > getEditingFieldIndex() &&
ThePtrFieldHandle->get(getEditingFieldIndex()) != NULL)
{
_EditingTextField->setText(boost::lexical_cast<std::string>(ThePtrFieldHandle->get(getEditingFieldIndex())->getId()));
}
else
{
_EditingTextField->setText("0");
}
}
}
else
{
std::ostringstream StrStream;
OutStream TheOutStream(StrStream);
if(TheFieldHandle->getCardinality() == FieldType::SingleField)
{
TheFieldHandle->pushValueToStream(TheOutStream);
}
else
{
TheFieldHandle->pushIndexedValueToStream(TheOutStream, getEditingFieldIndex());
}
//Remove quotes from strings
if(TheFieldHandle->getType().getContentType() == FieldTraits<std::string>::getType())
{
_EditingTextField->setText(StrStream.str().substr(1,StrStream.str().size()-2));
}
else
{
_EditingTextField->setText(StrStream.str());
}
}
}
示例3: isSignificant
bool SetFieldValueCommand::isSignificant(void) const
{
GetFieldHandlePtr TheFieldHandle = _FC->getField(_FieldId);
if(TheFieldHandle->isPointerField())
{
return _PrevPtrValue != _PtrValue;
}
else
{
return _Value.compare(_PrevValue) != 0;
}
}
示例4: deepClone
FieldContainerTransitPtr deepClone(
OSG::FieldContainer const *src,
const std::vector<const OSG::ReflexiveContainerType *> &shareTypes,
const std::vector<const OSG::ReflexiveContainerType *> &ignoreTypes,
const std::vector<OSG::UInt16> &shareGroupIds,
const std::vector<OSG::UInt16> &ignoreGroupIds)
{
if(src == NULL)
return FieldContainerTransitPtr(NULL);
const FieldContainerType &fcType = src->getType();
FieldContainerTransitPtr fcClone = fcType.createContainer();
UInt32 fCount = osgMin(fcType .getNumFieldDescs(),
fcClone->getType().getNumFieldDescs() );
for(UInt32 i = 1; i <= fCount; ++i)
{
const FieldDescriptionBase *fDesc = fcType.getFieldDesc(i);
if(fDesc->isInternal())
continue;
GetFieldHandlePtr srcField = src ->getField (i);
EditFieldHandlePtr dstField = fcClone->editField(i);
if(dstField == NULL || dstField->isValid() == false ||
srcField == NULL || srcField->isValid() == false)
{
continue;
}
if(srcField->isPointerField() == false)
{
dstField->copyValues(srcField);
}
else
{
dstField->cloneValues(srcField,
shareTypes,
ignoreTypes,
shareGroupIds,
ignoreGroupIds);
}
}
return fcClone;
}
示例5: 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()
//.........这里部分代码省略.........