本文整理汇总了C++中Shell::setCwe方法的典型用法代码示例。如果您正苦于以下问题:C++ Shell::setCwe方法的具体用法?C++ Shell::setCwe怎么用?C++ Shell::setCwe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shell
的用法示例。
在下文中一共展示了Shell::setCwe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addChannelMessage
void ReadCell::addChannelMessage( Id chan )
{
/*
* Get child objects of type Mstring, named addmsg1, 2, etc.
* These define extra messages to be assembled at setup.
* Similar to what was done with GENESIS.
*/
vector< Id > kids;
Neutral::children( chan.eref(), kids );
Shell *shell = reinterpret_cast< Shell* >( Id().eref().data() );
Id cwe = shell->getCwe();
shell->setCwe( chan );
for ( vector< Id >::iterator i = kids.begin(); i != kids.end(); ++i )
{
// Ignore kid if its name does not begin with "addmsg"..
const string& name = i->element()->getName();
if ( name.find( "addmsg", 0 ) != 0 )
continue;
string s = Field< string >::get( *i, "value" );
vector< string > token;
tokenize( s, " ", token );
assert( token.size() == 4 );
ObjId src = shell->doFind( token[0] );
ObjId dest = shell->doFind( token[2] );
// I would like to assert, or warn here, but there are legitimate
// cases where not all possible messages are actually available
// to set up. So I just bail.
if ( src.bad() || dest.bad()) {
#ifndef NDEBUG
/*
cout << "ReadCell::addChannelMessage( " << chan.path() <<
"): " << name << " " << s <<
": Bad src " << src << " or dest " << dest << endl;
*/
#endif
continue;
}
ObjId mid =
shell->doAddMsg( "single", src, token[1], dest, token[3] );
assert( !mid.bad());
}
shell->setCwe( cwe );
}