diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-20 21:16:43 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-20 21:16:43 +0000 |
commit | 1699413c207c228ae7eae3d47e89adacc1146d65 (patch) | |
tree | 2a6020ff5b1d658c618ea32a04f86aaa9ee86b72 /xfa/fxfa/parser/cxfa_boxdata.cpp | |
parent | ef2b74990f4f2a82e279ef5b8a911d89be1e83e2 (diff) | |
download | pdfium-1699413c207c228ae7eae3d47e89adacc1146d65.tar.xz |
Cleanup return types in CXFA_BoxData
This CL cleans up the return types in CXFA_BoxData to use std::tuple and
pdfium::Optional where appropriate.
Change-Id: I0790fb43769185fa4cbdd7460411a3d1120e9fa1
Reviewed-on: https://pdfium-review.googlesource.com/18812
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_boxdata.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_boxdata.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/xfa/fxfa/parser/cxfa_boxdata.cpp b/xfa/fxfa/parser/cxfa_boxdata.cpp index 813a0a6229..5545494aac 100644 --- a/xfa/fxfa/parser/cxfa_boxdata.cpp +++ b/xfa/fxfa/parser/cxfa_boxdata.cpp @@ -108,32 +108,26 @@ bool CXFA_BoxData::IsCircular() const { return m_pNode->JSNode()->GetBoolean(XFA_Attribute::Circular); } -bool CXFA_BoxData::GetStartAngle(float& fStartAngle) const { - fStartAngle = 0; +pdfium::Optional<float> CXFA_BoxData::GetStartAngle() const { if (!m_pNode) - return false; + return {}; pdfium::Optional<CXFA_Measurement> measure = m_pNode->JSNode()->TryMeasure(XFA_Attribute::StartAngle, false); if (!measure) - return false; - - fStartAngle = measure->GetValue(); - return true; + return {}; + return {measure->GetValue()}; } -bool CXFA_BoxData::GetSweepAngle(float& fSweepAngle) const { - fSweepAngle = 360; +pdfium::Optional<float> CXFA_BoxData::GetSweepAngle() const { if (!m_pNode) - return false; + return {}; pdfium::Optional<CXFA_Measurement> measure = m_pNode->JSNode()->TryMeasure(XFA_Attribute::SweepAngle, false); if (!measure) - return false; - - fSweepAngle = measure->GetValue(); - return true; + return {}; + return {measure->GetValue()}; } CXFA_FillData CXFA_BoxData::GetFillData(bool bModified) const { @@ -150,16 +144,15 @@ CXFA_MarginData CXFA_BoxData::GetMarginData() const { m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin, false) : nullptr); } -int32_t CXFA_BoxData::Get3DStyle(bool& bVisible, float& fThickness) const { +std::tuple<int32_t, bool, float> CXFA_BoxData::Get3DStyle() const { if (IsArc()) - return 0; + return {0, false, 0.0f}; std::vector<CXFA_StrokeData> strokes = GetStrokesInternal(m_pNode, true); CXFA_StrokeData strokeData(nullptr); int32_t iType = Style3D(strokes, strokeData); - if (iType) { - bVisible = strokeData.IsVisible(); - fThickness = strokeData.GetThickness(); - } - return iType; + if (iType == 0) + return {0, false, 0.0f}; + + return {iType, strokeData.IsVisible(), strokeData.GetThickness()}; } |