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


C++ COFile::serialBuffer方法代码示例

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


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

示例1: flushDebugStack

//-----------------------------------------------
// flushDebugStack :
// Display 'title' and a warning for each element in the Debug Stack.
//-----------------------------------------------
void flushDebugStack(const std::string &title)
{
	// If debug stack is not empty
	if(!DebugStackEmpty)
	{
		if(IsDebugFile)
		{
			// Log Title.
			string strTmp = toString("  %s\n", title.c_str());
			DebugFile.serialBuffer((uint8*)strTmp.c_str(), (uint)strTmp.size());

			for(uint i=0; i<DebugStack.size(); ++i)
			{
				strTmp = toString("  %s\n", DebugStack[i].c_str());
				DebugFile.serialBuffer((uint8*)strTmp.c_str(), (uint)strTmp.size());
			}

			// Empty line separator
			strTmp = toString("\n");
			DebugFile.serialBuffer((uint8*)strTmp.c_str(), (uint)strTmp.size());
		}
		// No Output File -> nlwarning
		else
		{
			nlwarning("%s", title.c_str());
			for(uint i=0; i<DebugStack.size(); ++i)
				nlwarning("  %s", DebugStack[i].c_str());

			// Empty line separator
			nlwarning("");
		}
	}

	// Clean the stack (infos could remain in the stack so clean here).
	DebugStack.clear();
	// Stack is empty now.
	DebugStackEmpty = true;
}// flushDebugStack //
开发者ID:AzyxWare,项目名称:ryzom,代码行数:42,代码来源:debug_client.cpp

示例2: getUserDirectory

void	CMailForumService::openSession( uint32 shardid, string username, string cookie )
{
	string	sessionfile = getUserDirectory(shardid, username) + "session";
	string	checkmailfile = getUserDirectory(shardid, username) + "new_mails";

	COFile	ofile;
	if (ofile.open(sessionfile))
	{
		cookie += "\n";
		ofile.serialBuffer((uint8*)(&cookie[0]), (uint)cookie.size());
	}

	if (CFile::fileExists(checkmailfile))
	{
		CFile::deleteFile(checkmailfile);
		CMessage	msgout("MAIL_NOTIF");
		msgout.serial(shardid, username);
		CUnifiedNetwork::getInstance()->send("EGS", msgout);
	}
}
开发者ID:sythaeryn,项目名称:pndrpg,代码行数:20,代码来源:mail_forum_service.cpp

示例3: toLower


//.........这里部分代码省略.........
				raceRestrictionFound= false;
			}
			
			// Find a RaceRestriction?
			if( line.find("Name=\"Race Restriction\"")!=string::npos )
				raceRestrictionFound= true;

			// Find the anim name?
			uint	nameIndexInLine= findAnimName(lineLwr, raceAnimNames);
			if(nameIndexInLine!=-1)
			{
				// Find the enclosing struct
				nlassert(lastStructLine!=0);
				uint	startBlock= lastStructLine;
				uint	nameLineInBlock= j-startBlock;
				uint	endBlock= 0;
				for(uint k=j+1;k<animSetText.size();k++)
				{
					string	line= animSetText[k];

					// Find a RaceRestriction?
					if( line.find("Name=\"Race Restriction\"")!=string::npos )
						raceRestrictionFound= true;

					// end of block?
					if(line.find("</STRUCT>")!=string::npos)
					{
						// endBlock is exclusive 
						endBlock= k+1;
						break;
					}
				}

				// if not found, abort
				if(endBlock==0)
					break;

				// if a raceRestriction has been found, no op (already done)
				if(raceRestrictionFound)
				{
					j= endBlock;
				}
				else
				{
					// LOG
					InfoLog->displayRawNL("%s: Specifying %s by race", 
						CFile::getFilename(animSetFile).c_str(), 
						CFile::getFilename(animList[i]).c_str());

					// *** Start a copy paste ^^
					// Copy
					static vector<string>	copyText;
					copyText.clear();
					for(uint k=startBlock;k<endBlock;k++)
					{
						// add an empty line before </STRUCT>, for race selection node (filled later)
						if(k==endBlock-1)
							copyText.push_back(string());
						copyText.push_back(animSetText[k]);
					}

					// erase this part
					animSetText.erase(animSetText.begin()+startBlock, animSetText.begin()+endBlock);
					uint	nextBlock= startBlock;

					// Append for each race
					for(uint k=0;k<raceAnimNames.size();k++)
					{
						appendRaceAnim(animSetText, nextBlock, copyText, nameLineInBlock, nameIndexInLine, raceAnimNames[k]);
						// nextBlock is then shifted
						nextBlock+= copyText.size();
					}

					someChangeDone= true;

					// *** then let j point to next block
					j= nextBlock;
				}
			}
			else
			{
				j++;
			}
		}
	}

	// *** Write the animset file.
	if(someChangeDone)
	{
		COFile	oFile;
		oFile.open(animSetFile, false, true);
		// Write all text
		for(uint i=0;i<animSetText.size();i++)
		{
			string	str= animSetText[i];
			str+= "\n";
			oFile.serialBuffer((uint8*)str.c_str(), str.size());
		}
	}
}
开发者ID:mixxit,项目名称:solinia,代码行数:101,代码来源:main.cpp


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