本文整理汇总了C++中TMap::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ TMap::Clear方法的具体用法?C++ TMap::Clear怎么用?C++ TMap::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMap
的用法示例。
在下文中一共展示了TMap::Clear方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteMergeObjects
void WriteMergeObjects( TFile *target ) {
cout << "Writing the merged data." << endl;
TIterator *nextobj = MergeObjects.MakeIterator();
TObjString *pathname_obj;
while( (pathname_obj = (TObjString *)nextobj->Next()) ) {
TString path,name;
SplitPathName(pathname_obj->String(),&path,&name);
TObject *obj = MergeObjects.GetValue(pathname_obj);
target->cd(path);
obj->Write( name );
delete obj;
}
MergeObjects.Clear();
target->Write();
// Temporarily let multiple root files remain if > 2GB
// Prevent Target_1.root Target_2.root, ... from happening.
// long long max_tree_size = 200000000000LL; // 200 GB
// if(TTree::GetMaxTreeSize() < max_tree_size ) {
// TTree::SetMaxTreeSize(max_tree_size);
// }
nextobj = MergeChains.MakeIterator();
TObjString *pathname_obj;
while( (pathname_obj = (TObjString *)nextobj->Next()) ) {
TString path,name;
SplitPathName(pathname_obj->String(),&path,&name);
TChain *ch = (TChain *)MergeChains.GetValue(pathname_obj);
target->cd(path);
ch->Merge(target,0,"KEEP");
delete ch;
// in case of multiple objects with same pathname, must remove
// this one from the list so we don't get the same (deleted)
// one next time we look up the same name
MergeChains.Remove(pathname_obj);
}
MergeChains.Clear();
InitializedMergeObjects = false;
}
示例2: P_ReadDemoWeaponsChunk
void P_ReadDemoWeaponsChunk(BYTE **demo)
{
int count, i;
PClassWeapon *type;
const char *s;
count = ReadWord(demo);
Weapons_ntoh.Resize(count);
Weapons_hton.Clear(count);
Weapons_ntoh[0] = type = NULL;
Weapons_hton[type] = 0;
for (i = 1; i < count; ++i)
{
s = ReadStringConst(demo);
type = dyn_cast<PClassWeapon>(PClass::FindClass(s));
// If a demo was recorded with a weapon that is no longer present,
// should we report it?
Weapons_ntoh[i] = type;
if (type != NULL)
{
Weapons_hton[type] = i;
}
}
}
示例3: P_SetupWeapons_ntohton
void P_SetupWeapons_ntohton()
{
unsigned int i;
PClassWeapon *cls;
Weapons_ntoh.Clear();
Weapons_hton.Clear();
cls = NULL;
Weapons_ntoh.Push(cls); // Index 0 is always NULL.
for (i = 0; i < PClassActor::AllActorClasses.Size(); ++i)
{
PClassActor *cls = PClassActor::AllActorClasses[i];
if (cls->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
Weapons_ntoh.Push(static_cast<PClassWeapon *>(cls));
}
}
qsort(&Weapons_ntoh[1], Weapons_ntoh.Size() - 1, sizeof(Weapons_ntoh[0]), ntoh_cmp);
for (i = 0; i < Weapons_ntoh.Size(); ++i)
{
Weapons_hton[Weapons_ntoh[i]] = i;
}
}
示例4: P_SetupWeapons_ntohton
void P_SetupWeapons_ntohton()
{
unsigned int i;
const PClass *cls;
Weapons_ntoh.Clear();
Weapons_hton.Clear();
cls = NULL;
Weapons_ntoh.Push(cls); // Index 0 is always NULL.
for (i = 0; i < PClass::m_Types.Size(); ++i)
{
PClass *cls = PClass::m_Types[i];
if (cls->ActorInfo != NULL && cls->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
Weapons_ntoh.Push(cls);
}
}
qsort(&Weapons_ntoh[1], Weapons_ntoh.Size() - 1, sizeof(Weapons_ntoh[0]), ntoh_cmp);
for (i = 0; i < Weapons_ntoh.Size(); ++i)
{
Weapons_hton[Weapons_ntoh[i]] = i;
}
}
示例5: R_ParseTrnslate
void R_ParseTrnslate()
{
customTranslationMap.Clear();
translationtables[TRANSLATION_Custom].Clear();
int lump;
int lastlump = 0;
while (-1 != (lump = Wads.FindLump("TRNSLATE", &lastlump)))
{
FScanner sc(lump);
while (sc.GetToken())
{
sc.TokenMustBe(TK_Identifier);
FName newtrans = sc.String;
FRemapTable *base = nullptr;
if (sc.CheckToken(':'))
{
sc.MustGetAnyToken();
if (sc.TokenType == TK_IntConst)
{
int max = 6;
if (sc.Number < 0 || sc.Number > max)
{
sc.ScriptError("Translation must be in the range [0,%d]", max);
}
base = translationtables[TRANSLATION_Standard][sc.Number];
}
else if (sc.TokenType == TK_Identifier)
{
int tnum = R_FindCustomTranslation(sc.String);
if (tnum == -1)
{
sc.ScriptError("Base translation '%s' not found in '%s'", sc.String, newtrans.GetChars());
}
base = translationtables[GetTranslationType(tnum)][GetTranslationIndex(tnum)];
}
else
{
// error out.
sc.TokenMustBe(TK_Identifier);
}
}
sc.MustGetToken('=');
FRemapTable NewTranslation;
if (base != nullptr) NewTranslation = *base;
else NewTranslation.MakeIdentity();
do
{
sc.MustGetToken(TK_StringConst);
NewTranslation.AddToTranslation(sc.String);
} while (sc.CheckToken(','));
int trans = NewTranslation.StoreTranslation(TRANSLATION_Custom);
customTranslationMap[newtrans] = trans;
}
}
}
示例6: LoadActors
void LoadActors()
{
cycle_t timer;
timer.Reset(); timer.Clock();
FScriptPosition::ResetErrorCounter();
InitThingdef();
FScriptPosition::StrictErrors = true;
ParseScripts();
FScriptPosition::StrictErrors = false;
ParseAllDecorate();
FunctionBuildList.Build();
if (FScriptPosition::ErrorCounter > 0)
{
I_Error("%d errors while parsing DECORATE scripts", FScriptPosition::ErrorCounter);
}
FScriptPosition::ResetErrorCounter();
for (int i = PClassActor::AllActorClasses.Size() - 1; i >= 0; i--)
{
auto ti = PClassActor::AllActorClasses[i];
if (ti->Size == TentativeClass)
{
if (ti->ObjectFlags & OF_Transient)
{
Printf(TEXTCOLOR_ORANGE "Class %s referenced but not defined\n", ti->TypeName.GetChars());
FScriptPosition::WarnCounter++;
DObject::StaticPointerSubstitution(ti, nullptr);
PClassActor::AllActorClasses.Delete(i);
}
else
{
Printf(TEXTCOLOR_RED "Class %s referenced but not defined\n", ti->TypeName.GetChars());
FScriptPosition::ErrorCounter++;
}
continue;
}
if (GetDefaultByType(ti) == nullptr)
{
Printf(TEXTCOLOR_RED "No ActorInfo defined for class '%s'\n", ti->TypeName.GetChars());
FScriptPosition::ErrorCounter++;
continue;
}
CheckStates(ti);
if (ti->bDecorateClass && ti->IsDescendantOf(RUNTIME_CLASS(AStateProvider)))
{
// either a DECORATE based weapon or CustomInventory.
// These are subject to relaxed rules for user variables in states.
// Although there is a runtime check for bogus states, let's do a quick analysis if any of the known entry points
// hits an unsafe state. If we can find something here it can be handled wuth a compile error rather than a runtime error.
CheckForUnsafeStates(ti);
}
}
if (FScriptPosition::ErrorCounter > 0)
{
I_Error("%d errors during actor postprocessing", FScriptPosition::ErrorCounter);
}
timer.Unclock();
if (!batchrun) Printf("script parsing took %.2f ms\n", timer.TimeMS());
// Since these are defined in DECORATE now the table has to be initialized here.
for (int i = 0; i < 31; i++)
{
char fmt[20];
mysnprintf(fmt, countof(fmt), "QuestItem%d", i + 1);
QuestItemClasses[i] = PClass::FindActor(fmt);
}
StateSourceLines.Clear();
}
示例7: ParseCompatibility
void ParseCompatibility()
{
TArray<FMD5Holder> md5array;
FMD5Holder md5;
FCompatValues flags;
int i, x;
unsigned int j;
BCompatMap.Clear();
CompatParams.Clear();
// The contents of this file are not cumulative, as it should not
// be present in user-distributed maps.
FScanner sc(Wads.GetNumForFullName("compatibility.txt"));
while (sc.GetString()) // Get MD5 signature
{
do
{
if (strlen(sc.String) != 32)
{
sc.ScriptError("MD5 signature must be exactly 32 characters long");
}
for (i = 0; i < 32; ++i)
{
if (sc.String[i] >= '0' && sc.String[i] <= '9')
{
x = sc.String[i] - '0';
}
else
{
sc.String[i] |= 'a' ^ 'A';
if (sc.String[i] >= 'a' && sc.String[i] <= 'f')
{
x = sc.String[i] - 'a' + 10;
}
else
{
x = 0;
sc.ScriptError("MD5 signature must be a hexadecimal value");
}
}
if (!(i & 1))
{
md5.Bytes[i / 2] = x << 4;
}
else
{
md5.Bytes[i / 2] |= x;
}
}
md5array.Push(md5);
sc.MustGetString();
} while (!sc.Compare("{"));
memset(flags.CompatFlags, 0, sizeof(flags.CompatFlags));
flags.ExtCommandIndex = ~0u;
while (sc.GetString())
{
if ((i = sc.MatchString(&Options[0].Name, sizeof(*Options))) >= 0)
{
flags.CompatFlags[Options[i].WhichSlot] |= Options[i].CompatFlags;
}
else if (sc.Compare("clearlineflags"))
{
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
CompatParams.Push(CP_CLEARFLAGS);
sc.MustGetNumber();
CompatParams.Push(sc.Number);
sc.MustGetNumber();
CompatParams.Push(sc.Number);
}
else if (sc.Compare("setlineflags"))
{
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
CompatParams.Push(CP_SETFLAGS);
sc.MustGetNumber();
CompatParams.Push(sc.Number);
sc.MustGetNumber();
CompatParams.Push(sc.Number);
}
else if (sc.Compare("setlinespecial"))
{
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
CompatParams.Push(CP_SETSPECIAL);
sc.MustGetNumber();
CompatParams.Push(sc.Number);
sc.MustGetString();
CompatParams.Push(P_FindLineSpecial(sc.String, NULL, NULL));
for (int i = 0; i < 5; i++)
{
sc.MustGetNumber();
CompatParams.Push(sc.Number);
}
}
else if (sc.Compare("clearlinespecial"))
{
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
CompatParams.Push(CP_CLEARSPECIAL);
sc.MustGetNumber();
//.........这里部分代码省略.........
示例8: ParseCompatibility
void ParseCompatibility()
{
TArray<FMD5Holder> md5array;
FMD5Holder md5;
FCompatValues flags;
int i, x;
unsigned int j;
BCompatMap.Clear();
CompatParams.Clear();
// The contents of this file are not cumulative, as it should not
// be present in user-distributed maps.
FScanner sc(Wads.GetNumForFullName("compatibility.txt"));
while (sc.GetString()) // Get MD5 signature
{
do
{
if (strlen(sc.String) != 32)
{
sc.ScriptError("MD5 signature must be exactly 32 characters long");
}
for (i = 0; i < 32; ++i)
{
if (sc.String[i] >= '0' && sc.String[i] <= '9')
{
x = sc.String[i] - '0';
}
else
{
sc.String[i] |= 'a' ^ 'A';
if (sc.String[i] >= 'a' && sc.String[i] <= 'f')
{
x = sc.String[i] - 'a' + 10;
}
else
{
x = 0;
sc.ScriptError("MD5 signature must be a hexadecimal value");
}
}
if (!(i & 1))
{
md5.Bytes[i / 2] = x << 4;
}
else
{
md5.Bytes[i / 2] |= x;
}
}
md5array.Push(md5);
sc.MustGetString();
} while (!sc.Compare("{"));
memset(flags.CompatFlags, 0, sizeof(flags.CompatFlags));
flags.ExtCommandIndex = ~0u;
while (sc.GetString())
{
if ((i = sc.MatchString(&Options[0].Name, sizeof(*Options))) >= 0)
{
flags.CompatFlags[Options[i].WhichSlot] |= Options[i].CompatFlags;
}
else if (sc.Compare("clearlineflags"))
{
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
CompatParams.Push(CP_CLEARFLAGS);
sc.MustGetNumber();
CompatParams.Push(sc.Number);
sc.MustGetNumber();
CompatParams.Push(sc.Number);
}
else if (sc.Compare("setlineflags"))
{
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
CompatParams.Push(CP_SETFLAGS);
sc.MustGetNumber();
CompatParams.Push(sc.Number);
sc.MustGetNumber();
CompatParams.Push(sc.Number);
}
else if (sc.Compare("setlinespecial"))
{
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
CompatParams.Push(CP_SETSPECIAL);
sc.MustGetNumber();
CompatParams.Push(sc.Number);
sc.MustGetString();
CompatParams.Push(P_FindLineSpecial(sc.String, NULL, NULL));
for (int i = 0; i < 5; i++)
{
sc.MustGetNumber();
CompatParams.Push(sc.Number);
}
}
else if (sc.Compare("clearlinespecial"))
{
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
CompatParams.Push(CP_CLEARSPECIAL);
sc.MustGetNumber();
//.........这里部分代码省略.........
示例9: COOP_ClearStoredUVDPickups
//*****************************************************************************
//
void COOP_ClearStoredUVDPickups ( )
{
UVDpickupMap.Clear();
}
示例10: ClearRemaps
void LumpRemapper::ClearRemaps()
{
sampleRateMap.Clear();
remaps.Clear();
psprites.Clear();
}