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


C++ STR_String类代码示例

本文整理汇总了C++中STR_String的典型用法代码示例。如果您正苦于以下问题:C++ STR_String类的具体用法?C++ STR_String怎么用?C++ STR_String使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: DetermineProgress

void GPC_Engine::UpdateLoadingAnimation(void)
{
	//int delta;

	float progress = DetermineProgress();

	if(progress > m_previousProgress)
	{
//		delta = progress - m_previousProgress;
		m_previousProgress = progress;
		if(m_previousProgress > 1.0)
			m_previousProgress = 1.0;  // limit to 1.0 (has to change !)
//			m_engine->m_previousProgress = 0.0;
	}

	STR_String to = "";
	STR_String from = "";
	STR_String subject = "progress";
	STR_String body;
	body.Format("%f", progress);  // a number between 0.0 and 1.0

	if(m_networkdev)
	{
		// Store a progress message in the network device.
		NG_NetworkMessage* msg = new NG_NetworkMessage(to, from, subject, body);
		m_networkdev->SendNetworkMessage(msg);
		msg->Release();
	}
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:29,代码来源:GPC_Engine.cpp

示例2:

vector<NG_NetworkMessage*> NG_NetworkScene::FindMessages(
	const STR_String& to,
	const STR_String& from,
	const STR_String& subject,
	bool spamallowed)
{
	vector<NG_NetworkMessage*> foundmessages;
	bool notfound = false;

	// broad phase
	notfound = ((to.IsEmpty() || spamallowed) ? notfound : m_messagesByDestinationName[to] == NULL);
	if (!notfound)
		notfound = (from.IsEmpty() ? notfound : m_messagesBySenderName[from] == NULL);
	if (!notfound)
		notfound = (subject.IsEmpty() ? notfound : m_messagesBySubject[subject] == NULL);
	if (notfound) {
		// it's definitely NOT in the scene, so stop looking
	} else { // narrow phase
		// possibly it's there, but maybe not (false hit)
		if (to.IsEmpty()) {
			// take all messages, and check other fields
			MT_assert(!"objectnames that are empty are not valid, so make it a hobby project :)\n");
		} else {
			//todo: find intersection of messages (that are in other 2 maps)
			vector<NG_NetworkMessage*>** tolistptr = m_messagesByDestinationName[to];
			if (tolistptr) {
				vector<NG_NetworkMessage*>* tolist = *tolistptr;
				vector<NG_NetworkMessage*>::iterator listit;
				for (listit=tolist->begin();!(listit==tolist->end());listit++) {
					NG_NetworkMessage* message = *listit;
					if (ConstraintsAreValid(from, subject, message)) {
						message->AddRef();
						foundmessages.push_back(message);
					}
				} 
			}
			// TODO find intersection of messages (that are in other 2 maps)
			if (spamallowed) {
				tolistptr = m_messagesByDestinationName[""];
				if (tolistptr) {
					vector<NG_NetworkMessage*>* tolist = *tolistptr;
					vector<NG_NetworkMessage*>::iterator listit;
					for (listit=tolist->begin();!(listit==tolist->end());listit++) {
						NG_NetworkMessage* message = *listit;
						if (ConstraintsAreValid(from, subject, message)) {
							message->AddRef();
							foundmessages.push_back(message);
						}
					} 
				}
			}
		}
	} 
	return foundmessages;
}
开发者ID:,项目名称:,代码行数:55,代码来源:

示例3: GPG_PyNextFrame

static int GPG_PyNextFrame(void *state0)
{
    GPG_NextFrameState *state = (GPG_NextFrameState *) state0;
    int exitcode;
    STR_String exitstring;
    bool run = GPG_NextFrame(state->system, state->app, exitcode, exitstring, state->gs);
    if (run) return 0;
    else {
        if (exitcode)
            fprintf(stderr, "Exit code %d: %s\n", exitcode, exitstring.ReadPtr());
        return 1;
    }
}
开发者ID:akonneker,项目名称:blensor,代码行数:13,代码来源:GPG_ghost.cpp

示例4: Term

void CParser::Term(int s)
{
	// generates an error if the next symbol isn't the specified symbol s
	// otherwise, skip the symbol
	if (s == sym) NextSym();
	else {
		STR_String msg;
		msg.Format("Warning: " + Symbol2Str(s) + " expected\ncontinuing without it");

//		AfxMessageBox(msg,MB_ICONERROR);

		trace(msg);
	}
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:14,代码来源:InputParser.cpp

示例5: GHOST_GetTitle

char* GHOST_GetTitle(GHOST_WindowHandle windowhandle)
{
	GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
	STR_String title;

	window->getTitle(title);

	char *ctitle = (char*) malloc(title.Length() + 1);

	if (ctitle == NULL) return NULL;
	strcpy(ctitle, title.Ptr());
		
	return ctitle;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:14,代码来源:GHOST_C-api.cpp

示例6: NextCh

void CParser::TermChar(char c)
{
	// generates an error if the next char isn't the specified char c,
	// otherwise, skip the char
	if (ch == c)
	{
		NextCh();
	}
	else
	{
		STR_String str;
		str.Format("Warning: %c expected\ncontinuing without it", c);
		trace(str);
	}
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:15,代码来源:InputParser.cpp

示例7: PyGetTextureName

PyObject* KX_MeshProxy::PyGetTextureName(PyObject* args, PyObject* kwds)
{
    int matid= 1;
	STR_String matname;

	if (PyArg_ParseTuple(args,"i:getTextureName",&matid))
	{
		matname = m_meshobj->GetTextureName(matid);
	}
	else {
		return NULL;
	}

	return PyUnicode_FromString(matname.Ptr());
		
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例8: ConstraintsAreValid

bool NG_NetworkScene::ConstraintsAreValid(
	const STR_String& from,
	const STR_String& subject,
	NG_NetworkMessage* message)
{
	vector<NG_NetworkMessage*>** fromlistptr =  m_messagesBySenderName[from];
	vector<NG_NetworkMessage*>** subjectlistptr =  m_messagesBySubject[subject];

	vector<NG_NetworkMessage*>* fromlist = (fromlistptr ? *fromlistptr : NULL);
	vector<NG_NetworkMessage*>* subjectlist = (subjectlistptr ? *subjectlistptr : NULL);
	
	return (
		( from.IsEmpty()    || (!fromlist ? false    : (!(std::find(fromlist->begin(), fromlist->end(), message)       == fromlist->end())))
		) &&
		( subject.IsEmpty() || (!subjectlist ? false : (!(std::find(subjectlist->begin(), subjectlist->end(), message) == subjectlist->end())))
		));
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例9: GetParent

void SCA_KeyboardSensor::AddToTargetProp(int keyIndex)
{
	if (IsPrintable(keyIndex)) {
		CValue* tprop = GetParent()->GetProperty(m_targetprop);
		
		if (tprop) {
			/* overwrite the old property */
			if (IsDelete(keyIndex)) {
				/* strip one char, if possible */
				STR_String newprop = tprop->GetText();
				int oldlength = newprop.Length();
				if (oldlength >= 1 ) {
					int newlength=oldlength;

					BLI_str_cursor_step_prev_utf8(newprop, newprop.Length(), &newlength);
					newprop.SetLength(newlength);

					CStringValue * newstringprop = new CStringValue(newprop, m_targetprop);
					GetParent()->SetProperty(m_targetprop, newstringprop);
					newstringprop->Release();
				}				
			} else {
				/* append */
				char pchar = ToCharacter(keyIndex, IsShifted());
				STR_String newprop = tprop->GetText() + pchar;
				CStringValue * newstringprop = new CStringValue(newprop, m_targetprop);			
				GetParent()->SetProperty(m_targetprop, newstringprop);
				newstringprop->Release();
			}
		} else {
			if (!IsDelete(keyIndex)) {
				/* Make a new property. Deletes can be ignored. */
				char pchar = ToCharacter(keyIndex, IsShifted());
				STR_String newprop = pchar;
				CStringValue * newstringprop = new CStringValue(newprop, m_targetprop);			
				GetParent()->SetProperty(m_targetprop, newstringprop);
				newstringprop->Release();
			}
		}
	}
	
}
开发者ID:,项目名称:,代码行数:42,代码来源:

示例10: split_string

static std::vector<STR_String> split_string(STR_String str)
{
	std::vector<STR_String> text = std::vector<STR_String>();

	/* Split the string upon new lines */
	int begin=0, end=0;
	while (end < str.Length())
	{
		if (str.GetAt(end) == '\n')
		{
			text.push_back(str.Mid(begin, end-begin));
			begin = end+1;
		}
		end++;
	}
	//Now grab the last line
	text.push_back(str.Mid(begin, end-begin));

	return text;
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:20,代码来源:KX_FontObject.cpp

示例11: AssembleMessage

   STR_String * MSG_Message :: AssembleMessage( )
   {

      // Assemble with existing message string

         STR_String * messageString = new STR_String( idMessage ) ;

         if ( memcmp( STR_ID_NOT_FOUND , messageString->GetString( ) ,
                      strlen( STR_ID_NOT_FOUND )) != 0  )
         {
            DoAssemble( messageString ) ;

            return messageString ;
         } /* end if */

         delete messageString ;
         messageString = NULL ;

      // Assemble with error message string id

         // Assemble with error message string

            messageString = new STR_String( MSG_ErrorIdNotFound ) ;

            if ( vtItems[ INX_LAST_ITEM ] != NULL )
            {
               delete vtItems[ INX_LAST_ITEM ] ;
            } /* if */
            vtItems[ INX_LAST_ITEM ] = new MSG_ItemInteger( idMessage & STR_ID ) ;

            DoAssemble( messageString ) ;

         // Append items to nonexisting message

         char ASCIINum[ BCD_DIM_MAX_ASCII ] ;

            STR_String Separator(    MSG_Separator    ) ;
            STR_String SeparatorEnd( MSG_SeparatorEnd ) ;

            for( int i = 0 ; i < MSG_DIM_ITEMS - 1 ; i ++ )
            {
               if ( vtItems[ i ] != NULL )
               {
                  messageString->Append( Separator ) ;

                  sprintf( ASCIINum , "%d" , i ) ;
                  messageString->Append( ASCIINum ) ;

                  messageString->Append( SeparatorEnd ) ;

                  STR_String * pItemStr = vtItems[ i ]->ToString() ;
                  messageString->Append( pItemStr ) ;
                  delete pItemStr ;

               } /* if */
            } /* for */

            return messageString ;

   } // End of function: MSG  !Assemble the message string
开发者ID:mauriciogsc,项目名称:Taliman,代码行数:60,代码来源:MESSAGE.CPP

示例12: GetParent

void SCA_KeyboardSensor::AddToTargetProp(int keyIndex, int unicode)
{
	if (IsPrintable(keyIndex)) {
		CValue* tprop = GetParent()->GetProperty(m_targetprop);

		if (IsDelete(keyIndex)) {
			/* Make a new property. Deletes can be ignored. */
			if (tprop) {
				/* overwrite the old property */
				/* strip one char, if possible */
				STR_String newprop = tprop->GetText();
				int oldlength = newprop.Length();
				if (oldlength >= 1 ) {
					int newlength=oldlength;

					BLI_str_cursor_step_prev_utf8(newprop, newprop.Length(), &newlength);
					newprop.SetLength(newlength);

					CStringValue * newstringprop = new CStringValue(newprop, m_targetprop);
					GetParent()->SetProperty(m_targetprop, newstringprop);
					newstringprop->Release();
				}
			}
		}
		else {
			char utf8_buf[7];
			size_t utf8_len;

			utf8_len = BLI_str_utf8_from_unicode(unicode, utf8_buf);
			utf8_buf[utf8_len] = '\0';

			STR_String newprop = tprop ? (tprop->GetText() + utf8_buf) : utf8_buf;

			CStringValue * newstringprop = new CStringValue(newprop, m_targetprop);
			GetParent()->SetProperty(m_targetprop, newstringprop);
			newstringprop->Release();
		}
	}
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:39,代码来源:SCA_KeyboardSensor.cpp

示例13: CreateShaderProgram

void RAS_2DFilterManager::EnableFilter(vector<STR_String>& propNames, void* gameObj, RAS_2DFILTER_MODE mode, int pass, STR_String& text)
{
	if(!isshadersupported)
		return;
	if(pass<0 || pass>=MAX_RENDER_PASS)
		return;
	need_tex_update = true;
	if(mode == RAS_2DFILTER_DISABLED)
	{
		m_enabled[pass] = 0;
		return;
	}

	if(mode == RAS_2DFILTER_ENABLED)
	{
		m_enabled[pass] = 1;
		return;
	}

	if(mode == RAS_2DFILTER_NOFILTER)
	{
		if(m_filters[pass])
			glDeleteObjectARB(m_filters[pass]);
		m_enabled[pass] = 0;
		m_filters[pass] = 0;
		m_gameObjects[pass] = NULL;
		m_properties[pass].clear();
		texflag[pass] = 0;
		return;
	}
	
	if(mode == RAS_2DFILTER_CUSTOMFILTER)
	{
		if(m_filters[pass])
			glDeleteObjectARB(m_filters[pass]);
		m_filters[pass] = CreateShaderProgram(text.Ptr());
		m_gameObjects[pass] = gameObj;
		AnalyseShader(pass, propNames);
		m_enabled[pass] = 1;
		return;
	}

	// We've checked all other cases, which means we must be dealing with a builtin filter
	if(m_filters[pass])
		glDeleteObjectARB(m_filters[pass]);
	m_filters[pass] = CreateShaderProgram(mode);
	m_gameObjects[pass] = NULL;
	AnalyseShader(pass, propNames);
	m_enabled[pass] = 1;
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:50,代码来源:RAS_2DFilterManager.cpp

示例14: RenderText

void GPC_RenderTools::RenderText(
	int mode,
	RAS_IPolyMaterial* polymat,
	float v1[3], float v2[3], float v3[3], float v4[3], int glattrib)
{
	STR_String mytext = ((CValue*)m_clientobject)->GetPropertyText("Text");
	
	const unsigned int flag = polymat->GetFlag();
	struct MTFace* tface = 0;
	unsigned int *col = 0;

	if(flag & RAS_BLENDERMAT) {
		KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(polymat);
		tface = bl_mat->GetMTFace();
		col = bl_mat->GetMCol();
	} else {
		KX_PolygonMaterial* blenderpoly = static_cast<KX_PolygonMaterial*>(polymat);
		tface = blenderpoly->GetMTFace();
		col = blenderpoly->GetMCol();
	}
	
	GPU_render_text(tface, mode, mytext, mytext.Length(), col, v1, v2, v3, v4, glattrib);
}
开发者ID:,项目名称:,代码行数:23,代码来源:

示例15: while

std::vector<STR_String> STR_String::Explode(char c) const
{
	STR_String lcv = *this;
	std::vector<STR_String> uc;

	while (lcv.Length()) {
		int pos = lcv.Find(c);
		if (pos < 0) {
			uc.push_back(lcv);
			lcv.Clear();
		}
		else {
			uc.push_back(lcv.Left(pos));
			lcv = lcv.Mid(pos + 1);
		}
	}

	//uc. -= STR_String("");

	return uc;
}
开发者ID:lukastoenne,项目名称:blender,代码行数:21,代码来源:STR_String.cpp


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