summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-01-04 14:43:27 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-04 20:19:41 +0000
commitc560a8c11a6f8ee239e570db8c022ae0fd2a4db5 (patch)
tree0c16389f7e5c5e29c57a9c7f77dd062fa07d8640 /xfa/fxfa/parser
parentdf0a749452d933e4f434e2a33112667f1880db34 (diff)
downloadpdfium-c560a8c11a6f8ee239e570db8c022ae0fd2a4db5.tar.xz
Convert usages of pdfium::Optional to Optional
Change-Id: I29769f78eaad10c6a8b79e27524336c4f330377e Reviewed-on: https://pdfium-review.googlesource.com/22258 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_box.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_box.h4
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_fill.cpp10
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp22
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp14
-rw-r--r--xfa/fxfa/parser/cxfa_margin.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_margin.h8
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp51
-rw-r--r--xfa/fxfa/parser/cxfa_node.h19
-rw-r--r--xfa/fxfa/parser/cxfa_occur.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_script.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_validate.cpp2
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp12
-rw-r--r--xfa/fxfa/parser/xfa_utils.cpp15
15 files changed, 83 insertions, 100 deletions
diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp
index ccb4e713ff..3bc641bbcd 100644
--- a/xfa/fxfa/parser/cxfa_box.cpp
+++ b/xfa/fxfa/parser/cxfa_box.cpp
@@ -94,11 +94,11 @@ bool CXFA_Box::IsCircular() {
return JSObject()->GetBoolean(XFA_Attribute::Circular);
}
-pdfium::Optional<int32_t> CXFA_Box::GetStartAngle() {
+Optional<int32_t> CXFA_Box::GetStartAngle() {
return JSObject()->TryInteger(XFA_Attribute::StartAngle, false);
}
-pdfium::Optional<int32_t> CXFA_Box::GetSweepAngle() {
+Optional<int32_t> CXFA_Box::GetSweepAngle() {
return JSObject()->TryInteger(XFA_Attribute::SweepAngle, false);
}
diff --git a/xfa/fxfa/parser/cxfa_box.h b/xfa/fxfa/parser/cxfa_box.h
index 5c2c8d20af..f995f5bb09 100644
--- a/xfa/fxfa/parser/cxfa_box.h
+++ b/xfa/fxfa/parser/cxfa_box.h
@@ -36,8 +36,8 @@ class CXFA_Box : public CXFA_Node {
std::vector<CXFA_Stroke*> GetStrokes();
- pdfium::Optional<int32_t> GetStartAngle();
- pdfium::Optional<int32_t> GetSweepAngle();
+ Optional<int32_t> GetStartAngle();
+ Optional<int32_t> GetSweepAngle();
protected:
CXFA_Box(CXFA_Document* pDoc,
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index de057aa933..b7c9be517f 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -167,12 +167,12 @@ CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) {
if (pDatasetsChild->GetNameHash() != XFA_HASHCODE_Data)
continue;
- pdfium::Optional<WideString> namespaceURI =
+ Optional<WideString> namespaceURI =
pDatasetsChild->JSObject()->TryNamespace();
if (!namespaceURI)
continue;
- pdfium::Optional<WideString> datasetsURI =
+ Optional<WideString> datasetsURI =
pDatasetsNode->JSObject()->TryNamespace();
if (!datasetsURI)
continue;
diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp
index f5138d5e2e..5b6c69eb24 100644
--- a/xfa/fxfa/parser/cxfa_fill.cpp
+++ b/xfa/fxfa/parser/cxfa_fill.cpp
@@ -74,7 +74,7 @@ void CXFA_Fill::SetColor(FX_ARGB color) {
FX_ARGB CXFA_Fill::GetColor(bool bText) {
if (CXFA_Color* pNode = GetChild<CXFA_Color>(0, XFA_Element::Color, false)) {
- pdfium::Optional<WideString> wsColor =
+ Optional<WideString> wsColor =
pNode->JSObject()->TryCData(XFA_Attribute::Value, false);
if (wsColor)
return StringToFXARGB(wsColor->AsStringView());
@@ -103,7 +103,7 @@ XFA_AttributeEnum CXFA_Fill::GetPatternType() {
FX_ARGB CXFA_Fill::GetPatternColor() {
if (CXFA_Color* pColor =
GetPattern()->GetChild<CXFA_Color>(0, XFA_Element::Color, false)) {
- pdfium::Optional<WideString> wsColor =
+ Optional<WideString> wsColor =
pColor->JSObject()->TryCData(XFA_Attribute::Value, false);
if (wsColor)
return StringToFXARGB(wsColor->AsStringView());
@@ -121,7 +121,7 @@ int32_t CXFA_Fill::GetStippleRate() {
FX_ARGB CXFA_Fill::GetStippleColor() {
if (CXFA_Color* pColor =
GetStipple()->GetChild<CXFA_Color>(0, XFA_Element::Color, false)) {
- pdfium::Optional<WideString> wsColor =
+ Optional<WideString> wsColor =
pColor->JSObject()->TryCData(XFA_Attribute::Value, false);
if (wsColor)
return StringToFXARGB(wsColor->AsStringView());
@@ -139,7 +139,7 @@ XFA_AttributeEnum CXFA_Fill::GetLinearType() {
FX_ARGB CXFA_Fill::GetLinearColor() {
if (CXFA_Color* pColor =
GetLinear()->GetChild<CXFA_Color>(0, XFA_Element::Color, false)) {
- pdfium::Optional<WideString> wsColor =
+ Optional<WideString> wsColor =
pColor->JSObject()->TryCData(XFA_Attribute::Value, false);
if (wsColor)
return StringToFXARGB(wsColor->AsStringView());
@@ -157,7 +157,7 @@ bool CXFA_Fill::IsRadialToEdge() {
FX_ARGB CXFA_Fill::GetRadialColor() {
if (CXFA_Color* pColor =
GetRadial()->GetChild<CXFA_Color>(0, XFA_Element::Color, false)) {
- pdfium::Optional<WideString> wsColor =
+ Optional<WideString> wsColor =
pColor->JSObject()->TryCData(XFA_Attribute::Value, false);
if (wsColor)
return StringToFXARGB(wsColor->AsStringView());
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index 61863d13b4..bd21cdcf11 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -92,14 +92,14 @@ CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode,
CFX_SizeF containerSize;
if (eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) {
- pdfium::Optional<CXFA_Measurement> wValue =
+ Optional<CXFA_Measurement> wValue =
pFormNode->JSObject()->TryMeasure(XFA_Attribute::W, false);
if (wValue && wValue->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
containerSize.width = wValue->ToUnit(XFA_Unit::Pt);
*bContainerWidthAutoSize = false;
}
- pdfium::Optional<CXFA_Measurement> hValue =
+ Optional<CXFA_Measurement> hValue =
pFormNode->JSObject()->TryMeasure(XFA_Attribute::H, false);
if (hValue && hValue->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
containerSize.height = hValue->ToUnit(XFA_Unit::Pt);
@@ -108,14 +108,14 @@ CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode,
}
if (*bContainerWidthAutoSize && eType == XFA_Element::Subform) {
- pdfium::Optional<CXFA_Measurement> maxW =
+ Optional<CXFA_Measurement> maxW =
pFormNode->JSObject()->TryMeasure(XFA_Attribute::MaxW, false);
if (maxW && maxW->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
containerSize.width = maxW->ToUnit(XFA_Unit::Pt);
*bContainerWidthAutoSize = false;
}
- pdfium::Optional<CXFA_Measurement> maxH =
+ Optional<CXFA_Measurement> maxH =
pFormNode->JSObject()->TryMeasure(XFA_Attribute::MaxH, false);
if (maxH && maxH->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) {
containerSize.height = maxH->ToUnit(XFA_Unit::Pt);
@@ -138,12 +138,12 @@ CFX_SizeF CalculateContainerComponentSizeFromContentSize(
if (bContainerWidthAutoSize) {
componentSize.width = fContentCalculatedWidth;
if (pMarginNode) {
- pdfium::Optional<CXFA_Measurement> leftInset =
+ Optional<CXFA_Measurement> leftInset =
pMarginNode->JSObject()->TryMeasure(XFA_Attribute::LeftInset, false);
if (leftInset)
componentSize.width += leftInset->ToUnit(XFA_Unit::Pt);
- pdfium::Optional<CXFA_Measurement> rightInset =
+ Optional<CXFA_Measurement> rightInset =
pMarginNode->JSObject()->TryMeasure(XFA_Attribute::RightInset, false);
if (rightInset)
componentSize.width += rightInset->ToUnit(XFA_Unit::Pt);
@@ -153,12 +153,12 @@ CFX_SizeF CalculateContainerComponentSizeFromContentSize(
if (bContainerHeightAutoSize) {
componentSize.height = fContentCalculatedHeight;
if (pMarginNode) {
- pdfium::Optional<CXFA_Measurement> topInset =
+ Optional<CXFA_Measurement> topInset =
pMarginNode->JSObject()->TryMeasure(XFA_Attribute::TopInset, false);
if (topInset)
componentSize.height += topInset->ToUnit(XFA_Unit::Pt);
- pdfium::Optional<CXFA_Measurement> bottomInset =
+ Optional<CXFA_Measurement> bottomInset =
pMarginNode->JSObject()->TryMeasure(XFA_Attribute::BottomInset,
false);
if (bottomInset)
@@ -504,7 +504,7 @@ float InsertPendingItems(CXFA_ItemLayoutProcessor* pProcessor,
XFA_AttributeEnum GetLayout(CXFA_Node* pFormNode, bool* bRootForceTb) {
*bRootForceTb = false;
- pdfium::Optional<XFA_AttributeEnum> layoutMode =
+ Optional<XFA_AttributeEnum> layoutMode =
pFormNode->JSObject()->TryEnum(XFA_Attribute::Layout, false);
if (layoutMode)
return *layoutMode;
@@ -537,7 +537,7 @@ bool ExistContainerKeep(CXFA_Node* pCurNode, bool bPreFind) {
if (!bPreFind)
eKeepType = XFA_Attribute::Next;
- pdfium::Optional<XFA_AttributeEnum> previous =
+ Optional<XFA_AttributeEnum> previous =
pKeep->JSObject()->TryEnum(eKeepType, false);
if (previous) {
if (*previous == XFA_AttributeEnum::ContentArea ||
@@ -555,7 +555,7 @@ bool ExistContainerKeep(CXFA_Node* pCurNode, bool bPreFind) {
if (!bPreFind)
eKeepType = XFA_Attribute::Previous;
- pdfium::Optional<XFA_AttributeEnum> next =
+ Optional<XFA_AttributeEnum> next =
pKeep->JSObject()->TryEnum(eKeepType, false);
if (!next)
return false;
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index b511cf8d3d..61caae762f 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -153,7 +153,7 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot,
bool bTargetAllFind = true;
while (iSplitIndex != -1) {
WideString wsExpr;
- pdfium::Optional<size_t> iSplitNextIndex = 0;
+ Optional<size_t> iSplitNextIndex = 0;
if (!bTargetAllFind) {
iSplitNextIndex = wsTargetAll.Find(' ', iSplitIndex);
if (!iSplitNextIndex.has_value())
@@ -1151,7 +1151,7 @@ bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet_Ordered(
CXFA_Node* pOccurNode =
pPageSet->GetFirstChildByClass<CXFA_Occur>(XFA_Element::Occur);
if (pOccurNode) {
- pdfium::Optional<int32_t> ret =
+ Optional<int32_t> ret =
pOccurNode->JSObject()->TryInteger(XFA_Attribute::Max, false);
if (ret)
iMax = *ret;
@@ -1324,7 +1324,7 @@ bool CXFA_LayoutPageMgr::MatchPageAreaOddOrEven(CXFA_Node* pPageArea) {
if (m_ePageSetMode != XFA_AttributeEnum::DuplexPaginated)
return true;
- pdfium::Optional<XFA_AttributeEnum> ret =
+ Optional<XFA_AttributeEnum> ret =
pPageArea->JSObject()->TryEnum(XFA_Attribute::OddOrEven, true);
if (!ret || *ret == XFA_AttributeEnum::Any)
return true;
@@ -1354,7 +1354,7 @@ CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea(
CXFA_Node* pOccurNode =
m_pCurPageArea->GetFirstChildByClass<CXFA_Occur>(XFA_Element::Occur);
if (pOccurNode) {
- pdfium::Optional<int32_t> ret =
+ Optional<int32_t> ret =
pOccurNode->JSObject()->TryInteger(XFA_Attribute::Max, false);
if (ret)
iMax = *ret;
@@ -1460,7 +1460,7 @@ int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea,
return 0;
int32_t iMin = 0;
- pdfium::Optional<int32_t> ret;
+ Optional<int32_t> ret;
CXFA_Node* pOccurNode =
pPageArea->GetFirstChildByClass<CXFA_Occur>(XFA_Element::Occur);
if (pOccurNode) {
@@ -1507,7 +1507,7 @@ void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet,
if (!pOccurNode)
return;
- pdfium::Optional<int32_t> iMin =
+ Optional<int32_t> iMin =
pOccurNode->JSObject()->TryInteger(XFA_Attribute::Min, false);
if (!iMin || iCurSetCount >= *iMin)
return;
@@ -1572,7 +1572,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) {
CXFA_Node* pOccurNode =
pPageNode->GetFirstChildByClass<CXFA_Occur>(XFA_Element::Occur);
int32_t iMax = 0;
- pdfium::Optional<int32_t> ret;
+ Optional<int32_t> ret;
if (pOccurNode) {
ret = pOccurNode->JSObject()->TryInteger(XFA_Attribute::Max, false);
if (ret)
diff --git a/xfa/fxfa/parser/cxfa_margin.cpp b/xfa/fxfa/parser/cxfa_margin.cpp
index 6dd4d39ee4..265d7e92c8 100644
--- a/xfa/fxfa/parser/cxfa_margin.cpp
+++ b/xfa/fxfa/parser/cxfa_margin.cpp
@@ -56,18 +56,18 @@ float CXFA_Margin::GetBottomInset() const {
return TryBottomInset().value_or(0);
}
-pdfium::Optional<float> CXFA_Margin::TryLeftInset() const {
+Optional<float> CXFA_Margin::TryLeftInset() const {
return JSObject()->TryMeasureAsFloat(XFA_Attribute::LeftInset);
}
-pdfium::Optional<float> CXFA_Margin::TryTopInset() const {
+Optional<float> CXFA_Margin::TryTopInset() const {
return JSObject()->TryMeasureAsFloat(XFA_Attribute::TopInset);
}
-pdfium::Optional<float> CXFA_Margin::TryRightInset() const {
+Optional<float> CXFA_Margin::TryRightInset() const {
return JSObject()->TryMeasureAsFloat(XFA_Attribute::RightInset);
}
-pdfium::Optional<float> CXFA_Margin::TryBottomInset() const {
+Optional<float> CXFA_Margin::TryBottomInset() const {
return JSObject()->TryMeasureAsFloat(XFA_Attribute::BottomInset);
}
diff --git a/xfa/fxfa/parser/cxfa_margin.h b/xfa/fxfa/parser/cxfa_margin.h
index 621704ab7a..e7f95b6c9c 100644
--- a/xfa/fxfa/parser/cxfa_margin.h
+++ b/xfa/fxfa/parser/cxfa_margin.h
@@ -19,10 +19,10 @@ class CXFA_Margin : public CXFA_Node {
float GetRightInset() const;
float GetBottomInset() const;
- pdfium::Optional<float> TryLeftInset() const;
- pdfium::Optional<float> TryTopInset() const;
- pdfium::Optional<float> TryRightInset() const;
- pdfium::Optional<float> TryBottomInset() const;
+ Optional<float> TryLeftInset() const;
+ Optional<float> TryTopInset() const;
+ Optional<float> TryRightInset() const;
+ Optional<float> TryBottomInset() const;
};
#endif // XFA_FXFA_PARSER_CXFA_MARGIN_H_
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index f6f2675c29..3d132fedbc 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -142,7 +142,7 @@ WideString CXFA_Node::AttributeEnumToName(XFA_AttributeEnum item) {
}
// static
-pdfium::Optional<XFA_AttributeEnum> CXFA_Node::NameToAttributeEnum(
+Optional<XFA_AttributeEnum> CXFA_Node::NameToAttributeEnum(
const WideStringView& name) {
if (name.IsEmpty())
return {};
@@ -309,8 +309,7 @@ uint8_t CXFA_Node::PropertyOccuranceCount(XFA_Element property) const {
return data ? data->occurance_count : 0;
}
-pdfium::Optional<XFA_Element> CXFA_Node::GetFirstPropertyWithFlag(
- uint8_t flag) {
+Optional<XFA_Element> CXFA_Node::GetFirstPropertyWithFlag(uint8_t flag) {
if (m_Properties == nullptr)
return {};
@@ -439,7 +438,7 @@ std::vector<CXFA_Node*> CXFA_Node::GetNodeList(uint32_t dwTypeFilter,
if (m_Properties == nullptr)
return nodes;
- pdfium::Optional<XFA_Element> property =
+ Optional<XFA_Element> property =
GetFirstPropertyWithFlag(XFA_PROPERTYFLAG_DefaultOneOf);
if (!property)
return nodes;
@@ -637,7 +636,7 @@ bool CXFA_Node::GetLocaleName(WideString& wsLocaleName) {
CXFA_Node* pLocaleNode = this;
do {
- pdfium::Optional<WideString> ret =
+ Optional<WideString> ret =
pLocaleNode->JSObject()->TryCData(XFA_Attribute::Locale, false);
if (ret) {
wsLocaleName = *ret;
@@ -652,7 +651,7 @@ bool CXFA_Node::GetLocaleName(WideString& wsLocaleName) {
return true;
if (pTopSubform) {
- pdfium::Optional<WideString> ret =
+ Optional<WideString> ret =
pTopSubform->JSObject()->TryCData(XFA_Attribute::Locale, false);
if (ret) {
wsLocaleName = *ret;
@@ -674,7 +673,7 @@ XFA_AttributeEnum CXFA_Node::GetIntact() {
->TryEnum(XFA_Attribute::Layout, true)
.value_or(XFA_AttributeEnum::Position);
if (pKeep) {
- pdfium::Optional<XFA_AttributeEnum> intact =
+ Optional<XFA_AttributeEnum> intact =
pKeep->JSObject()->TryEnum(XFA_Attribute::Intact, false);
if (intact) {
if (*intact == XFA_AttributeEnum::None &&
@@ -685,7 +684,7 @@ XFA_AttributeEnum CXFA_Node::GetIntact() {
if (pPreviewRow &&
pPreviewRow->JSObject()->GetEnum(XFA_Attribute::Layout) ==
XFA_AttributeEnum::Row) {
- pdfium::Optional<XFA_AttributeEnum> value =
+ Optional<XFA_AttributeEnum> value =
pKeep->JSObject()->TryEnum(XFA_Attribute::Previous, false);
if (value && (*value == XFA_AttributeEnum::ContentArea ||
*value == XFA_AttributeEnum::PageArea)) {
@@ -694,7 +693,7 @@ XFA_AttributeEnum CXFA_Node::GetIntact() {
CXFA_Keep* pNode =
pPreviewRow->GetFirstChildByClass<CXFA_Keep>(XFA_Element::Keep);
- pdfium::Optional<XFA_AttributeEnum> ret;
+ Optional<XFA_AttributeEnum> ret;
if (pNode)
ret = pNode->JSObject()->TryEnum(XFA_Attribute::Next, false);
if (ret && (*ret == XFA_AttributeEnum::ContentArea ||
@@ -734,7 +733,7 @@ XFA_AttributeEnum CXFA_Node::GetIntact() {
XFA_VERSION version = m_pDocument->GetCurVersionMode();
if (eParLayout == XFA_AttributeEnum::Tb && version < XFA_VERSION_208) {
- pdfium::Optional<CXFA_Measurement> measureH =
+ Optional<CXFA_Measurement> measureH =
JSObject()->TryMeasure(XFA_Attribute::H, false);
if (measureH)
return XFA_AttributeEnum::ContentArea;
@@ -1326,27 +1325,23 @@ CXFA_Node* CXFA_Node::CreateInstance(bool bDataMerge) {
return pInstance;
}
-pdfium::Optional<bool> CXFA_Node::GetDefaultBoolean(XFA_Attribute attr) const {
- pdfium::Optional<void*> value =
- GetDefaultValue(attr, XFA_AttributeType::Boolean);
+Optional<bool> CXFA_Node::GetDefaultBoolean(XFA_Attribute attr) const {
+ Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::Boolean);
if (!value)
return {};
return {!!*value};
}
-pdfium::Optional<int32_t> CXFA_Node::GetDefaultInteger(
- XFA_Attribute attr) const {
- pdfium::Optional<void*> value =
- GetDefaultValue(attr, XFA_AttributeType::Integer);
+Optional<int32_t> CXFA_Node::GetDefaultInteger(XFA_Attribute attr) const {
+ Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::Integer);
if (!value)
return {};
return {static_cast<int32_t>(reinterpret_cast<uintptr_t>(*value))};
}
-pdfium::Optional<CXFA_Measurement> CXFA_Node::GetDefaultMeasurement(
+Optional<CXFA_Measurement> CXFA_Node::GetDefaultMeasurement(
XFA_Attribute attr) const {
- pdfium::Optional<void*> value =
- GetDefaultValue(attr, XFA_AttributeType::Measure);
+ Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::Measure);
if (!value)
return {};
@@ -1354,28 +1349,24 @@ pdfium::Optional<CXFA_Measurement> CXFA_Node::GetDefaultMeasurement(
return {CXFA_Measurement(str.AsStringView())};
}
-pdfium::Optional<WideString> CXFA_Node::GetDefaultCData(
- XFA_Attribute attr) const {
- pdfium::Optional<void*> value =
- GetDefaultValue(attr, XFA_AttributeType::CData);
+Optional<WideString> CXFA_Node::GetDefaultCData(XFA_Attribute attr) const {
+ Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::CData);
if (!value)
return {};
return {WideString(static_cast<const wchar_t*>(*value))};
}
-pdfium::Optional<XFA_AttributeEnum> CXFA_Node::GetDefaultEnum(
+Optional<XFA_AttributeEnum> CXFA_Node::GetDefaultEnum(
XFA_Attribute attr) const {
- pdfium::Optional<void*> value =
- GetDefaultValue(attr, XFA_AttributeType::Enum);
+ Optional<void*> value = GetDefaultValue(attr, XFA_AttributeType::Enum);
if (!value)
return {};
return {static_cast<XFA_AttributeEnum>(reinterpret_cast<uintptr_t>(*value))};
}
-pdfium::Optional<void*> CXFA_Node::GetDefaultValue(
- XFA_Attribute attr,
- XFA_AttributeType eType) const {
+Optional<void*> CXFA_Node::GetDefaultValue(XFA_Attribute attr,
+ XFA_AttributeType eType) const {
const AttributeData* data = GetAttributeData(attr);
if (!data)
return {};
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index e6683b24dc..cc8d5e8f8d 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -65,7 +65,7 @@ class CXFA_Node : public CXFA_Object {
#endif // NDEBUG
static WideString AttributeEnumToName(XFA_AttributeEnum item);
- static pdfium::Optional<XFA_AttributeEnum> NameToAttributeEnum(
+ static Optional<XFA_AttributeEnum> NameToAttributeEnum(
const WideStringView& name);
static XFA_Attribute NameToAttribute(const WideStringView& name);
static WideString AttributeToName(XFA_Attribute attr);
@@ -210,12 +210,11 @@ class CXFA_Node : public CXFA_Object {
CXFA_Occur* GetOccur();
- pdfium::Optional<bool> GetDefaultBoolean(XFA_Attribute attr) const;
- pdfium::Optional<int32_t> GetDefaultInteger(XFA_Attribute attr) const;
- pdfium::Optional<CXFA_Measurement> GetDefaultMeasurement(
- XFA_Attribute attr) const;
- pdfium::Optional<WideString> GetDefaultCData(XFA_Attribute attr) const;
- pdfium::Optional<XFA_AttributeEnum> GetDefaultEnum(XFA_Attribute attr) const;
+ Optional<bool> GetDefaultBoolean(XFA_Attribute attr) const;
+ Optional<int32_t> GetDefaultInteger(XFA_Attribute attr) const;
+ Optional<CXFA_Measurement> GetDefaultMeasurement(XFA_Attribute attr) const;
+ Optional<WideString> GetDefaultCData(XFA_Attribute attr) const;
+ Optional<XFA_AttributeEnum> GetDefaultEnum(XFA_Attribute attr) const;
void SyncValue(const WideString& wsValue, bool bNotify);
@@ -243,10 +242,10 @@ class CXFA_Node : public CXFA_Object {
CXFA_Node* Deprecated_GetPrevSibling();
const PropertyData* GetPropertyData(XFA_Element property) const;
const AttributeData* GetAttributeData(XFA_Attribute attr) const;
- pdfium::Optional<XFA_Element> GetFirstPropertyWithFlag(uint8_t flag);
+ Optional<XFA_Element> GetFirstPropertyWithFlag(uint8_t flag);
void OnRemoved(bool bNotify);
- pdfium::Optional<void*> GetDefaultValue(XFA_Attribute attr,
- XFA_AttributeType eType) const;
+ Optional<void*> GetDefaultValue(XFA_Attribute attr,
+ XFA_AttributeType eType) const;
CXFA_Node* GetChildInternal(int32_t index,
XFA_Element eType,
bool bOnlyChild);
diff --git a/xfa/fxfa/parser/cxfa_occur.cpp b/xfa/fxfa/parser/cxfa_occur.cpp
index 441394c567..7be3f7066d 100644
--- a/xfa/fxfa/parser/cxfa_occur.cpp
+++ b/xfa/fxfa/parser/cxfa_occur.cpp
@@ -40,14 +40,12 @@ CXFA_Occur::CXFA_Occur(CXFA_Document* doc, XFA_PacketType packet)
CXFA_Occur::~CXFA_Occur() {}
int32_t CXFA_Occur::GetMax() {
- pdfium::Optional<int32_t> max =
- JSObject()->TryInteger(XFA_Attribute::Max, true);
+ Optional<int32_t> max = JSObject()->TryInteger(XFA_Attribute::Max, true);
return max ? *max : GetMin();
}
int32_t CXFA_Occur::GetMin() {
- pdfium::Optional<int32_t> min =
- JSObject()->TryInteger(XFA_Attribute::Min, true);
+ Optional<int32_t> min = JSObject()->TryInteger(XFA_Attribute::Min, true);
return min && *min >= 0 ? *min : 1;
}
@@ -55,7 +53,7 @@ std::tuple<int32_t, int32_t, int32_t> CXFA_Occur::GetOccurInfo() {
int32_t iMin = GetMin();
int32_t iMax = GetMax();
- pdfium::Optional<int32_t> init =
+ Optional<int32_t> init =
JSObject()->TryInteger(XFA_Attribute::Initial, false);
return {iMin, iMax, init && *init >= iMin ? *init : iMin};
}
diff --git a/xfa/fxfa/parser/cxfa_script.cpp b/xfa/fxfa/parser/cxfa_script.cpp
index 1b784b331b..1e4eb7e0aa 100644
--- a/xfa/fxfa/parser/cxfa_script.cpp
+++ b/xfa/fxfa/parser/cxfa_script.cpp
@@ -48,7 +48,7 @@ CXFA_Script::CXFA_Script(CXFA_Document* doc, XFA_PacketType packet)
CXFA_Script::~CXFA_Script() {}
CXFA_Script::Type CXFA_Script::GetContentType() {
- pdfium::Optional<WideString> cData =
+ Optional<WideString> cData =
JSObject()->TryCData(XFA_Attribute::ContentType, false);
if (!cData || *cData == L"application/x-formcalc")
return Type::Formcalc;
diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp
index 665c606632..35479ca1f5 100644
--- a/xfa/fxfa/parser/cxfa_validate.cpp
+++ b/xfa/fxfa/parser/cxfa_validate.cpp
@@ -59,7 +59,7 @@ XFA_AttributeEnum CXFA_Validate::GetFormatTest() {
}
void CXFA_Validate::SetNullTest(const WideString& wsValue) {
- pdfium::Optional<XFA_AttributeEnum> item =
+ Optional<XFA_AttributeEnum> item =
CXFA_Node::NameToAttributeEnum(wsValue.AsStringView());
JSObject()->SetEnum(XFA_Attribute::NullTest,
item ? *item : XFA_AttributeEnum::Disabled, false);
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 5a42f21159..192a7f2fe5 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -90,7 +90,7 @@ bool FormValueNode_SetChildContent(CXFA_Node* pValueNode,
if (!pContentRawDataNode) {
XFA_Element element = XFA_Element::Sharptext;
if (pChildNode->GetElementType() == XFA_Element::ExData) {
- pdfium::Optional<WideString> contentType =
+ Optional<WideString> contentType =
pChildNode->JSObject()->TryAttribute(XFA_Attribute::ContentType,
false);
if (contentType) {
@@ -1058,8 +1058,7 @@ CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument,
if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup)
continue;
- pdfium::Optional<WideString> ns =
- pDDGroupNode->JSObject()->TryNamespace();
+ Optional<WideString> ns = pDDGroupNode->JSObject()->TryNamespace();
if (!ns || *ns != L"http://ns.adobe.com/data-description/")
continue;
}
@@ -1238,8 +1237,7 @@ void UpdateDataRelation(CXFA_Node* pDataNode, CXFA_Node* pDataDescriptionNode) {
if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup)
continue;
- pdfium::Optional<WideString> ns =
- pDDGroupNode->JSObject()->TryNamespace();
+ Optional<WideString> ns = pDDGroupNode->JSObject()->TryNamespace();
if (!ns || *ns != L"http://ns.adobe.com/data-description/")
continue;
}
@@ -1416,14 +1414,14 @@ void CXFA_Document::DoDataMerge() {
continue;
if (!pDDRoot && pChildNode->GetNameHash() == XFA_HASHCODE_DataDescription) {
- pdfium::Optional<WideString> namespaceURI =
+ Optional<WideString> namespaceURI =
pChildNode->JSObject()->TryNamespace();
if (!namespaceURI)
continue;
if (*namespaceURI == L"http://ns.adobe.com/data-description/")
pDDRoot = pChildNode;
} else if (!pDataRoot && pChildNode->GetNameHash() == XFA_HASHCODE_Data) {
- pdfium::Optional<WideString> namespaceURI =
+ Optional<WideString> namespaceURI =
pChildNode->JSObject()->TryNamespace();
if (!namespaceURI)
continue;
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index f891d47f23..0105752937 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -128,7 +128,7 @@ bool AttributeSaveInDataModel(CXFA_Node* pNode, XFA_Attribute eAttribute) {
}
bool ContentNodeNeedtoExport(CXFA_Node* pContentNode) {
- pdfium::Optional<WideString> wsContent =
+ Optional<WideString> wsContent =
pContentNode->JSObject()->TryContent(false, false);
if (!wsContent)
return false;
@@ -159,8 +159,7 @@ void SaveAttribute(CXFA_Node* pNode,
if (!bProto && !pNode->JSObject()->HasAttribute(eName))
return;
- pdfium::Optional<WideString> value =
- pNode->JSObject()->TryAttribute(eName, false);
+ Optional<WideString> value = pNode->JSObject()->TryAttribute(eName, false);
if (!value)
return;
@@ -206,7 +205,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
if (!pRawValueNode)
break;
- pdfium::Optional<WideString> contentType =
+ Optional<WideString> contentType =
pNode->JSObject()->TryAttribute(XFA_Attribute::ContentType, false);
if (pRawValueNode->GetElementType() == XFA_Element::SharpxHTML &&
(contentType && *contentType == L"text/html")) {
@@ -229,9 +228,8 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
ByteStringView(pMemStream->GetBuffer(), pMemStream->GetSize()));
} else if (pRawValueNode->GetElementType() == XFA_Element::Sharpxml &&
(contentType && *contentType == L"text/xml")) {
- pdfium::Optional<WideString> rawValue =
- pRawValueNode->JSObject()->TryAttribute(XFA_Attribute::Value,
- false);
+ Optional<WideString> rawValue = pRawValueNode->JSObject()->TryAttribute(
+ XFA_Attribute::Value, false);
if (!rawValue || rawValue->IsEmpty())
break;
@@ -399,8 +397,7 @@ void RecognizeXFAVersionNumber(CXFA_Node* pTemplateRoot,
if (!pTemplateRoot)
return;
- pdfium::Optional<WideString> templateNS =
- pTemplateRoot->JSObject()->TryNamespace();
+ Optional<WideString> templateNS = pTemplateRoot->JSObject()->TryNamespace();
if (!templateNS)
return;