当前位置: 首页>>代码示例>>C++>>正文


C++ StringBuilder::end方法代码示例

本文整理汇总了C++中StringBuilder::end方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuilder::end方法的具体用法?C++ StringBuilder::end怎么用?C++ StringBuilder::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringBuilder的用法示例。


在下文中一共展示了StringBuilder::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _moduleListToString

String ModuleManager::_moduleListToString( Vector< Module* >& moduleList )
{
   StringBuilder str;
   
   const U32 numModules = moduleList.size();
   bool isFirst = true;
   for( U32 i = 0; i < numModules; ++ i )
   {
      if( !isFirst )
         str.append( " -> " );
         
      str.append( moduleList[ i ]->getName() );
      
      isFirst = false;
   }
   
   return str.end();
}
开发者ID:1414648814,项目名称:Torque3D,代码行数:18,代码来源:module.cpp

示例2: setData

void GuiInspectorField::setData( const char* data, bool callbacks )
{
   if( mField == NULL )
      return;

   if( verifyData( data ) )
   {
      String strData = data;
      const U32 numTargets = mInspector->getNumInspectObjects();
      
      if( callbacks && numTargets > 1 )
      { mInspector->onBeginCompoundEdit_callback(); }
            
      for( U32 i = 0; i < numTargets; ++ i )
      {
         SimObject* target = mInspector->getInspectObject( i );
         
         String oldValue = target->getDataField( mField->pFieldname, mFieldArrayIndex);
         
         // For numeric fields, allow input expressions.
         
         String newValue = strData;
         S32 type= mField->type;
         if( type == TypeS8 || type == TypeS32 || type == TypeF32 )
         {
            char buffer[ 2048 ];
            expandEscape( buffer, newValue );
            newValue = Con::evaluatef( "%%f = \"%s\"; return ( %s );", oldValue.c_str(), buffer );
         }
         else if(    type == TypeS32Vector
                  || type == TypeF32Vector
                  || type == TypeColorI
                  || type == TypeColorF
                  || type == TypePoint2I
                  || type == TypePoint2F
                  || type == TypePoint3F
                  || type == TypePoint4F
                  || type == TypeRectI
                  || type == TypeRectF
                  || type == TypeMatrixPosition
                  || type == TypeMatrixRotation
                  || type == TypeBox3F
                  || type == TypeRectUV )
         {
            //TODO: we should actually take strings into account and not chop things up between quotes

            U32 numNewUnits = StringUnit::getUnitCount( newValue, " \t\n\r" );
            
            StringBuilder strNew;
            bool isFirst = true;
            for( U32 n = 0; n < numNewUnits; ++ n )
            {
               char oldComponentVal[ 1024 ];
               StringUnit::getUnit( oldValue, n, " \t\n\r", oldComponentVal, sizeof( oldComponentVal ) );
               
               char newComponentExpr[ 1024 ];
               StringUnit::getUnit( newValue, n, " \t\n\r", newComponentExpr, sizeof( newComponentExpr ) );
               
               char buffer[ 2048 ];
               expandEscape( buffer, newComponentExpr );

               const char* newComponentVal = Con::evaluatef( "%%f = \"%s\"; %%v = \"%s\"; return ( %s );",
                  oldComponentVal, oldValue.c_str(), buffer );
               
               if( !isFirst )
                  strNew.append( ' ' );
               strNew.append( newComponentVal );
               
               isFirst = false;
            }
            
            newValue = strNew.end();
         }
            
         target->inspectPreApply();
         
         // Fire callback single-object undo.
         
         if( callbacks )
         {
           mInspector->onInspectorFieldModified_callback( 
                                          target->getIdString(), 
                                          mField->pFieldname, 
                                          mFieldArrayIndex ? mFieldArrayIndex : "(null)", 
                                          oldValue.c_str(), 
                                          newValue.c_str() );
         }
            

         target->setDataField( mField->pFieldname, mFieldArrayIndex, newValue );
         
         // Give the target a chance to validate.
         target->inspectPostApply();
      }
      
      if( callbacks && numTargets > 1 )
      { mInspector->onEndCompoundEdit_callback(); }
   }

   // Force our edit to update
//.........这里部分代码省略.........
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:101,代码来源:field.cpp


注:本文中的StringBuilder::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。