本文整理汇总了C++中IWriter类的典型用法代码示例。如果您正苦于以下问题:C++ IWriter类的具体用法?C++ IWriter怎么用?C++ IWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveData
void CBone::SaveData(IWriter& F)
{
F.open_chunk (BONE_CHUNK_DEF);
F.w_stringZ (name);
F.close_chunk ();
F.open_chunk (BONE_CHUNK_MATERIAL);
F.w_stringZ (game_mtl);
F.close_chunk ();
F.open_chunk (BONE_CHUNK_SHAPE);
F.w (&shape,sizeof(SBoneShape));
F.close_chunk ();
F.open_chunk (BONE_CHUNK_FLAGS);
F.w_u32 (IK_data.ik_flags.get());
F.close_chunk ();
F.open_chunk (BONE_CHUNK_IK_JOINT);
F.w_u32 (IK_data.type);
F.w (IK_data.limits,sizeof(SJointLimit)*3);
F.w_float (IK_data.spring_factor);
F.w_float (IK_data.damping_factor);
F.close_chunk ();
F.open_chunk (BONE_CHUNK_IK_JOINT_BREAK);
F.w_float (IK_data.break_force);
F.w_float (IK_data.break_torque);
F.close_chunk ();
F.open_chunk (BONE_CHUNK_IK_JOINT_FRICTION);
F.w_float (IK_data.friction);
F.close_chunk ();
F.open_chunk (BONE_CHUNK_MASS);
F.w_float (mass);
F.w_fvector3 (center_of_mass);
F.close_chunk ();
}
示例2: SaveSelection
void ESceneWayTool::SaveSelection(IWriter& F)
{
F.w_chunk (CHUNK_VERSION,(u16*)&WAY_TOOLS_VERSION,sizeof(WAY_TOOLS_VERSION));
inherited::SaveSelection(F);
}
示例3: flv2rtmp
int flv2rtmp()
{
srs_flv_t flv;
int ret = 0;
flv = srs_flv_open_read("./test.flv");
if(NULL == flv)
{
srs_human_trace("open flv file failed.");
return 2;
}
char header[13];
if ((ret = srs_flv_read_header(flv, header)) != 0)
{
srs_human_trace("flv read header failed.");
return ret;
}
u_int32_t timestamp=0;
char type=0;
int size=0;
char* data = NULL;
char* pRtmpUrl = (char*)"rtmp://101.201.146.134/hulu/w_test.flv";
bool bRunningFlag=true;
#ifndef SEND_RTMP_BY_SRS_LIBRTMP
IWriter* pRtmpWriter = CreateWriter(pRtmpUrl);
pRtmpWriter->Open(pRtmpUrl, NULL);
#else
srs_rtmp_t ortmp = srs_rtmp_create(pRtmpUrl, &bRunningFlag);
if ((ret = srs_rtmp_handshake(ortmp)) != 0)
{
srs_human_trace("ortmp simple handshake failed. ret=%d", ret);
return ret;
}
srs_human_trace("ortmp simple handshake success");
if ((ret = srs_rtmp_connect_app(ortmp)) != 0)
{
srs_human_trace("ortmp connect vhost/app failed. ret=%d", ret);
return ret;
}
srs_human_trace("ortmp connect vhost/app success");
if ((ret = srs_rtmp_publish_stream(ortmp)) != 0)
{
srs_human_trace("ortmp publish stream failed. ret=%d", ret);
return ret;
}
srs_human_trace("ortmp publish stream success");
#endif
for(;;)
{
// tag header
if((ret = srs_flv_read_tag_header(flv, &type, &size, ×tamp)) != 0)
{
if (srs_flv_is_eof(ret))
{
srs_human_trace("parse completed.");
return 0;
}
srs_human_trace("flv get packet failed. ret=%d", ret);
return ret;
}
srs_human_trace("read tag header typd:%d size:%d timestamp:%d. ", type, size, timestamp);
if (size <= 0)
{
srs_human_trace("invalid size=%d", size);
break;
}
data = (char*)malloc(size);
if ((ret = srs_flv_read_tag_data(flv, data, size)) != 0)
{
return ret;
}
if ((ret = srs_human_print_rtmp_packet(type, timestamp, data, size)) != 0)
{
srs_human_trace("print packet failed. ret=%d timestamp%d", ret, timestamp);
return ret;
}
#ifndef SEND_RTMP_BY_SRS_LIBRTMP
if(8 == type)
pushaudio(pRtmpWriter, ×tamp, data, size);
else if(9 == type)
pushvideo(pRtmpWriter, ×tamp, data, size);
free(data);
data=NULL;
usleep(20*1000);
#else
if ((ret = srs_human_print_rtmp_packet(type, timestamp, data, size)) != 0) {
srs_human_trace("print packet failed. ret=%d timestamp%d", ret, timestamp);
return ret;
}
//.........这里部分代码省略.........
示例4: Save
void CSMotion::Save(IWriter& F)
{
CCustomMotion::Save(F);
F.w_u16 (EOBJ_SMOTION_VERSION);
F.w_s8 (m_Flags.get());
F.w_u16 (m_BoneOrPart);
F.w_float (fSpeed);
F.w_float (fAccrue);
F.w_float (fFalloff);
F.w_float (fPower);
F.w_u16 ((u16)bone_mots.size());
for(BoneMotionIt bm_it=bone_mots.begin(); bm_it!=bone_mots.end(); bm_it++){
xr_strlwr (bm_it->name);
F.w_stringZ (bm_it->name);
F.w_u8 (bm_it->m_Flags.get());
for (int ch=0; ch<ctMaxChannel; ch++)
bm_it->envs[ch]->Save(F);
}
#if 0
u32 sz = marks.size();
F.w_u32 (sz);
for(u32 i=0; i<sz; ++i)
marks[i].Save(&F);
#else
F.w_u32 (0);
#endif
}
示例5:
void OGF::Save_Normal_PM (IWriter &fs, ogf_header& H, BOOL bVertexColored)
{
// clMsg ("- saving: normal or clod");
// Vertices
fs.open_chunk (OGF_GCONTAINER);
fs.w_u32 (vb_id);
fs.w_u32 (vb_start);
fs.w_u32 ((u32)vertices.size());
fs.w_u32 (ib_id);
fs.w_u32 (ib_start);
fs.w_u32 ((u32)faces.size()*3);
fs.close_chunk ();
// progressive-data, if need it
if (H.type == MT_PROGRESSIVE){
// SW
fs.open_chunk (OGF_SWIDATA );
fs.w_u32 (m_SWI.reserved[0] );
fs.w_u32 (m_SWI.reserved[1] );
fs.w_u32 (m_SWI.reserved[2] );
fs.w_u32 (m_SWI.reserved[3] );
fs.w_u32 (m_SWI.count );
fs.w (m_SWI.sw,m_SWI.count*sizeof(FSlideWindow));
fs.close_chunk ();
}
// if has x-vertices/x-faces
if (x_vertices.size() && x_faces.size()) {
fs.open_chunk (OGF_FASTPATH );
{
// Vertices
fs.open_chunk (OGF_GCONTAINER);
fs.w_u32 (xvb_id);
fs.w_u32 (xvb_start);
fs.w_u32 ((u32)x_vertices.size());
fs.w_u32 (xib_id);
fs.w_u32 (xib_start);
fs.w_u32 ((u32)x_faces.size()*3);
fs.close_chunk ();
// progressive-data, if need it
if (H.type == MT_PROGRESSIVE){
// SW
fs.open_chunk (OGF_SWIDATA );
fs.w_u32 (x_SWI.reserved[0] );
fs.w_u32 (x_SWI.reserved[1] );
fs.w_u32 (x_SWI.reserved[2] );
fs.w_u32 (x_SWI.reserved[3] );
fs.w_u32 (x_SWI.count );
fs.w (x_SWI.sw,x_SWI.count*sizeof(FSlideWindow));
fs.close_chunk ();
}
}
fs.close_chunk ();
}
}
示例6:
void CPatrolPathStorage::save (IWriter &stream)
{
stream.open_chunk (0);
stream.w_u32 (m_registry.size());
stream.close_chunk ();
stream.open_chunk (1);
PATROL_REGISTRY::iterator I = m_registry.begin();
PATROL_REGISTRY::iterator E = m_registry.end();
for (int i=0; I != E; ++I, ++i) {
stream.open_chunk (i);
stream.open_chunk (0);
save_data ((*I).first,stream);
stream.close_chunk ();
stream.open_chunk (1);
save_data ((*I).second,stream);
stream.close_chunk ();
stream.close_chunk ();
}
stream.close_chunk ();
}
示例7: Save
void EDetail::Save(IWriter& F)
{
// version
F.open_chunk (DETOBJ_CHUNK_VERSION);
F.w_u32 (DETOBJ_VERSION);
F.close_chunk ();
// reference
F.open_chunk (DETOBJ_CHUNK_REFERENCE);
F.w_stringZ (m_sRefs.c_str());
F.close_chunk ();
// scale
F.open_chunk (DETOBJ_CHUNK_SCALE_LIMITS);
F.w_float (m_fMinScale);
F.w_float (m_fMaxScale);
F.close_chunk ();
// density factor
F.open_chunk (DETOBJ_CHUNK_DENSITY_FACTOR);
F.w_float (m_fDensityFactor);
F.close_chunk ();
// flags
F.open_chunk (DETOBJ_CHUNK_FLAGS);
F.w_u32 (m_Flags.get());
F.close_chunk ();
}
示例8: xr_strdup
bool CInifile::save_as( LPCSTR new_fname )
{
// save if needed
if (new_fname&&new_fname[0]){
xr_free (fName);
fName = xr_strdup(new_fname);
}
R_ASSERT (fName&&fName[0]);
IWriter* F = FS.w_open_ex(fName);
if (F){
string512 temp,val;
for (RootIt r_it=DATA.begin(); r_it!=DATA.end(); ++r_it)
{
sprintf_s (temp,sizeof(temp),"[%s]",*(*r_it)->Name);
F->w_string (temp);
for (SectCIt s_it=(*r_it)->Data.begin(); s_it!=(*r_it)->Data.end(); ++s_it)
{
const Item& I = *s_it;
if (*I.first) {
if (*I.second) {
_decorate (val,*I.second);
#ifdef DEBUG
if (*I.comment) {
// name, value and comment
sprintf_s (temp,sizeof(temp),"%8s%-32s = %-32s ;%s"," ",*I.first,val,*I.comment);
} else
#endif
{
// only name and value
sprintf_s (temp,sizeof(temp),"%8s%-32s = %-32s"," ",*I.first,val);
}
} else {
#ifdef DEBUG
if (*I.comment) {
// name and comment
sprintf_s(temp,sizeof(temp),"%8s%-32s = ;%s"," ",*I.first,*I.comment);
} else
#endif
{
// only name
sprintf_s(temp,sizeof(temp),"%8s%-32s = "," ",*I.first);
}
}
} else {
// no name, so no value
#ifdef DEBUG
if (*I.comment)
sprintf_s (temp,sizeof(temp),"%8s;%s"," ",*I.comment);
else
#endif
temp[0] = 0;
}
_TrimRight (temp);
if (temp[0]) F->w_string (temp);
}
F->w_string (" ");
}
FS.w_close (F);
return true;
}
return false;
}
示例9: Save
void SGameMtlPair::Save(IWriter& fs)
{
fs.open_chunk (GAMEMTLPAIR_CHUNK_PAIR);
fs.w_u32 (mtl0);
fs.w_u32 (mtl1);
fs.w_u32 (ID);
fs.w_u32 (ID_parent);
fs.w_u32 (OwnProps.get());
fs.close_chunk ();
// copy from parent
if (ID_parent!=GAMEMTL_NONE_ID){
SGameMtlPair* P;
if ((0!=(P=GetLastParentValue(this,flBreakingSounds)))&&(P!=this))
BreakingSounds = P->BreakingSounds;
if ((0!=(P=GetLastParentValue(this,flStepSounds)))&&(P!=this))
StepSounds = P->StepSounds;
if ((0!=(P=GetLastParentValue(this,flCollideSounds)))&&(P!=this))
CollideSounds = P->CollideSounds;
if ((0!=(P=GetLastParentValue(this,flCollideParticles)))&&(P!=this))
CollideParticles= P->CollideParticles;
if ((0!=(P=GetLastParentValue(this,flCollideMarks)))&&(P!=this))
CollideMarks = P->CollideMarks;
}
/*
else{
OwnProps.zero();
if (!BreakingSounds.IsEmpty()) OwnProps.set(flBreakingSounds,TRUE);
if (!StepSounds.IsEmpty()) OwnProps.set(flStepSounds,TRUE);
if (!CollideSounds.IsEmpty()) OwnProps.set(flCollideSounds,TRUE);
if (!CollideParticles.IsEmpty())OwnProps.set(flCollideParticles,TRUE);
if (!CollideMarks.IsEmpty()) OwnProps.set(flCollideMarks,TRUE);
}
*/
// save
fs.open_chunk (GAMEMTLPAIR_CHUNK_BREAKING);
fs.w_stringZ (BreakingSounds);
fs.close_chunk ();
fs.open_chunk (GAMEMTLPAIR_CHUNK_STEP);
fs.w_stringZ (StepSounds);
fs.close_chunk ();
fs.open_chunk (GAMEMTLPAIR_CHUNK_COLLIDE);
fs.w_stringZ (CollideSounds);
fs.w_stringZ (CollideParticles);
fs.w_stringZ (CollideMarks);
fs.close_chunk ();
}
示例10:
void CBuild::Run (LPCSTR P)
{
if (strstr(Core.Params,"-att")) gl_linear = TRUE;
//****************************************** Open Level
strconcat (path,P,"\\") ;
string_path lfn ;
IWriter* fs = FS.w_open (strconcat(lfn,path,"level."));
fs->open_chunk (fsL_HEADER) ;
hdrLEVEL H;
H.XRLC_version = XRCL_PRODUCTION_VERSION;
H.XRLC_quality = g_params.m_quality;
fs->w (&H,sizeof(H));
fs->close_chunk ();
//****************************************** Dumb entry in shader-registration
RegisterShader ("");
//****************************************** Saving lights
{
string256 fn;
IWriter* fs = FS.w_open (strconcat(fn,pBuild->path,"build.lights"));
fs->w_chunk (0,&*L_static.rgb.begin(),L_static.rgb.size()*sizeof(R_Light));
fs->w_chunk (1,&*L_static.hemi.begin(),L_static.hemi.size()*sizeof(R_Light));
fs->w_chunk (2,&*L_static.sun.begin(),L_static.sun.size()*sizeof(R_Light));
FS.w_close (fs);
}
//****************************************** Optimizing + checking for T-junctions
FPU::m64r ();
Phase ("Optimizing...");
mem_Compact ();
PreOptimize ();
CorrectTJunctions ();
//****************************************** HEMI-Tesselate
FPU::m64r ();
Phase ("Adaptive HT...");
mem_Compact ();
#ifndef CFORM_ONLY
xrPhase_AdaptiveHT ();
#endif
//****************************************** Building normals
FPU::m64r ();
Phase ("Building normals...");
mem_Compact ();
CalcNormals ();
//SmoothVertColors (5);
//****************************************** Collision DB
//should be after normals, so that double-sided faces gets separated
FPU::m64r ();
Phase ("Building collision database...");
mem_Compact ();
BuildCForm ();
#ifdef CFORM_ONLY
return;
#endif
BuildPortals (*fs);
//****************************************** T-Basis
{
FPU::m64r ();
Phase ("Building tangent-basis...");
xrPhase_TangentBasis ();
mem_Compact ();
}
//****************************************** GLOBAL-RayCast model
FPU::m64r ();
Phase ("Building rcast-CFORM model...");
mem_Compact ();
Light_prepare ();
BuildRapid (TRUE);
//****************************************** GLOBAL-ILLUMINATION
if (b_radiosity)
{
FPU::m64r ();
Phase ("Radiosity-Solver...");
mem_Compact ();
Light_prepare ();
xrPhase_Radiosity ();
}
//****************************************** Starting MU
FPU::m64r ();
Phase ("LIGHT: Starting MU...");
mem_Compact ();
Light_prepare ();
mu_base.start (xr_new<CMUThread> (0));
//****************************************** Resolve materials
FPU::m64r ();
Phase ("Resolving materials...");
mem_Compact ();
xrPhase_ResolveMaterials ();
//.........这里部分代码省略.........
示例11: SaveSelection
void EScenePSTools::SaveSelection(IWriter& F)
{
F.w_chunk (CHUNK_VERSION,(u16*)&PS_TOOLS_VERSION,sizeof(PS_TOOLS_VERSION));
inherited::SaveSelection(F);
}
示例12: Save
void CBone::Save(IWriter& F)
{
F.open_chunk (BONE_CHUNK_VERSION);
F.w_u16 (BONE_VERSION);
F.close_chunk ();
F.open_chunk (BONE_CHUNK_DEF);
F.w_stringZ (name);
F.w_stringZ (parent_name);
F.w_stringZ (wmap);
F.close_chunk ();
F.open_chunk (BONE_CHUNK_BIND_POSE);
F.w_fvector3 (rest_offset);
F.w_fvector3 (rest_rotate);
F.w_float (rest_length);
F.close_chunk ();
SaveData (F);
}
示例13: Save
void CGroupObject::Save(IWriter& F)
{
CCustomObject::Save(F);
F.open_chunk (GROUPOBJ_CHUNK_VERSION);
F.w_u16 (GROUPOBJ_CURRENT_VERSION);
F.close_chunk ();
F.w_chunk (GROUPOBJ_CHUNK_FLAGS,&m_Flags,sizeof(m_Flags));
// objects
if (IsOpened()){
F.open_chunk(GROUPOBJ_CHUNK_OPEN_OBJECT_LIST);
F.w_u32 (m_Objects.size());
for (ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); it++)
F.w_stringZ ((*it)->Name);
F.close_chunk ();
}else{
Scene->SaveObjects(m_Objects,GROUPOBJ_CHUNK_OBJECT_LIST,F);
}
F.open_chunk (GROUPOBJ_CHUNK_REFERENCE);
F.w_stringZ (m_ReferenceName);
F.close_chunk ();
}
示例14: WriteStateVariable
void DviProtocolUpnpServiceXmlWriter::WriteStateVariable(IWriter& aWriter, const OpenHome::Net::Parameter& aParam, TBool aEvented, const Action* aAction)
{
aWriter.Write(Brn("<stateVariable sendEvents="));
if (aEvented) {
aWriter.Write(Brn("\"yes\">"));
}
else {
aWriter.Write(Brn("\"no\">"));
}
aWriter.Write(Brn("<name>"));
if (aEvented) {
aWriter.Write(aParam.Name());
}
else {
Bwh name;
GetRelatedVariableName(name, aAction->Name(), aParam.Name());
aWriter.Write(name);
}
aWriter.Write(Brn("</name>"));
aWriter.Write(Brn("<dataType>"));
switch (aParam.Type())
{
case OpenHome::Net::Parameter::eTypeBool:
aWriter.Write(Brn("boolean"));
break;
case OpenHome::Net::Parameter::eTypeInt:
aWriter.Write(Brn("i4"));
break;
case OpenHome::Net::Parameter::eTypeUint:
aWriter.Write(Brn("ui4"));
break;
case OpenHome::Net::Parameter::eTypeString:
aWriter.Write(Brn("string"));
break;
case OpenHome::Net::Parameter::eTypeBinary:
aWriter.Write(Brn("bin.base64"));
break;
case OpenHome::Net::Parameter::eTypeRelated:
ASSERTS();
break;
}
aWriter.Write(Brn("</dataType>"));
switch (aParam.Type())
{
case OpenHome::Net::Parameter::eTypeBool:
case OpenHome::Net::Parameter::eTypeBinary:
break;
case OpenHome::Net::Parameter::eTypeInt:
{
const OpenHome::Net::ParameterInt& paramInt = static_cast<const OpenHome::Net::ParameterInt&>(aParam);
if (paramInt.MinValue() != ParameterInt::kValueMin ||
paramInt.MaxValue() != ParameterInt::kValueMax ||
paramInt.Step() != ParameterInt::kStep) {
aWriter.Write(Brn("<allowedValueRange>"));
aWriter.Write(Brn("<minimum>"));
WriterAscii writerAscii(aWriter);
writerAscii.WriteInt(paramInt.MinValue());
aWriter.Write(Brn("</minimum>"));
aWriter.Write(Brn("<maximum>"));
writerAscii.WriteInt(paramInt.MaxValue());
aWriter.Write(Brn("</maximum>"));
aWriter.Write(Brn("<step>"));
writerAscii.WriteInt(paramInt.Step());
aWriter.Write(Brn("</step>"));
aWriter.Write(Brn("</allowedValueRange>"));
}
}
break;
case OpenHome::Net::Parameter::eTypeUint:
{
const OpenHome::Net::ParameterUint& paramUint = static_cast<const OpenHome::Net::ParameterUint&>(aParam);
if (paramUint.MinValue() != ParameterUint::kValueMin ||
paramUint.MaxValue() != ParameterUint::kValueMax ||
paramUint.Step() != ParameterUint::kStep) {
aWriter.Write(Brn("<allowedValueRange>"));
aWriter.Write(Brn("<minimum>"));
WriterAscii writerAscii(aWriter);
writerAscii.WriteUint(paramUint.MinValue());
aWriter.Write(Brn("</minimum>"));
aWriter.Write(Brn("<maximum>"));
writerAscii.WriteUint(paramUint.MaxValue());
aWriter.Write(Brn("</maximum>"));
aWriter.Write(Brn("<step>"));
writerAscii.WriteUint(paramUint.Step());
aWriter.Write(Brn("</step>"));
aWriter.Write(Brn("</allowedValueRange>"));
}
}
break;
case OpenHome::Net::Parameter::eTypeString:
{
const OpenHome::Net::ParameterString& paramStr = static_cast<const OpenHome::Net::ParameterString&>(aParam);
const ParameterString::Map& allowedVals = paramStr.AllowedValues();
if (allowedVals.size() > 0) {
aWriter.Write(Brn("<allowedValueList>"));
ParameterString::Map::const_iterator it = allowedVals.begin();
while (it != allowedVals.end()) {
aWriter.Write(Brn("<allowedValue>"));
aWriter.Write(*(it->second));
aWriter.Write(Brn("</allowedValue>"));
//.........这里部分代码省略.........
示例15: SaveSelection
void ESceneSpawnTool::SaveSelection(IWriter& F)
{
F.w_chunk (CHUNK_VERSION,(u16*)&SPAWN_TOOLS_VERSION,sizeof(SPAWN_TOOLS_VERSION));
inherited::SaveSelection(F);
}