本文整理汇总了C++中iecore::InternedString::value方法的典型用法代码示例。如果您正苦于以下问题:C++ InternedString::value方法的具体用法?C++ InternedString::value怎么用?C++ InternedString::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iecore::InternedString
的用法示例。
在下文中一共展示了InternedString::value方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contextChanged
void SceneView::contextChanged( const IECore::InternedString &name )
{
if( name.value() == "ui:scene:selectedPaths" )
{
// if only the selection has changed then we can just update the selection
// on our existing scene representation.
const StringVectorData *sc = getContext()->get<StringVectorData>( "ui:scene:selectedPaths" );
RenderableGadget::Selection sr;
sr.insert( sc->readable().begin(), sc->readable().end() );
BlockedConnection blockedConnection( m_selectionChangedConnection );
m_renderableGadget->setSelection( sr );
return;
}
if(
name.value().compare( 0, 3, "ui:" ) == 0 &&
name.value() != "ui:scene:expandedPaths"
)
{
// if it's just a ui context entry that has changed, and it doesn't
// affect our expansion, then early out.
return;
}
// the context change might affect the scene itself, so we must
// schedule an update.
updateRequestSignal()( this );
}
示例2: contextChanged
void SceneView::contextChanged( const IECore::InternedString &name )
{
if( name.value() == "ui:scene:selectedPaths" )
{
// If only the selection has changed then we can just update the selection
// on our existing scene representation.
const StringVectorData *sc = getContext()->get<StringVectorData>( "ui:scene:selectedPaths" );
/// \todo Store selection as PathMatcherData within the context, so we don't need
/// this conversion.
GafferScene::PathMatcherDataPtr sg = new GafferScene::PathMatcherData;
sg->writable().init( sc->readable().begin(), sc->readable().end() );
m_sceneGadget->setSelection( sg );
return;
}
else if( name.value() == "ui:scene:expandedPaths" )
{
const GafferScene::PathMatcherData *expandedPaths = getContext()->get<GafferScene::PathMatcherData>( "ui:scene:expandedPaths" );
m_sceneGadget->setExpandedPaths( expandedPaths );
return;
}
else if( boost::starts_with( name.value(), "ui:" ) )
{
// ui context entries shouldn't affect computation.
return;
}
}
示例3: operator
boost::signals::detail::unusable operator()( boost::python::object slot, ConstContextPtr context, const IECore::InternedString &name )
{
try
{
slot( IECore::constPointerCast<Context>( context ), name.value() );
}
catch( const error_already_set &e )
{
PyErr_PrintEx( 0 ); // clears the error status
}
return boost::signals::detail::unusable();
}
示例4: Exception
const IECore::InternedString &GraphComponent::setName( const IECore::InternedString &name )
{
// make sure the name is valid
static boost::regex validator( "^[A-Za-z_]+[A-Za-z_0-9]*" );
if( !regex_match( name.c_str(), validator ) )
{
std::string what = boost::str( boost::format( "Invalid name \"%s\"" ) % name.string() );
throw IECore::Exception( what );
}
// make sure the name is unique
IECore::InternedString newName = name;
if( m_parent )
{
bool uniqueAlready = true;
for( ChildContainer::const_iterator it=m_parent->m_children.begin(), eIt=m_parent->m_children.end(); it != eIt; it++ )
{
if( *it != this && (*it)->m_name == m_name )
{
uniqueAlready = false;
break;
}
}
if( !uniqueAlready )
{
// split name into a prefix and a numeric suffix. if no suffix
// exists then it defaults to 1.
std::string prefix;
int suffix = numericSuffix( newName.value(), 1, &prefix );
// iterate over all the siblings to find the minimum value for the suffix which
// will be greater than any existing suffix.
for( ChildContainer::const_iterator it=m_parent->m_children.begin(), eIt=m_parent->m_children.end(); it != eIt; it++ )
{
if( *it == this )
{
continue;
}
if( (*it)->m_name.value().compare( 0, prefix.size(), prefix ) == 0 )
{
char *endPtr = 0;
long siblingSuffix = strtol( (*it)->m_name.value().c_str() + prefix.size(), &endPtr, 10 );
if( *endPtr == '\0' )
{
suffix = max( suffix, (int)siblingSuffix + 1 );
}
}
}
static boost::format formatter( "%s%d" );
newName = boost::str( formatter % prefix % suffix );
}
}
// set the new name if it's different to the old
if( newName==m_name )
{
return m_name;
}
Action::enact(
this,
// ok to bind raw pointers to this, because enact() guarantees
// the lifetime of the subject.
boost::bind( &GraphComponent::setNameInternal, this, newName ),
boost::bind( &GraphComponent::setNameInternal, this, m_name )
);
return m_name;
}