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


C++ StdString类代码示例

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


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

示例1: if

DWORD CGUIItem::CheckMouseState(float mouseX, float mouseY, MOUSESTATE mouseState, 
							   float x, float y, float width, float height, DWORD dwLastState)
{ 
	DWORD btState;
	if (mouseState == MOUSE_OPEN)
	{
		m_pVisItem->MouseOver(mouseX, mouseY, x, y, width, height, &btState);
		return btState;
	}
	else if (mouseState == MOUSE_LEFTPRESSED)
	{
		m_pVisItem->MouseButton(mouseX, mouseY, true, false, x, y, width, height, &btState);
		return btState;
	}
	else if (mouseState == MOUSE_LEFTRELEASED)
	{
		if ( m_pVisItem->MouseButton(mouseX, mouseY, false, true, x, y, width, height, &btState) )
		{
			StdString eventName = _T("RELEASED_");
			eventName += GetName()->GetString();
			CHashString eName(eventName.c_str());
		
			GUIEVENT ge;
			ge.event = eName.GetUniqueID();
			ge.ar = NULL;
			static DWORD msgHash_QueueGUIStateEvent = CHashString(_T("QueueGUIStateEvent")).GetUniqueID();
			m_ToolBox->SendMessage(msgHash_QueueGUIStateEvent, sizeof(GUIEVENT), &ge);
		}
		return btState;
	}
	return 0; 
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:32,代码来源:CGUIItem.cpp

示例2: _T

void COptionTreeWrapper::SerializeRadioItem(IArchive &ar, COptionTreeItem *item, bool read)
{
	StdString szVal;
	COptionTreeItemRadio *otiRadio;
	OT_RADIO_NODE *node;
	int index;

	otiRadio = dynamic_cast<COptionTreeItemRadio*>(item);
	if (item == NULL)
	{
		//error
		StdString error = _T("Could not cast item to COptionTreeItemRadio: ");
		error += item->GetLabelText();
		::MessageBox(NULL, error, _T("Invalid Command"), MB_OK);
		return;
	}
	if (read)
	{
		ar.Read(szVal);
		node = otiRadio->Node_FindNode(szVal.c_str());
		if (node != NULL)
		{	
			otiRadio->Node_UnCheckAll();
			node->m_bChecked = true;
		}	
	}
	else
	{
		index = otiRadio->Node_GetChecked();
		node = otiRadio->Node_FindNode(index);
		ar.Write(node->m_strText);
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:33,代码来源:COptionTreeWrapper.cpp

示例3: Serialize

void CDetailObject::Serialize( IArchive &ar )
{
	StdString temp;
	if(ar.IsReading())
	{
		ar.Read(temp, "LayerLink");
		m_LayerLink = temp.c_str();
		ar.Read(temp, "ModelName");
		m_ModelName = temp.c_str();
		ar.Read(m_XCoverage, "XCoverage");
		ar.Read(m_YCoverage, "YCoverage");
		ar.Read(m_XRandomness, "XRandomness");
		ar.Read(m_YRandomness, "YRandomness");
		ar.Read(m_MinScale, "MinScale");
		ar.Read(m_MinScale, "MaxScale");
		ar.Read(m_MinYaw, "MinYaw");
		ar.Read(m_MaxYaw, "MaxYaw");
	}
	else
	{
		ar.Write(m_LayerLink.GetString(), "LayerLink");
		ar.Write(m_ModelName.GetString(), "ModelName");
		ar.Write(m_XCoverage, "XCoverage");
		ar.Write(m_YCoverage, "YCoverage");
		ar.Write(m_XRandomness, "XRandomness");
		ar.Write(m_YRandomness, "YRandomness");
		ar.Write(m_MinScale, "MinScale");
		ar.Write(m_MinScale, "MaxScale");
		ar.Write(m_MinYaw, "MinYaw");
		ar.Write(m_MaxYaw, "MaxYaw");
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:32,代码来源:DetailObject.cpp

示例4: getClassPathExt

long Universe::getClassPathExt(vector<StdString>& tokens,
        const StdString& arg) const {
#define EXT_TOKENS 2
    long result = ERR_SUCCESS;
    long fpIndex = arg.find_last_of(fileSeparator);
    long ssepIndex = arg.find(".som");

    if (fpIndex == StdString::npos) { //no new path
        //different from CSOM (see also HandleArguments):
        //we still want to strip the suffix from the filename, so
        //we set the start to -1, in order to start the substring
        //from character 0. npos is -1 too, but this is to make sure
        fpIndex = -1;
        //instead of returning here directly, we have to remember that
        //there is no new class path and return it later
        result = ERR_FAIL;
    } else
        tokens[0] = arg.substr(0, fpIndex);

    //adding filename (minus ".som" if present) to second slot
    ssepIndex =
            ((ssepIndex != StdString::npos) && (ssepIndex > fpIndex)) ?
                    (ssepIndex - 1) : arg.length();
    tokens[1] = arg.substr(fpIndex + 1, ssepIndex - (fpIndex));
    return result;
}
开发者ID:jdegeete,项目名称:SOMpp,代码行数:26,代码来源:Universe.cpp

示例5: getSeparator

StdChar CSVWriterConfigPanel::getSeparator(void)
{
	if(mGUI->mSeparatorSemicolonBtn->isChecked())
		return ';';

	if(mGUI->mSeparatorColonBtn->isChecked())
		return ':';

	if(mGUI->mSeparatorSpaceBtn->isChecked())
		return ' ';

	if(mGUI->mSeparatorTabBtn->isChecked())
		return '\t';

	if(mGUI->mSeparatorCommaBtn->isChecked())
		return ',';

	if(mGUI->mSeparatorCustomBtn->isChecked())
	{
		StdString s = spt::string::fromQt(mGUI->mSeparatorCustomTxt->text());
		if(s.length() > 0)
			return s[0];
	}

	return ';';
}
开发者ID:skeetor,项目名称:datinator,代码行数:26,代码来源:csv_writer_config_panel.cpp

示例6: keyword

void Parser::keywordMessage(MethodGenerationContext* mgenc, bool super) {
    StdString kw = keyword();
    
    // special compilation for ifTrue and ifFalse
    if (!super && kw == "ifTrue:") {
        ifTrueMessage(mgenc);
        return;
    } else if (!super && kw == "ifFalse:") {
        ifFalseMessage(mgenc);
        return;
    }
    formula(mgenc);
    while (sym == Keyword) {
        kw.append(keyword());
        formula(mgenc);
    }

    VMSymbol* msg = GetUniverse()->SymbolFor(kw);

    mgenc->AddLiteralIfAbsent(msg);

    if (super)
        bcGen->EmitSUPERSEND(mgenc, msg);
    else
        bcGen->EmitSEND(mgenc, msg);

}
开发者ID:SOM-st,项目名称:SOMpp,代码行数:27,代码来源:Parser.cpp

示例7: setSQLLog

bool OracleWriter::prepareOpen(std::vector<DatabaseColumn *> const &oColumns)
{
    setSQLLog(createConfigPanel()->getPath(), createConfigPanel()->getExportSQL(), createConfigPanel()->getExportSQLOnly());
    if(!SociContainer::prepareOpen(oColumns))
        return false;

    OracleWriterPanel *wp = createConfigPanel();
    setAutocommit(wp->getAutoCommitCount());

    StdString table = getTablename();
    if(table.length() == 0)
    {
        ErrorMessage(spt::logging::LoggingItem::LOG_ERROR, MODULENAME, "No target table selected!");
        return false;
    }

    if(getSession() == NULL)
    {
        ErrorMessage(spt::logging::LoggingItem::LOG_ERROR, MODULENAME, "Database session not initialized!");
        return false;
    }

    if(mAllowTruncate)
    {
#warning TODO: Implement truncate
    }

    if(mAllowModifyColumns)
    {
#warning TODO: Implement modify columns
    }

    return true;
}
开发者ID:skeetor,项目名称:datinator,代码行数:34,代码来源:oracle_writer.cpp

示例8: SetupTabBar

//---------------------------------------------------------------------
// Function:	EditDocument
// Description:	Edit an GUIEditor Document retrieving initial data 
//					from a archive
// Parameters:	ar = archive to load into document
// Returns:		DWORD = possible error or 0 for no error
//---------------------------------------------------------------------
DWORD CGUIEditor::EditDocument()
{
	if (!m_bCreated)
	{
		SetupTabBar();
		m_bCreated = true;
	}
	if (!m_bDocOpen)
	{
		StdString res;
		ReadINIKey(_T("LastUsedResolution"), res, _T("GUIEditor"), _T("800x600"));
		StdString x, y;
		res.GetToken(_T("x"), x);
		res.GetToken(_T("x"), y);
		UINT iX, iY;
		iX = (UINT)atoi(x.c_str());
		iY = (UINT)atoi(y.c_str());
		CreateDocView(iX, iY);
	}
	else
	{
		MessageBox(NULL, _T("Can't have more than one GUI open at a time"), _T("Sorry, mac"), MB_OK);
	}
	return NO_ERROR;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:32,代码来源:GUIEditor.cpp

示例9: DBReadString

void CSchemaItem::DBReadString( DATABASEDATA *value, IArchive *ar, const TCHAR *tag )
{
	value->type = DBTYPE_STRING;
	StdString szReadString;
	ar->Read( szReadString );

	value->AssignString( (TCHAR *)szReadString.c_str(), _tcslen(szReadString) );
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:8,代码来源:SchemaItem.cpp

示例10: VERIFY_MESSAGE_SIZE

DWORD CInputManager::OnLoadKeyBinding(DWORD msgSize, void *param)
{
	IHashString *szhFileName;
	VERIFY_MESSAGE_SIZE(msgSize, sizeof(IHashString*));
	szhFileName = (IHashString*)param;
	StdString szNodeName;
	
	IXMLArchive *Archive;
	CHashString streamType(_T("File"));
	CREATEARCHIVE ca;
	DWORD retVal = MSG_NOT_HANDLED;
	
	ca.streamData = (void*)szhFileName->GetString();
	ca.mode = STREAM_MODE_READ;
	ca.streamType = &streamType;

	// call the Archive factory to create an XML archive
	static DWORD msgHash_CreateXMLArchive = CHashString(_T("CreateXMLArchive")).GetUniqueID();
	if (retVal = m_ToolBox->SendMessage(msgHash_CreateXMLArchive, sizeof(CREATEARCHIVE), &ca) != MSG_HANDLED)
	{
		//log error
		m_ToolBox->SetErrorValue(WARN_INVALID_OPERATION);
		m_ToolBox->Log(LOGWARNING, _T("CInputManager: Could not create archive from: %s\n"), szhFileName->GetString());
		return MSG_NOT_HANDLED;
	}

	Archive = dynamic_cast<IXMLArchive *>(ca.archive);
	int num;
	CHashString curKeyBind(_T(""));
	StdString keybindName;
	StdString parentType;
	StdString childType;
	StdString msg;
	int		  key;
	bool	  hitOnce;

	Archive->GetNode(szNodeName);
	Archive->Read(keybindName, _T("name"));
	Archive->Read(num, _T("num"));
	
	curKeyBind = keybindName.c_str();
	
	while (num != 0)
	{
		Archive->Read( msg, _T("msg") );
		Archive->Read( key, _T("key") );
		Archive->Read( hitOnce, _T("hitOnce") );
        //Add Entry to page			
		CHashString szMessage(msg);
		KEYBINDINGMAP &curPage = m_KeyMap[ curKeyBind.GetUniqueID() ];
		curPage[ key ].msg = szMessage.GetUniqueID();
		curPage[ key ].hitOnce = hitOnce;
		num--;
	}

	Archive->Close();
	return MSG_HANDLED_STOP;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:58,代码来源:CInputManager.cpp

示例11: getBracket

StdChar CSVWriterConfigPanel::getBracket(StdChar &oClose) const
{
	oClose = 0;

	if(mGUI->mQuoteBtn->isChecked())
	{
		oClose = '"';
		return '"';
	}

	if(mGUI->mParenthesisBtn->isChecked())
	{
		oClose = ')';
		return '(';
	}

	if(mGUI->mBracketBtn->isChecked())
	{
		oClose = ']';
		return '[';
	}

	if(mGUI->mCurlyBtn->isChecked())
	{
		oClose = '}';
		return '{';
	}

	if(mGUI->mSignBtn->isChecked())
	{
		oClose = '>';
		return '<';
	}

	if(mGUI->mCustomQuoteBtn->isChecked())
	{
		StdString s = spt::string::fromQt(mGUI->mSeparatorCustomTxt->text());
		if(s.length() > 0)
		{
			if(s.length() > 1)
				oClose = s[1];
			else
			{
				switch(s[0])
				{
					case '\'':
					case '"':
						oClose = s[0];
					break;
				}
			}

			return s[0];
		}
	}

	return 0;
}
开发者ID:skeetor,项目名称:datinator,代码行数:58,代码来源:csv_writer_config_panel.cpp

示例12: CHashString

void CWorldEventToolPal::UpdateWorldEventTrigger( void )
{
	static DWORD msgHash_FindObject = CHashString(_T("FindObject")).GetUniqueID();
	static DWORD msgHash_GetComponentType = CHashString(_T("GetComponentType")).GetUniqueID();
	static DWORD msgHash_CreateArchive = CHashString(_T("CreateArchive")).GetUniqueID();
	static DWORD msgHash_SerializeObject = CHashString(_T("SerializeObject")).GetUniqueID();

	static CHashString Hash_Type = CHashString(_T("CWorldEventTrigger"));

	CString buf;
	m_Name.GetLBText(m_Name.GetCurSel(), buf);
	CHashString hszName((TCHAR*)buf.GetBuffer());
	FINDOBJECTPARAMS param;
	param.hszName = &hszName;
	DWORD result = m_ToolBox->SendMessage(msgHash_FindObject, sizeof(FINDOBJECTPARAMS), &param);

	// object exists 
	if( param.bFound == true )
	{
		GETCOMPONENTTYPEPARAMS gctp;
		gctp.name = &hszName;
		m_ToolBox->SendMessage(msgHash_GetComponentType, sizeof(gctp), &gctp);

		// it is a world event, get values from it
		if ( (gctp.componenttype != NULL) && (gctp.componenttype->GetUniqueID() == Hash_Type.GetUniqueID()) )
		{
			CREATEARCHIVE ca;
			CHashString streamType(_T("Memory"));
			ca.streamData = NULL;
			ca.mode = STREAM_MODE_WRITE | STREAM_MODE_READ;
			ca.streamType = &streamType;
	 	
			m_ToolBox->SendMessage(msgHash_CreateArchive, sizeof(CREATEARCHIVE), &ca, NULL, NULL);
			IArchive *MemArchive = (ca.archive);

			MemArchive->SetIsWriting(true);
			MemArchive->SeekTo(0);

			SERIALIZEOBJECTPARAMS sop;
			sop.name = &hszName;
			sop.archive = MemArchive;
			m_ToolBox->SendMessage(msgHash_SerializeObject, sizeof(SERIALIZEOBJECTPARAMS), &sop, NULL, NULL);

			MemArchive->SetIsWriting(false);
			MemArchive->SeekTo(0);

			StdString tmp;
			MemArchive->Read( tmp );
			m_EntityName.SetWindowText( tmp.c_str() );
			MemArchive->Read( tmp );
			m_EntityType.SetWindowText( tmp.c_str() );
			MemArchive->Read( tmp );
			m_EventName.SetWindowText( tmp.c_str() );
			
			MemArchive->Close();
		}
	}
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:58,代码来源:WorldEventToolPal.cpp

示例13: keywordPattern

void Parser::keywordPattern(MethodGenerationContext* mgenc) {
    StdString kw;
    do {
        kw.append(keyword());
        mgenc->AddArgumentIfAbsent(argument());
    } while (sym == Keyword);

    mgenc->SetSignature(GetUniverse()->SymbolFor(kw));
}
开发者ID:SOM-st,项目名称:SOMpp,代码行数:9,代码来源:Parser.cpp

示例14: getSelector

bool SociContainer::isTable(void)
{
	StdString t = getSelector();
	if(t.length() == 0)
		return true;

	if(t[0] == '{')
		return true;

	return false;
}
开发者ID:skeetor,项目名称:datinator,代码行数:11,代码来源:soci_container.cpp

示例15: VERIFY_MESSAGE_SIZE

/// \brief	message handler to create zipped memory stream
/// \param	size - size of LPCTSTR
/// \param	param - pointer to string with path
/// \return	EE message return code
DWORD CZLibStreamFactory::OnAddZipFile(DWORD size, void *param)
{
	VERIFY_MESSAGE_SIZE(size, sizeof(LPCTSTR));
	StdString sPath = static_cast<LPCTSTR>(param);
	sPath.MakeSafeFileName();
	//sPath.ConformSlashesForward();
	if (!CZipFileStream::AddSearchPath(sPath.c_str()))
	{
		return MSG_ERROR;
	}
	return MSG_HANDLED_STOP;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:16,代码来源:ZLibStreamFactory.cpp


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