本文整理汇总了C++中C4Value::getStr方法的典型用法代码示例。如果您正苦于以下问题:C++ C4Value::getStr方法的具体用法?C++ C4Value::getStr怎么用?C++ C4Value::getStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C4Value
的用法示例。
在下文中一共展示了C4Value::getStr方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void C4Effect::SetPropertyByS(C4String * k, const C4Value & to)
{
if (k >= &Strings.P[0] && k < &Strings.P[P_LAST])
{
switch(k - &Strings.P[0])
{
case P_Name:
if (!to.getStr() || !*to.getStr()->GetCStr())
throw C4AulExecError("effect: Name has to be a nonempty string");
C4PropListNumbered::SetPropertyByS(k, to);
ReAssignCallbackFunctions();
return;
case P_Priority:
throw C4AulExecError("effect: Priority is readonly");
case P_Interval: iInterval = to.getInt(); return;
case P_CommandTarget:
throw C4AulExecError("effect: CommandTarget is readonly");
case P_Target:
throw C4AulExecError("effect: Target is readonly");
case P_Time: iTime = to.getInt(); return;
case P_Prototype:
throw new C4AulExecError("effect: Prototype is readonly");
}
}
C4PropListNumbered::SetPropertyByS(k, to);
}
示例2: operator
bool operator ()(const C4Value &v1, const C4Value &v2)
{
// sort by whatever type the values have
if (v1.getStr() && v2.getStr()) return v1._getStr()->GetData() < v2._getStr()->GetData();
if (v1.CheckConversion(C4V_Int) && v2.CheckConversion(C4V_Int)) return v1._getInt() < v2._getInt();
return false;
}
示例3:
void C4MapScriptMatTexMask::Init(const C4Value &spec)
{
// Mask may be initialized by a simple string or by an array of strings, of which the effects are OR'ed
const C4ValueArray *arr = spec.getArray();
if (arr)
{
// Init by array
for (int32_t i=0; i<arr->GetSize(); ++i)
{
C4String *smask = arr->GetItem(i).getStr();
if (!smask) throw C4AulExecError(FormatString("MatTexMask expected string as %dth element in array.", (int)i).getData());
UnmaskSpec(smask);
}
}
else
{
// Init by string
C4String *smask = spec.getStr();
if (smask)
UnmaskSpec(smask);
else
{
if (spec) throw C4AulExecError("MatTexMask expected string or array of strings.");
// nil defaults to everything except index zero unmasked
sky_mask = std::vector<bool>(256, true);
tunnel_mask = std::vector<bool>(256, true);
sky_mask[0] = false;
tunnel_mask[0] = false;
}
}
}
示例4:
bool C4FindObjectProcedure::Check(C4Object *pObj)
{
assert(pObj);
if (!pObj->GetAction()) return false;
C4Value v;
pObj->GetAction()->GetProperty(P_Procedure, &v);
return v != C4VNull && v.getStr() == procedure;
}
示例5: FnLayerGetDefaultBackgroundIndex
static int32_t FnLayerGetDefaultBackgroundIndex(C4PropList * _this, const C4Value &value)
{
uint8_t fg;
C4String* str;
if ((str = value.getStr()))
{
if (!TexColSingle(str->GetCStr(), fg))
return -1;
}
else
{
if (!Inside(value.getInt(), 0, 255))
return -1;
fg = value.getInt();
}
return ::MapScript.pTexMap->DefaultBkgMatTex(fg);
}
示例6: operator
bool operator ()(const C4Value &v1, const C4Value &v2)
{
if (v1.getStr() && v2.getStr())
return std::strcmp(v1._getStr()->GetCStr(), v2._getStr()->GetCStr()) < 0;
return v2.getStr();
}