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


C++ CSString::c_str方法代码示例

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


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

示例1: applyPatch

bool applyPatch(const NLMISC::CSString& patchFile,const NLMISC::CSString& srcFile,const NLMISC::CSString& destFile)
{
	nlinfo("APPLY PATCH: %s to file %s => %s",patchFile.c_str(),srcFile.c_str(),destFile.c_str());
	NLMISC::CSString cmd= "xdelta patch "+patchFile+" "+srcFile+" "+destFile;
	bool ok= system(cmd.c_str())==0;
	return ok;
}
开发者ID:mixxit,项目名称:solinia,代码行数:7,代码来源:spa_server_patch_applier.cpp

示例2: beginState

bool CStateManager::beginState(const NLMISC::CSString& stateName)
{
	// make sure the state is valid
	if (_ValidStates.find(stateName.strip())==_ValidStates.end())
	{
		nlwarning("Cannot start state as it is not in valid state list: %s",stateName.c_str());
		return false;
	}

	// make sure the state isn't already active
	for (uint32 i=0;i<_States.size();++i)
	{
		if (_States[i]==stateName)
		{
			nlwarning("Cannot start state as it is already active: %s",stateName.c_str());
			return false;
		}
	}

	// set the state as active
	_States.push_back(stateName);

	// write the states to a file
	NLMISC::CSString stateTxt;
	stateTxt.join(_States,"\n");
	stateTxt.writeToFile(StateFileName);

	// execute the begin_state script
	CScriptManager::getInstance()->runScript("begin_"+stateName);

	return true;
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:32,代码来源:ss_state_manager.cpp

示例3: applyFirstPatch

bool applyFirstPatch(const NLMISC::CSString& patchFile,const NLMISC::CSString& destFile)
{
	nlinfo("APPLY FIRST PATCH: %s => %s",patchFile.c_str(),destFile.c_str());
	NLMISC::CSString cmd= "xdelta patch "+patchFile+" /dev/null "+destFile;
	bool ok= system(cmd.c_str())==0;
	return ok;
}
开发者ID:mixxit,项目名称:solinia,代码行数:7,代码来源:spa_server_patch_applier.cpp

示例4: endState

bool CStateManager::endState(const NLMISC::CSString& stateName)
{
	uint32 i;

	// make sure the state is already active
	for (i=0;i<_States.size();++i)
	{
		if (_States[i]==stateName)
		{
			break;
		}
	}
	if (i==_States.size())
	{
		nlwarning("Cannot end state as it is not already active: %s",stateName.c_str());
		return false;
	}

	// set the state as inactive
	_States.erase(_States.begin()+i);

	// write the states to a file
	NLMISC::CSString stateTxt;
	stateTxt.join(_States,"\n");
	stateTxt.writeToFile(StateFileName);

	// execute the end_state script
	CScriptManager::getInstance()->runScript("end_"+stateName);

	return true;
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:31,代码来源:ss_state_manager.cpp

示例5: addValidState

void CStateManager::addValidState(const NLMISC::CSString& stateName)
{
	if (stateName.countWords()!=1)
	{
		nlwarning("Invalid state name: %s",stateName.c_str());
		return;
	}
	_ValidStates.insert(stateName.strip());
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:9,代码来源:ss_state_manager.cpp

示例6: _downloadLog

	void CFileReceiver::_downloadLog(const NLMISC::CSString& fileName,uint32 bytesSoFar, uint32 bytesExpected) const
	{
		const CAdministeredModuleBase* adminModule= dynamic_cast<const CAdministeredModuleBase*>(_Parent);
		if (adminModule!=NULL)
		{
			adminModule->setStateVariable(fileName,NLMISC::toString("%d/%d",bytesSoFar,bytesExpected));
		}
		else
		{
			nldebug("CFileReceiver_Download: %s: %d/%d",fileName.c_str(),bytesSoFar,bytesExpected);
		}
	}
开发者ID:mixxit,项目名称:solinia,代码行数:12,代码来源:file_receiver.cpp

示例7: _logError

	void CFileReceiver::_logError(const NLMISC::CSString& msg) const
	{
		const CAdministeredModuleBase* adminModule= dynamic_cast<const CAdministeredModuleBase*>(_Parent);
		if (adminModule!=NULL)
		{
			adminModule->registerError(msg);
		}
		else
		{
			nlwarning("CFileReceiver: %s",msg.c_str());
		}
	}
开发者ID:mixxit,项目名称:solinia,代码行数:12,代码来源:file_receiver.cpp

示例8: _log

	void CFileReceiver::_log(const NLMISC::CSString& msg) const
	{
		const CAdministeredModuleBase* adminModule= dynamic_cast<const CAdministeredModuleBase*>(_Parent);
		if (adminModule!=NULL)
		{
			adminModule->registerProgress(msg);
		}
		else
		{
			nldebug("CFileReceiver_%s",msg.c_str());
		}
	}
开发者ID:mixxit,项目名称:solinia,代码行数:12,代码来源:file_receiver.cpp

示例9: untar

bool untar(const NLMISC::CSString& destFile)
{
	bool ok;
	nlinfo("SPA UNPACK TAR BALL: %s",destFile.c_str());

	NLMISC::CSString oldPath= NLMISC::CPath::getCurrentPath();
	NLMISC::CSString newPath= NLMISC::CFile::getPath(destFile);

	ok= NLMISC::CPath::setCurrentPath(newPath.c_str());
	DROP_IF(!ok,"Patching error - failed to change directory to: "+newPath,return false);

	NLMISC::CSString cmd;
	cmd+= "tar xzfv "+NLMISC::CFile::getFilename(destFile);
	nldebug("- system: %s",cmd.c_str());
	ok= system(cmd.c_str())==0;

	ok= NLMISC::CPath::setCurrentPath(oldPath.c_str());
	DROP_IF(!ok,"Patching error - failed to change directory to: "+oldPath,return false);

	return ok;
}
开发者ID:mixxit,项目名称:solinia,代码行数:21,代码来源:spa_server_patch_applier.cpp

示例10: setUserComponentToSave

bool CUserComponentValidator::setUserComponentToSave(const std::string& filename, const CUserComponentValidator::TValues& values, std::string& headerMD5, const std::string &body)
{
    _Filename = filename;
//	std::ostringstream out2;
//	out2.str(body);

//	_UserComponentBody =out2.str();

    _UserComponentBody = body;

    {
        NLMISC::CHashKeyMD5 md5Id = NLMISC::getMD5((uint8*)_UserComponentBody.data(), (uint32)_UserComponentBody.size());
        _BodyMd5 = md5Id.toString().c_str();
    }

//	out2.str("");
//	out2 << NLMISC::toString("-- BodyMD5 = '%s'\n", _BodyMd5.c_str() );
//	TValues::const_iterator first(values.begin()), last(values.end());
//	for (; first != last; ++first)
//	{
    //>first->second.c_str()) "\n" => "\\n"
//		NLMISC::CSString tmp = first->second.c_str();
//		tmp = tmp.replace("\n", "\\n");

//		out2 << NLMISC::toString("-- %s = '%s'\n", first->first.c_str(), tmp.c_str());
//	}


//	_HeaderBody =out2.str();


    _HeaderBody = NLMISC::toString("-- BodyMD5 = '%s'\n", _BodyMd5.c_str() );

    TValues::const_iterator first(values.begin()), last(values.end());
    for (; first != last; ++first)
    {
        //>first->second.c_str()) "\n" => "\\n"
        NLMISC::CSString tmp = first->second.c_str();
        tmp = tmp.replace("\n", "\\n");

        _HeaderBody += NLMISC::toString("-- %s = '%s'\n", first->first.c_str(), tmp.c_str());
    }


    std::string headerBodyMd5;
    {
        NLMISC::CHashKeyMD5 md5Id = NLMISC::getMD5((uint8*)_HeaderBody.data(), (uint32)_HeaderBody.size());
        _HeaderMd5 = md5Id.toString().c_str();
        headerMD5 = _HeaderMd5;
    }

    return true;
}
开发者ID:mixxit,项目名称:solinia,代码行数:53,代码来源:scenario.cpp

示例11: setScenarioToSave

bool CScenarioValidator::setScenarioToSave(const std::string& filename, CObject* scenario, const CScenarioValidator::TValues& values, std::string& headerMD5)
{
    _Filename = filename;
    //std::ostringstream out2;
    //out2.str("");
    std::string out2;

    if (!scenario)
    {
        return false;
    }

    //out2 <<"scenario = "<< *scenario ;
    out2 += "scenario = ";
    scenario->serialize(out2);

    _ScenarioBody = out2;
    {
        NLMISC::CHashKeyMD5 md5Id = NLMISC::getMD5((uint8*)_ScenarioBody.data(),(uint32) _ScenarioBody.size());
        _BodyMd5 = md5Id.toString().c_str();
    }


    out2.clear();
    //out2.str("");
    out2 += NLMISC::toString("-- BodyMD5 = '%s'\n", _BodyMd5.c_str() );
    TValues::const_iterator first(values.begin()), last(values.end());
    for (; first != last; ++first)
    {
        //>first->second.c_str()) "\n" => "\\n"
        NLMISC::CSString tmp = first->second.c_str();
        tmp = tmp.replace("\n", "\\n");

        out2 += NLMISC::toString("-- %s = '%s'\n", first->first.c_str(), tmp.c_str());
    }

    _HeaderBody =out2;
    std::string headerBodyMd5;
    {
        NLMISC::CHashKeyMD5 md5Id = NLMISC::getMD5((uint8*)_HeaderBody.data(), (uint32)_HeaderBody.size());
        _HeaderMd5 = md5Id.toString().c_str();
        headerMD5 = _HeaderMd5;
    }
    return true;
}
开发者ID:mixxit,项目名称:solinia,代码行数:45,代码来源:scenario.cpp

示例12:

CHashKeyMD5 safeGetMD5(const NLMISC::CSString& fileName)
{
	while (true)
	{
		try
		{
			CHashKeyMD5 result= NLMISC::getMD5(fileName);
			return result;
		}
		catch(...)
		{
			nlwarning("Exception thrown in getMD5(\"%s\") ... will try again in a few seconds",fileName.c_str());
			nlSleep(3);
		}
	}
}
开发者ID:,项目名称:,代码行数:16,代码来源:


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