summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_margindata.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-21 16:25:40 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-21 16:25:40 +0000
commitddc9965f60823a63c1d402e2f35e7ce093bf3ee8 (patch)
treea827bd50c477678c1d5d8759827bd865acfef99e /xfa/fxfa/parser/cxfa_margindata.cpp
parente6e262844037dfc66e5118bcedf1c84d57f78706 (diff)
downloadpdfium-ddc9965f60823a63c1d402e2f35e7ce093bf3ee8.tar.xz
Make CXFA_MarginData::Try* methods return Optional
This CL converts the CXFA_MarginData::Try{Left|Right|Top|Bottom}Inset methods to return an Optional instead of a bool with an out param. Change-Id: Ib48384c1670db7255b2b6388ced41f2f10fe4385 Reviewed-on: https://pdfium-review.googlesource.com/18890 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_margindata.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_margindata.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/xfa/fxfa/parser/cxfa_margindata.cpp b/xfa/fxfa/parser/cxfa_margindata.cpp
index 4eedaeb7e7..3af8352263 100644
--- a/xfa/fxfa/parser/cxfa_margindata.cpp
+++ b/xfa/fxfa/parser/cxfa_margindata.cpp
@@ -9,41 +9,45 @@
CXFA_MarginData::CXFA_MarginData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}
float CXFA_MarginData::GetLeftInset() const {
- float left = 0;
- TryLeftInset(left);
- return left;
+ return TryLeftInset().value_or(0);
}
float CXFA_MarginData::GetTopInset() const {
- float top = 0;
- TryTopInset(top);
- return top;
+ return TryTopInset().value_or(0);
}
float CXFA_MarginData::GetRightInset() const {
- float right = 0;
- TryRightInset(right);
- return right;
+ return TryRightInset().value_or(0);
}
float CXFA_MarginData::GetBottomInset() const {
- float bottom = 0;
- TryBottomInset(bottom);
- return bottom;
+ return TryBottomInset().value_or(0);
}
-bool CXFA_MarginData::TryLeftInset(float& fInset) const {
- return TryMeasure(XFA_Attribute::LeftInset, fInset);
+pdfium::Optional<float> CXFA_MarginData::TryLeftInset() const {
+ float value = 0;
+ if (TryMeasure(XFA_Attribute::LeftInset, value))
+ return {value};
+ return {};
}
-bool CXFA_MarginData::TryTopInset(float& fInset) const {
- return TryMeasure(XFA_Attribute::TopInset, fInset);
+pdfium::Optional<float> CXFA_MarginData::TryTopInset() const {
+ float value = 0;
+ if (TryMeasure(XFA_Attribute::TopInset, value))
+ return {value};
+ return {};
}
-bool CXFA_MarginData::TryRightInset(float& fInset) const {
- return TryMeasure(XFA_Attribute::RightInset, fInset);
+pdfium::Optional<float> CXFA_MarginData::TryRightInset() const {
+ float value = 0;
+ if (TryMeasure(XFA_Attribute::RightInset, value))
+ return {value};
+ return {};
}
-bool CXFA_MarginData::TryBottomInset(float& fInset) const {
- return TryMeasure(XFA_Attribute::BottomInset, fInset);
+pdfium::Optional<float> CXFA_MarginData::TryBottomInset() const {
+ float value = 0;
+ if (TryMeasure(XFA_Attribute::BottomInset, value))
+ return {value};
+ return {};
}