本文整理汇总了C++中FName::GetChars方法的典型用法代码示例。如果您正苦于以下问题:C++ FName::GetChars方法的具体用法?C++ FName::GetChars怎么用?C++ FName::GetChars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FName
的用法示例。
在下文中一共展示了FName::GetChars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetReplacement
void SetReplacement(FScanner &sc, FActorInfo *info, FName replaceName)
{
// Check for "replaces"
if (replaceName != NAME_None)
{
// Get actor name
const PClass *replacee = PClass::FindClass (replaceName);
if (replacee == NULL)
{
sc.ScriptMessage("Replaced type '%s' not found for %s", replaceName.GetChars(), info->Class->TypeName.GetChars());
return;
}
else if (replacee->ActorInfo == NULL)
{
sc.ScriptMessage("Replaced type '%s' for %s is not an actor", replaceName.GetChars(), info->Class->TypeName.GetChars());
return;
}
if (replacee != NULL)
{
replacee->ActorInfo->Replacement = info;
info->Replacee = replacee->ActorInfo;
}
}
}
示例2: ParseFunctionDef
void ParseFunctionDef(FScanner &sc, PClassActor *cls, FName funcname,
TArray<PType *> &rets, DWORD funcflags)
{
assert(cls != NULL);
const AFuncDesc *afd;
TArray<PType *> args;
TArray<DWORD> argflags;
afd = FindFunction(funcname);
if (afd == NULL)
{
sc.ScriptMessage ("The function '%s' has not been exported from the executable.", funcname.GetChars());
FScriptPosition::ErrorCounter++;
}
sc.MustGetToken('(');
SetImplicitArgs(&args, &argflags, cls, funcflags);
ParseArgListDef(sc, cls, args, argflags);
if (afd != NULL)
{
PFunction *sym = new PFunction(funcname);
sym->AddVariant(NewPrototype(rets, args), argflags, *(afd->VMPointer));
sym->Flags = funcflags;
if (cls->Symbols.AddSymbol(sym) == NULL)
{
delete sym;
sc.ScriptMessage ("'%s' is already defined in class '%s'.",
funcname.GetChars(), cls->TypeName.GetChars());
FScriptPosition::ErrorCounter++;
}
}
}
示例3: AddName
void AddName(FName name)
{
size_t namelen = strlen(name.GetChars());
CheckWrap(namelen + 2 + NeedSpace);
if (NeedSpace)
{
NeedSpace = false;
Str << ' ';
}
Str << '\'' << name.GetChars() << '\'';
Column += namelen + 2 + NeedSpace;
NeedSpace = true;
}
示例4: PSymbol
PField::PField(FName name, PType *type, uint32_t flags, size_t offset, int bitvalue)
: PSymbol(name), Offset(offset), Type(type), Flags(flags)
{
if (bitvalue != 0)
{
BitValue = 0;
unsigned val = bitvalue;
while ((val >>= 1)) BitValue++;
if (type->isInt() && unsigned(BitValue) < 8u * type->Size)
{
// map to the single bytes in the actual variable. The internal bit instructions operate on 8 bit values.
#ifndef __BIG_ENDIAN__
Offset += BitValue / 8;
#else
Offset += type->Size - 1 - BitValue / 8;
#endif
BitValue &= 7;
Type = TypeBool;
}
else
{
// Just abort. Bit fields should only be defined internally.
I_Error("Trying to create an invalid bit field element: %s", name.GetChars());
}
}
示例5:
FActorInfo *FActorInfo::GetReplacee (bool lookskill)
{
FName skillrepname;
if (lookskill && AllSkills.Size() > (unsigned)gameskill)
{
skillrepname = AllSkills[gameskill].GetReplacedBy(this->Class->TypeName);
if (skillrepname != NAME_None && PClass::FindClass(skillrepname) == NULL)
{
Printf("Warning: incorrect actor name in definition of skill %s: \n"
"non-existent class %s is replaced by class %s\n"
"Skill replacement will be ignored for this actor.\n",
AllSkills[gameskill].Name.GetChars(),
skillrepname.GetChars(), this->Class->TypeName.GetChars());
AllSkills[gameskill].SetReplacedBy(this->Class->TypeName, NAME_None);
AllSkills[gameskill].SetReplacement(skillrepname, NAME_None);
lookskill = false;
}
}
if (Replacee == NULL && (!lookskill || skillrepname == NAME_None))
{
return this;
}
// The Replacee field is temporarily NULLed to prevent
// potential infinite recursion.
FActorInfo *savedrep = Replacee;
Replacee = NULL;
FActorInfo *rep = savedrep;
if (lookskill && (skillrepname != NAME_None) && (PClass::FindClass(skillrepname) != NULL))
{
rep = PClass::FindClass(skillrepname)->ActorInfo;
}
rep = rep->GetReplacee (false); Replacee = savedrep;
return rep;
}
示例6: ParseEnum
static void ParseEnum (FScanner &sc, PSymbolTable *symt, PClass *cls)
{
int currvalue = 0;
sc.MustGetToken('{');
while (!sc.CheckToken('}'))
{
sc.MustGetToken(TK_Identifier);
FName symname = sc.String;
if (sc.CheckToken('='))
{
FxExpression *expr = ParseExpression (sc, cls);
currvalue = expr->EvalExpression(NULL).GetInt();
delete expr;
}
PSymbolConst *sym = new PSymbolConst(symname);
sym->ValueType = VAL_Int;
sym->Value = currvalue;
if (symt->AddSymbol (sym) == NULL)
{
delete sym;
sc.ScriptMessage ("'%s' is already defined in '%s'.",
symname.GetChars(), cls? cls->TypeName.GetChars() : "Global");
FScriptPosition::ErrorCounter++;
}
// This allows a comma after the last value but doesn't enforce it.
if (sc.CheckToken('}')) break;
sc.MustGetToken(',');
currvalue++;
}
sc.MustGetToken(';');
}
示例7: 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;
}
}
}
示例8: func
ActionInfo::ActionInfo(ActionPtr func, const FName &name) : func(func), name(name),
minArgs(0), maxArgs(0), varArgs(false)
{
if(actionFunctions == NULL)
actionFunctions = new ActionTable;
#if 0
// Debug code - Show registered action functions
printf("Adding %s @ %d\n", name.GetChars(), actionFunctions->Size());
#endif
actionFunctions->Push(this);
}
示例9: ParseEnum
static void ParseEnum (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
{
int currvalue = 0;
sc.MustGetToken('{');
while (!sc.CheckToken('}'))
{
sc.MustGetToken(TK_Identifier);
FName symname = sc.String;
if (sc.CheckToken('='))
{
FxExpression *expr = ParseExpression (sc, cls, true);
if (!expr->isConstant())
{
sc.ScriptMessage("'%s' must be constant", symname.GetChars());
FScriptPosition::ErrorCounter++;
}
else
{
currvalue = static_cast<FxConstant *>(expr)->GetValue().GetInt();
}
delete expr;
}
PSymbolConstNumeric *sym = new PSymbolConstNumeric(symname, TypeSInt32);
sym->Value = currvalue;
if (symt->AddSymbol (sym) == NULL)
{
delete sym;
sc.ScriptMessage ("'%s' is already defined in '%s'.",
symname.GetChars(), cls? cls->TypeName.GetChars() : "Global");
FScriptPosition::ErrorCounter++;
}
// This allows a comma after the last value but doesn't enforce it.
if (sc.CheckToken('}')) break;
sc.MustGetToken(',');
currvalue++;
}
sc.MustGetToken(';');
}
示例10: AddNamedNode
bool ZCCCompiler::AddNamedNode(FName name, ZCC_TreeNode *node)
{
ZCC_TreeNode **check = NamedNodes.CheckKey(name);
if (check != NULL && *check != NULL)
{
Message(node, ERR_symbol_redefinition, "Attempt to redefine '%s'", name.GetChars());
Message(*check, ERR_original_definition, " Original definition is here");
return false;
}
else
{
NamedNodes.Insert(name, node);
return true;
}
}
示例11: ParseConstant
static void ParseConstant (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
{
// Read the type and make sure it's int or float.
if (sc.CheckToken(TK_Int) || sc.CheckToken(TK_Float))
{
int type = sc.TokenType;
sc.MustGetToken(TK_Identifier);
FName symname = sc.String;
sc.MustGetToken('=');
FxExpression *expr = ParseExpression (sc, cls, true);
sc.MustGetToken(';');
if (!expr->isConstant())
{
sc.ScriptMessage("Constant definition is not a constant");
FScriptPosition::ErrorCounter++;
}
else
{
ExpVal val = static_cast<FxConstant *>(expr)->GetValue();
delete expr;
PSymbolConstNumeric *sym;
if (type == TK_Int)
{
sym = new PSymbolConstNumeric(symname, TypeSInt32);
sym->Value = val.GetInt();
}
else
{
sym = new PSymbolConstNumeric(symname, TypeFloat64);
sym->Float = val.GetFloat();
}
if (symt->AddSymbol (sym) == NULL)
{
delete sym;
sc.ScriptMessage ("'%s' is already defined in '%s'.",
symname.GetChars(), cls? cls->TypeName.GetChars() : "Global");
FScriptPosition::ErrorCounter++;
}
}
}
else
{
sc.ScriptMessage("Numeric type required for constant");
FScriptPosition::ErrorCounter++;
}
}
示例12:
PClassActor *PClassActor::GetReplacement(bool lookskill)
{
FName skillrepname;
if (lookskill && AllSkills.Size() > (unsigned)gameskill)
{
skillrepname = AllSkills[gameskill].GetReplacement(TypeName);
if (skillrepname != NAME_None && PClass::FindClass(skillrepname) == NULL)
{
Printf("Warning: incorrect actor name in definition of skill %s: \n"
"class %s is replaced by non-existent class %s\n"
"Skill replacement will be ignored for this actor.\n",
AllSkills[gameskill].Name.GetChars(),
TypeName.GetChars(), skillrepname.GetChars());
AllSkills[gameskill].SetReplacement(TypeName, NAME_None);
AllSkills[gameskill].SetReplacedBy(skillrepname, NAME_None);
lookskill = false; skillrepname = NAME_None;
}
}
if (Replacement == NULL && (!lookskill || skillrepname == NAME_None))
{
return this;
}
// The Replacement field is temporarily NULLed to prevent
// potential infinite recursion.
PClassActor *savedrep = Replacement;
Replacement = NULL;
PClassActor *rep = savedrep;
// Handle skill-based replacement here. It has precedence on DECORATE replacement
// in that the skill replacement is applied first, followed by DECORATE replacement
// on the actor indicated by the skill replacement.
if (lookskill && (skillrepname != NAME_None))
{
rep = PClass::FindActor(skillrepname);
}
// Now handle DECORATE replacement chain
// Skill replacements are not recursive, contrarily to DECORATE replacements
rep = rep->GetReplacement(false);
// Reset the temporarily NULLed field
Replacement = savedrep;
return rep;
}
示例13: SetReplacement
void SetReplacement(FScanner &sc, PClassActor *info, FName replaceName)
{
// Check for "replaces"
if (replaceName != NAME_None)
{
// Get actor name
PClassActor *replacee = PClass::FindActor(replaceName);
if (replacee == NULL)
{
sc.ScriptMessage("Replaced type '%s' not found for %s", replaceName.GetChars(), info->TypeName.GetChars());
return;
}
if (replacee != NULL)
{
replacee->Replacement = info;
info->Replacee = replacee;
}
}
}
示例14: ParseConstant
static void ParseConstant (FScanner &sc, PSymbolTable * symt, PClass *cls)
{
// Read the type and make sure it's int or float.
if (sc.CheckToken(TK_Int) || sc.CheckToken(TK_Float))
{
int type = sc.TokenType;
sc.MustGetToken(TK_Identifier);
FName symname = sc.String;
sc.MustGetToken('=');
FxExpression *expr = ParseExpression (sc, cls);
sc.MustGetToken(';');
ExpVal val = expr->EvalExpression(NULL);
delete expr;
PSymbolConst *sym = new PSymbolConst(symname);
if (type == TK_Int)
{
sym->ValueType = VAL_Int;
sym->Value = val.GetInt();
}
else
{
sym->ValueType = VAL_Float;
sym->Float = val.GetFloat();
}
if (symt->AddSymbol (sym) == NULL)
{
delete sym;
sc.ScriptMessage ("'%s' is already defined in '%s'.",
symname.GetChars(), cls? cls->TypeName.GetChars() : "Global");
FScriptPosition::ErrorCounter++;
}
}
else
{
sc.ScriptMessage("Numeric type required for constant");
FScriptPosition::ErrorCounter++;
}
}
示例15: FName
static void CastN2S(FString *a, int b) { FName name = FName(ENamedName(b)); *a = name.IsValidName() ? name.GetChars() : ""; }