summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_boxdata.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-30 22:06:40 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-30 22:06:40 +0000
commitd02c4d8b1199799340833ebfc79d7092f9b2d043 (patch)
tree46c5ad3489153bf600529314fdbcf8c772622a24 /xfa/fxfa/parser/cxfa_boxdata.cpp
parentf65f1d398804ec4702a3de691398902a0347461c (diff)
downloadpdfium-d02c4d8b1199799340833ebfc79d7092f9b2d043.tar.xz
Rename XFA_ATTRIBUTEENUM to XFA_AttributeEnum enum class
This CL changes the enum XFA_ATTRIBUTEENUM to an enum class XFA_AttributeEnum. Methods expecting an int32 have been updated to take or return the XFA_AttrbuteEnum type. Change-Id: I268453949545fe2dd3eae707be4d9cc7edeff763 Reviewed-on: https://pdfium-review.googlesource.com/20070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_boxdata.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_boxdata.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/xfa/fxfa/parser/cxfa_boxdata.cpp b/xfa/fxfa/parser/cxfa_boxdata.cpp
index 6428247154..b8a82c2b80 100644
--- a/xfa/fxfa/parser/cxfa_boxdata.cpp
+++ b/xfa/fxfa/parser/cxfa_boxdata.cpp
@@ -46,10 +46,10 @@ std::vector<CXFA_StrokeData> GetStrokesInternal(CXFA_Node* pNode, bool bNull) {
return strokes;
}
-static int32_t Style3D(const std::vector<CXFA_StrokeData>& strokes,
- CXFA_StrokeData& strokeData) {
+static XFA_AttributeEnum Style3D(const std::vector<CXFA_StrokeData>& strokes,
+ CXFA_StrokeData& strokeData) {
if (strokes.empty())
- return 0;
+ return XFA_AttributeEnum::Unknown;
strokeData = strokes[0];
for (size_t i = 1; i < strokes.size(); i++) {
@@ -64,29 +64,30 @@ static int32_t Style3D(const std::vector<CXFA_StrokeData>& strokes,
break;
}
- XFA_ATTRIBUTEENUM iType = strokeData.GetStrokeType();
- if (iType == XFA_ATTRIBUTEENUM_Lowered || iType == XFA_ATTRIBUTEENUM_Raised ||
- iType == XFA_ATTRIBUTEENUM_Etched ||
- iType == XFA_ATTRIBUTEENUM_Embossed) {
+ XFA_AttributeEnum iType = strokeData.GetStrokeType();
+ if (iType == XFA_AttributeEnum::Lowered ||
+ iType == XFA_AttributeEnum::Raised ||
+ iType == XFA_AttributeEnum::Etched ||
+ iType == XFA_AttributeEnum::Embossed) {
return iType;
}
- return 0;
+ return XFA_AttributeEnum::Unknown;
}
} // namespace
-int32_t CXFA_BoxData::GetHand() const {
+XFA_AttributeEnum CXFA_BoxData::GetHand() const {
if (!m_pNode)
- return XFA_ATTRIBUTEENUM_Even;
+ return XFA_AttributeEnum::Even;
return m_pNode->JSNode()->GetEnum(XFA_Attribute::Hand);
}
-int32_t CXFA_BoxData::GetPresence() const {
+XFA_AttributeEnum CXFA_BoxData::GetPresence() const {
if (!m_pNode)
- return XFA_ATTRIBUTEENUM_Hidden;
+ return XFA_AttributeEnum::Hidden;
return m_pNode->JSNode()
->TryEnum(XFA_Attribute::Presence, true)
- .value_or(XFA_ATTRIBUTEENUM_Visible);
+ .value_or(XFA_AttributeEnum::Visible);
}
int32_t CXFA_BoxData::CountEdges() const {
@@ -137,15 +138,15 @@ CXFA_MarginData CXFA_BoxData::GetMarginData() const {
m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin, false) : nullptr);
}
-std::tuple<int32_t, bool, float> CXFA_BoxData::Get3DStyle() const {
+std::tuple<XFA_AttributeEnum, bool, float> CXFA_BoxData::Get3DStyle() const {
if (IsArc())
- return {0, false, 0.0f};
+ return {XFA_AttributeEnum::Unknown, false, 0.0f};
std::vector<CXFA_StrokeData> strokes = GetStrokesInternal(m_pNode, true);
CXFA_StrokeData strokeData(nullptr);
- int32_t iType = Style3D(strokes, strokeData);
- if (iType == 0)
- return {0, false, 0.0f};
+ XFA_AttributeEnum iType = Style3D(strokes, strokeData);
+ if (iType == XFA_AttributeEnum::Unknown)
+ return {XFA_AttributeEnum::Unknown, false, 0.0f};
return {iType, strokeData.IsVisible(), strokeData.GetThickness()};
}