本文整理汇总了C++中nlmisc::IStream::serial方法的典型用法代码示例。如果您正苦于以下问题:C++ IStream::serial方法的具体用法?C++ IStream::serial怎么用?C++ IStream::serial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nlmisc::IStream
的用法示例。
在下文中一共展示了IStream::serial方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dataBaseToStream
// ***************************************************************************
void CInterfaceConfig::dataBaseToStream (NLMISC::IStream &f)
{
if (f.isReading())
{
nlwarning("stream is not in writing mode");
return;
}
CInterfaceManager *pIM = CInterfaceManager::getInstance();
// Save branch of the database
SDBLeaf leafTmp;
CCDBNodeBranch *pDB = pIM->getDbBranch ("UI:SAVE");
if (pDB != NULL)
{
// Number of leaf to save
uint32 nbLeaves = pDB->countLeaves();
f.serial(nbLeaves);
for (uint32 i = 0; i < nbLeaves; ++i)
{
uint count = i;
CCDBNodeLeaf *pNL = pDB->findLeafAtCount(count);
leafTmp.setFrom(pNL);
f.serial(leafTmp);
}
}
}
示例2: serial
//***********************************************************************************************
void CParticleWorkspace::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
f.xmlPush("PARTICLE_WORKSPACE");
f.serialVersion(0);
f.xmlSerial(_Name, "NAME");
f.xmlPush("PS_LIST");
uint32 numNodes = (uint32)_Nodes.size();
// TODO : avoid to store the number of nodes
f.xmlSerial(numNodes, "NUM_NODES");
if (f.isReading())
{
for(uint k = 0; k < numNodes; ++k)
{
_Nodes.push_back(new CNode());
_Nodes.back()->init(this);
f.serial(*_Nodes.back());
}
}
else
{
for(uint k = 0; k < numNodes; ++k)
{
f.serial(*_Nodes[k]);
}
}
f.xmlPop();
f.xmlPop();
}
示例3: serial
void CScriptData::serial(NLMISC::IStream &f)
{
uint16 size;
if (f.isReading())
{
Scripts.clear();
f.serial(size);
uint32 i = 0;
for (; i < size; ++i)
{
//std::string tmpKey;
CCustomElementId tmpKey;
std::vector<std::string> tmpVal;
f.serial(tmpKey);
f.serialCont(tmpVal);
Scripts.insert(make_pair(tmpKey,tmpVal));
}
}
else
{
size = (uint16)Scripts.size();
f.serial(size);
for (TScripts::iterator it = Scripts.begin(); it != Scripts.end(); ++it)
{
//std::string tmp = it->first;
nlWrite(f, serial, it->first);
nlWrite(f, serialCont, it->second);
}
}
}
示例4: serial
void CStreamSound::serial(NLMISC::IStream &s)
{
CSound::serial(s);
s.serial(_MinDist);
s.serial(m_Alpha);
}
示例5:
// ***************************************************************************
void CVegetable::serial(NLMISC::IStream &f)
{
/*
Version 1:
- add BendFrequencyFactor
Version 0:
- base version
*/
sint ver= f.serialVersion(1);
f.serial(ShapeName);
f.serial(Density);
f.serial(MaxDensity);
f.serial(_CosAngleMin, _CosAngleMax, _CosAngleMiddle, _OOCosAngleDist);
f.serialEnum(_AngleType);
f.serial(Sxy, Sz);
f.serial(Rx, Ry, Rz);
f.serial(BendFactor);
f.serial(BendPhase);
f.serial(Color);
f.serial(DistType);
if(ver>=1)
f.serial(BendFrequencyFactor);
else
BendFrequencyFactor= 1;
}
示例6:
void CSimpleSound::serial(NLMISC::IStream &s)
{
std::string bufferName;
CSound::serial(s);
s.serial(_MinDist);
s.serial(_Alpha);
if (s.isReading())
{
s.serial(bufferName);
_Buffername = CStringMapper::map(bufferName);
setBuffer(NULL);
// contain % so it need a context to play
if (bufferName.find ("%") != string::npos)
{
_NeedContext = true;
}
}
else
{
bufferName = CStringMapper::unmap(_Buffername);
s.serial(bufferName);
}
}
示例7: serial
// ***************************************************************************
void CCtrlBase::serial(NLMISC::IStream &f)
{
CViewBase::serial(f);
f.serial(_ContextHelp);
f.serial(_OnContextHelp);
f.serial(_OnContextHelpParams);
f.serial(_ToolTipSpecialParent);
f.serialEnum(_ToolTipParent);
//
THotSpot tmpToolTipParentPosRef = _ToolTipParentPosRef;
THotSpot tmpToolTipPosRef = _ToolTipPosRef;
THotSpot tmpToolTipParentPosRefAlt = _ToolTipParentPosRefAlt;
THotSpot tmpToolTipPosRefAlt = _ToolTipPosRefAlt;
f.serialEnum(tmpToolTipParentPosRef);
f.serialEnum(tmpToolTipPosRef);
f.serialEnum(tmpToolTipParentPosRefAlt);
f.serialEnum(tmpToolTipPosRefAlt);
_ToolTipParentPosRef = tmpToolTipParentPosRef;
_ToolTipPosRef = tmpToolTipPosRef;
_ToolTipParentPosRefAlt = tmpToolTipParentPosRefAlt;
_ToolTipPosRefAlt = tmpToolTipPosRefAlt;
//
nlSerialBitBool(f, _ToolTipInstant);
}
示例8: serial
///======================================================================================
void CPSFace::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
NL_PS_FUNC(CPSFace_IStream )
f.serialVersion(1);
CPSQuad::serial(f);
CPSRotated3DPlaneParticle::serialPlaneBasisScheme(f);
if (f.isReading())
{
uint32 nbConfigurations;
f.serial(nbConfigurations);
if (nbConfigurations)
{
f.serial(_MinAngularVelocity, _MaxAngularVelocity);
}
hintRotateTheSame(nbConfigurations, _MinAngularVelocity, _MaxAngularVelocity);
init();
}
else
{
uint32 nbConfigurations = (uint32)_PrecompBasis.size();
f.serial(nbConfigurations);
if (nbConfigurations)
{
f.serial(_MinAngularVelocity, _MaxAngularVelocity);
}
}
}
示例9: streamToDataBase
// ***************************************************************************
void CInterfaceConfig::streamToDataBase (NLMISC::IStream &f, uint32 uiDbSaveVersion)
{
if (!f.isReading())
{
nlwarning("stream is not in reading mode");
return;
}
sint32 begPos = f.getPos();
f.seek (0, NLMISC::IStream::end);
sint32 endPos = f.getPos();
if ((begPos - endPos) == 0) return;
f.seek (begPos, NLMISC::IStream::begin);
CInterfaceManager *pIM = CInterfaceManager::getInstance();
// Load branch of the database
SDBLeaf leafTmp;
CCDBNodeBranch *pDB = pIM->getDbBranch ("UI:SAVE");
if (pDB != NULL)
{
// Number of leaf to save
uint32 nbLeaves = 0;
f.serial(nbLeaves);
for (uint32 i = 0; i < nbLeaves; ++i)
{
f.serial(leafTmp);
// If there is a define RESET_VER_dbName that exist for this DB, check if version is OK
bool wantRead= true;
// Format dbName for version check
string defVerId= "RESET_VER_";
defVerId+= leafTmp.Name;
for(uint i=0;i<defVerId.size();i++)
{
if(defVerId[i]==':')
defVerId[i]='_';
}
// check if exist
if(pIM->isDefineExist(defVerId))
{
uint32 dbVer;
fromString(pIM->getDefine(defVerId), dbVer);
// if the version in the file is older than the version this db want, abort read
if(uiDbSaveVersion<dbVer)
wantRead= false;
}
// if want read the value from file, read it, else keep the default one
if(wantRead)
{
CCDBNodeLeaf *pNL = pIM->getDbProp(leafTmp.Name,false);
if (pNL != NULL)
leafTmp.setTo(pNL);
}
}
}
}
示例10:
// ***************************************************************************
void CTrackSampledCommon::CTimeBlock::serial(NLMISC::IStream &f)
{
(void)f.serialVersion(0);
f.serial(TimeOffset);
f.serial(KeyOffset);
f.serial(Times);
}
示例11:
void CPrimitivePlugin::TCreatureInfo::serial (NLMISC::IStream &s)
{
s.serial(HaveRadius);
s.serial(Radius);
s.serial(HaveBox);
s.serial(Width);
s.serial(Length);
}
示例12: serial
void CModifierInDB::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
f.serial(Disabled);
if(Disabled)
{
f.serial(ActivationDate);
f.serial(SheetId);
}
}
示例13: throw
///===========================================================================
void CParticleSystemShape::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{
/* ***********************************************
* WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance
* It can be loaded/called through CAsyncFileManager for instance
* ***********************************************/
sint ver = f.serialVersion(6);
/// version 6 : added sharing flag
//NLMISC::CVector8 &buf = _ParticleSystemProto.bufferAsVector();
//f.serialCont(buf);
if (f.isReading ())
{
std::vector<uint8> buf;
f.serialCont(buf);
_ParticleSystemProto.fill(&buf[0], (uint32)buf.size());
}
else
{
f.serialBufferWithSize ((uint8*)_ParticleSystemProto.buffer(), _ParticleSystemProto.length());
}
if (ver > 1)
{
// serial default tracks
for (uint k = 0; k < 4; ++k)
{
f.serial(_UserParamDefaultTrack[k]);
}
}
if ( ver > 2)
{
f.serial (_DefaultPos);
f.serial (_DefaultScale);
f.serial (_DefaultRotQuat);
}
if ( ver > 3)
{
f.serial(_MaxViewDist);
f.serial(_DestroyWhenOutOfFrustum);
f.serial(_DestroyModelWhenOutOfRange);
}
if ( ver > 4)
{
f.serial(_UsePrecomputedBBox);
if (_UsePrecomputedBBox)
{
f.serial(_PrecomputedBBox);
}
}
if ( ver > 5)
{
f.serial(_Sharing);
}
}
示例14:
// ***************************************************************************
void CAABBox::serial(NLMISC::IStream &f)
{
/* ***********************************************
* WARNING: This Class/Method must be thread-safe (ctor/dtor/serial): no static access for instance
* It can be loaded/called through CAsyncFileManager for instance
* ***********************************************/
(void)f.serialVersion(0);
f.serial(Center);
f.serial(HalfSize);
}
示例15: serial
void CFormBodyEltAtom::serial( NLMISC::IStream& s)
{
s.xmlPushBegin( "Atom" );
s.xmlSetAttrib( "Name" );
s.serial( sxname );
s.xmlSetAttrib( "Value" );
s.serial( sxvalue );
s.xmlPushEnd();
s.xmlPop();
}