本文整理汇总了C++中CFXJSE_Value::SetFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ CFXJSE_Value::SetFloat方法的具体用法?C++ CFXJSE_Value::SetFloat怎么用?C++ CFXJSE_Value::SetFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFXJSE_Value
的用法示例。
在下文中一共展示了CFXJSE_Value::SetFloat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HWXY
void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments,
XFA_LAYOUTMODEL_HWXY layoutModel) {
int32_t iLength = pArguments->GetLength();
if (iLength < 1 || iLength > 3) {
const FX_WCHAR* methodName = nullptr;
switch (layoutModel) {
case XFA_LAYOUTMODEL_H:
methodName = L"h";
break;
case XFA_LAYOUTMODEL_W:
methodName = L"w";
break;
case XFA_LAYOUTMODEL_X:
methodName = L"x";
break;
case XFA_LAYOUTMODEL_Y:
methodName = L"y";
break;
}
ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, methodName);
return;
}
CXFA_Node* pNode = nullptr;
CFX_WideString wsUnit(L"pt");
int32_t iIndex = 0;
if (iLength >= 1) {
pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
}
if (iLength >= 2) {
CFX_ByteString bsUnit = pArguments->GetUTF8String(1);
if (!bsUnit.IsEmpty()) {
wsUnit = CFX_WideString::FromUTF8(bsUnit.AsStringC());
}
}
if (iLength >= 3) {
iIndex = pArguments->GetInt32(2);
}
if (!pNode) {
return;
}
CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout();
if (!pDocLayout) {
return;
}
CFX_RectF rtRect;
CXFA_Measurement measure;
CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode);
if (!pLayoutItem) {
return;
}
while (iIndex > 0 && pLayoutItem) {
pLayoutItem = pLayoutItem->GetNext();
iIndex--;
}
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (!pLayoutItem) {
pValue->SetFloat(0);
return;
}
pLayoutItem->GetRect(rtRect, TRUE);
switch (layoutModel) {
case XFA_LAYOUTMODEL_H:
measure.Set(rtRect.height, XFA_UNIT_Pt);
break;
case XFA_LAYOUTMODEL_W:
measure.Set(rtRect.width, XFA_UNIT_Pt);
break;
case XFA_LAYOUTMODEL_X:
measure.Set(rtRect.left, XFA_UNIT_Pt);
break;
case XFA_LAYOUTMODEL_Y:
measure.Set(rtRect.top, XFA_UNIT_Pt);
break;
}
XFA_UNIT unit = measure.GetUnit(wsUnit.AsStringC());
FX_FLOAT fValue = measure.ToUnit(unit);
fValue = FXSYS_round(fValue * 1000) / 1000.0f;
if (pValue)
pValue->SetFloat(fValue);
}
示例2: FXJSE_Value_SetFloat
void FXJSE_Value_SetFloat(FXJSE_HVALUE hValue, FX_FLOAT fFloat) {
CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
ASSERT(lpValue);
return lpValue->SetFloat(fFloat);
}