本文整理汇总了C++中Tag::ID方法的典型用法代码示例。如果您正苦于以下问题:C++ Tag::ID方法的具体用法?C++ Tag::ID怎么用?C++ Tag::ID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::ID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadData
void DefineSprite::ReadData(SWFReader *swf, int length){
mSprite.SpriteID = swf->ReadUI16();
printf(" SpriteID = %d\n", mSprite.SpriteID );
mSprite.FrameCount = swf->ReadUI16();
printf(" FrameCount = %d\n", mSprite.FrameCount );
printf(" ----------------------------------------\n");
mSprite.TagList.clear();
Tag *p;
do {
printf(" ");
p = new Tag(swf);
mSprite.TagList.push_back(*p);
} while (p->ID() != 0);
list<Tag>::iterator i;
int iContentsLength = 0;
for (i = mSprite.TagList.begin(); i != mSprite.TagList.end(); ++i) {
iContentsLength += (*i).GetLength();
}
printf(" # Content length in this Sprite = %d\n", iContentsLength);
printf(" ----------------------------------------\n");
}
示例2: ReplaceSprite
void DefineSprite::ReplaceSprite(list<Tag>* pMainTagList, const char* szFile){
#if 1
Tag* _TagList_Definitions[256];
Tag* _TagList_4Sprite[256];
Header _Header;
int iDefCount = 0;
int iActionScount = 0;
// 1. Read in new Tag list from file
FILE* fp = fopen(szFile, "rb");
if( NULL==fp ){
printf("Open file (%s)error\n", szFile);
return;
}
unsigned char *Buf=0;
fseek(fp, 0L, SEEK_END);
long lfilesize = ftell(fp);
Buf = (unsigned char *)malloc(lfilesize);
if(Buf){
fseek(fp, 0L, SEEK_SET);
fread(Buf, 1, lfilesize, fp);
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// 1) Read in the new Tag contents in the file
SWFReader* swf = new SWFReader(Buf);
_Header.Read(swf);
Tag* p;
do {
p = new Tag(swf);
if( p->ID()>0 ){
/*
The following tags are valid within a DefineSprite tag:
. ShowFrame(1) . StartSound(15)
. PlaceObject(4) . FrameLabel(43)
. PlaceObject2(26) . SoundStreamHead(18)
. RemoveObject(5) . SoundStreamHead2(45)
. RemoveObject2(28) . SoundStreamBlock(19)
. All Actions (see Actions)(12, 59) . End(0)
*/
if( p->ID()==1 || p->ID()==15 || p->ID()==4 || p->ID()==43 ||
p->ID()==26 || p->ID()==18 || p->ID()==5 || p->ID()==45 ||
p->ID()==28 || p->ID()==19 || p->ID()==12 || p->ID()==59 )
{
_TagList_4Sprite[iActionScount++] = p;
}
else{
// 9 : SetBackgroundColor
if( p->ID()!=9 ){
_TagList_Definitions[iDefCount++] = p;
}
}
}
else{
_TagList_4Sprite[iActionScount++] = p;
}
} while (p->ID() != 0);
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
free(Buf);
}
fclose(fp);
//-----------------------------------------------------
// 2) Increase the Character IDs in the original list.
list<Tag>::iterator i;
for (i = pMainTagList->begin(); i != pMainTagList->end(); ++i) {
(*i).GetTagContent()->IncreaseCharacterID( iDefCount );
}
//-----------------------------------------------------
//-----------------------------------------------------
// 3) Inject the new Definition Tags into this original Tag list
for( int j=iDefCount-1; j>=0; j-- ){
//list<Tag>::iterator j;
//for (j = _TagList_Definitions.end(); j != _TagList_Definitions.begin(); --j) {
// pMainTagList->push_front( *j );
pMainTagList->insert( ++pMainTagList->begin(), *_TagList_Definitions[j] );
}
//pMainTagList->insert( pMainTagList->begin(), _TagList_Definitions.begin(), _TagList_Definitions.end());
//-----------------------------------------------------
//-----------------------------------------------------
// 4) Inject the new Action and other Tags for this Sprite
list<Tag>::iterator k;
mSprite.FrameCount = _Header.FrameCount();
mSprite.TagList.clear();
int iContentsLength = 0;
for( int k=iActionScount-1; k>=0; k-- ){
//for (k = _TagList_4Sprite.begin(); k != _TagList_4Sprite.end(); ++k) {
//mSprite.TagList.push_back( *k );
//.........这里部分代码省略.........