本文整理汇总了C++中WideString::AsStringView方法的典型用法代码示例。如果您正苦于以下问题:C++ WideString::AsStringView方法的具体用法?C++ WideString::AsStringView怎么用?C++ WideString::AsStringView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WideString
的用法示例。
在下文中一共展示了WideString::AsStringView方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defaultValue
void CJX_Field::defaultValue(CFXJSE_Value* pValue,
bool bSetting,
XFA_Attribute eAttribute) {
CXFA_Node* xfaNode = GetXFANode();
if (!xfaNode->IsWidgetReady())
return;
if (bSetting) {
if (pValue) {
xfaNode->SetPreNull(xfaNode->IsNull());
xfaNode->SetIsNull(pValue->IsNull());
}
WideString wsNewText;
if (pValue && !(pValue->IsNull() || pValue->IsUndefined()))
wsNewText = pValue->ToWideString();
if (xfaNode->GetUIChildNode()->GetElementType() == XFA_Element::NumericEdit)
wsNewText = xfaNode->NumericLimit(wsNewText);
CXFA_Node* pContainerNode = xfaNode->GetContainerNode();
WideString wsFormatText(wsNewText);
if (pContainerNode)
wsFormatText = pContainerNode->GetFormatDataValue(wsNewText);
SetContent(wsNewText, wsFormatText, true, true, true);
return;
}
WideString content = GetContent(true);
if (content.IsEmpty()) {
pValue->SetNull();
return;
}
CXFA_Node* formValue = xfaNode->GetFormValueIfExists();
CXFA_Node* pNode = formValue ? formValue->GetFirstChild() : nullptr;
if (pNode && pNode->GetElementType() == XFA_Element::Decimal) {
if (xfaNode->GetUIChildNode()->GetElementType() ==
XFA_Element::NumericEdit &&
(pNode->JSObject()->GetInteger(XFA_Attribute::FracDigits) == -1)) {
pValue->SetString(content.ToUTF8().AsStringView());
} else {
CFX_Decimal decimal(content.AsStringView());
pValue->SetFloat((float)(double)decimal);
}
} else if (pNode && pNode->GetElementType() == XFA_Element::Integer) {
pValue->SetInteger(FXSYS_wtoi(content.c_str()));
} else if (pNode && pNode->GetElementType() == XFA_Element::Boolean) {
pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? false : true);
} else if (pNode && pNode->GetElementType() == XFA_Element::Float) {
CFX_Decimal decimal(content.AsStringView());
pValue->SetFloat((float)(double)decimal);
} else {
pValue->SetString(content.ToUTF8().AsStringView());
}
}
示例2:
bool CBC_Code39::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
auto* pWriter = GetOnedCode39Writer();
WideString renderCon;
if (!pWriter->encodedContents(m_renderContents.AsStringView(), &renderCon))
return false;
return pWriter->RenderDeviceResult(device, matrix, renderCon.AsStringView());
}
示例3: ToNode
Optional<WideString> CXFA_TextProvider::GetEmbeddedObj(
const WideString& wsAttr) const {
if (m_eType != XFA_TEXTPROVIDERTYPE_Text)
return {};
CXFA_Node* pParent = m_pNode->GetParent();
CXFA_Document* pDocument = m_pNode->GetDocument();
CXFA_Node* pIDNode = nullptr;
if (pParent)
pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsStringView());
if (!pIDNode) {
pIDNode = pDocument->GetNodeByID(
ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)),
wsAttr.AsStringView());
}
if (!pIDNode || !pIDNode->IsWidgetReady())
return {};
return pIDNode->GetValue(XFA_VALUEPICTURE_Display);
}
示例4: execEvent
CJS_Result CJX_Field::execEvent(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1)
return CJS_Result::Failure(JSMessage::kParamError);
WideString eventString = runtime->ToWideString(params[0]);
int32_t iRet =
execSingleEventByName(eventString.AsStringView(), XFA_Element::Field);
if (!eventString.EqualsASCII("validate"))
return CJS_Result::Success();
return CJS_Result::Success(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error));
}
示例5: boundItem
CJS_Result CJX_Field::boundItem(
CFX_V8* runtime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1)
return CJS_Result::Failure(JSMessage::kParamError);
CXFA_Node* node = GetXFANode();
if (!node->IsWidgetReady())
return CJS_Result::Success();
WideString value = runtime->ToWideString(params[0]);
WideString boundValue = node->GetItemValue(value.AsStringView());
return CJS_Result::Success(
runtime->NewString(boundValue.ToUTF8().AsStringView()));
}