[Libreoffice-commits] core.git: svgio/inc svgio/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Sat May 1 03:06:13 UTC 2021


 svgio/inc/svgnode.hxx                       |   46 +++++++++++------------
 svgio/source/svgreader/svganode.cxx         |    2 -
 svgio/source/svgreader/svgcharacternode.cxx |    2 -
 svgio/source/svgreader/svgclippathnode.cxx  |    2 -
 svgio/source/svgreader/svggnode.cxx         |    2 -
 svgio/source/svgreader/svgimagenode.cxx     |    2 -
 svgio/source/svgreader/svgmarkernode.cxx    |    2 -
 svgio/source/svgreader/svgmasknode.cxx      |    2 -
 svgio/source/svgreader/svgnode.cxx          |   56 ++++++++++++++--------------
 svgio/source/svgreader/svgpatternnode.cxx   |    2 -
 svgio/source/svgreader/svgusenode.cxx       |    2 -
 svgio/source/svguno/xsvgparser.cxx          |    4 +-
 12 files changed, 62 insertions(+), 62 deletions(-)

New commits:
commit 83ff99bae3034e6ae029475dd0cf0ecc64756f6a
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Apr 30 23:01:57 2021 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sat May 1 05:05:27 2021 +0200

    convert enums to enum classes in svgnode.hxx
    
    converted XmlSpace, Display
    
    Change-Id: I4aced2d7c2f6fcb4adc59949a6ac22d4ddd375a3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114953
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index 95d3a03be1d1..fcf31f296ba7 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -40,34 +40,34 @@ namespace svgio::svgreader
 
 namespace svgio::svgreader
     {
-        enum XmlSpace
+        enum class XmlSpace
         {
-            XmlSpace_notset,
-            XmlSpace_default,
-            XmlSpace_preserve
+            NotSet,
+            Default,
+            Preserve
         };
 
         // display property (see SVG 1.1. 11.5), not inheritable
-        enum Display // #i121656#
+        enum class Display // #i121656#
         {
-            Display_inline, // the default
-            Display_block,
-            Display_list_item,
-            Display_run_in,
-            Display_compact,
-            Display_marker,
-            Display_table,
-            Display_inline_table,
-            Display_table_row_group,
-            Display_table_header_group,
-            Display_table_footer_group,
-            Display_table_row,
-            Display_table_column_group,
-            Display_table_column,
-            Display_table_cell,
-            Display_table_caption,
-            Display_none,
-            Display_inherit
+            Inline, // the default
+            Block,
+            ListItem,
+            RunIn,
+            Compact,
+            Marker,
+            Table,
+            InlineTable,
+            TableRowGroup,
+            TableHeaderGroup,
+            TableFooterGroup,
+            TableRow,
+            TableColumnGroup,
+            TableColumn,
+            TableCell,
+            TableCaption,
+            None,
+            Inherit
         };
 
         // helper to convert a string associated with a token of type SVGTokenDisplay
diff --git a/svgio/source/svgreader/svganode.cxx b/svgio/source/svgreader/svganode.cxx
index ad4483423100..6065ed498e42 100644
--- a/svgio/source/svgreader/svganode.cxx
+++ b/svgio/source/svgreader/svganode.cxx
@@ -84,7 +84,7 @@ namespace svgio::svgreader
 
             const double fOpacity(pStyle->getOpacity().getNumber());
 
-            if(fOpacity > 0.0 && Display_none != getDisplay())
+            if (fOpacity > 0.0 && Display::None != getDisplay())
             {
                 drawinglayer::primitive2d::Primitive2DContainer aContent;
 
diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx
index ff30730cf1eb..e0b66c6f8ee2 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -524,7 +524,7 @@ namespace svgio::svgreader
 
         void SvgCharacterNode::whiteSpaceHandling()
         {
-            if(XmlSpace_default == getXmlSpace())
+            if (XmlSpace::Default == getXmlSpace())
             {
                 maText = whiteSpaceHandlingDefault(maText);
             }
diff --git a/svgio/source/svgreader/svgclippathnode.cxx b/svgio/source/svgreader/svgclippathnode.cxx
index a90d6adb8c2b..1a8269684095 100644
--- a/svgio/source/svgreader/svgclippathnode.cxx
+++ b/svgio/source/svgreader/svgclippathnode.cxx
@@ -125,7 +125,7 @@ namespace svgio::svgreader
             drawinglayer::primitive2d::Primitive2DContainer& rContent,
             const basegfx::B2DHomMatrix* pTransform) const
         {
-            if(rContent.empty() || Display_none == getDisplay())
+            if (rContent.empty() || Display::None == getDisplay())
                 return;
 
             const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
diff --git a/svgio/source/svgreader/svggnode.cxx b/svgio/source/svgreader/svggnode.cxx
index 1d32de448517..e186387a80ba 100644
--- a/svgio/source/svgreader/svggnode.cxx
+++ b/svgio/source/svgreader/svggnode.cxx
@@ -99,7 +99,7 @@ namespace svgio::svgreader
                 {
                     const double fOpacity(pStyle->getOpacity().getNumber());
 
-                    if(fOpacity > 0.0 && Display_none != getDisplay())
+                    if(fOpacity > 0.0 && Display::None != getDisplay())
                     {
                         drawinglayer::primitive2d::Primitive2DContainer aContent;
 
diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx
index 994be83224c9..feaf5933ad53 100644
--- a/svgio/source/svgreader/svgimagenode.cxx
+++ b/svgio/source/svgreader/svgimagenode.cxx
@@ -259,7 +259,7 @@ namespace svgio::svgreader
             {
                 const SvgNode* pXLink = getDocument().findSvgNodeById(maXLink);
 
-                if(pXLink && Display_none != pXLink->getDisplay())
+                if(pXLink && Display::None != pXLink->getDisplay())
                 {
                     pXLink->decomposeSvgNode(aNewTarget, true);
 
diff --git a/svgio/source/svgreader/svgmarkernode.cxx b/svgio/source/svgreader/svgmarkernode.cxx
index f69584553198..b16d03dd004d 100644
--- a/svgio/source/svgreader/svgmarkernode.cxx
+++ b/svgio/source/svgreader/svgmarkernode.cxx
@@ -171,7 +171,7 @@ namespace svgio::svgreader
 
         const drawinglayer::primitive2d::Primitive2DContainer& SvgMarkerNode::getMarkerPrimitives() const
         {
-            if(aPrimitives.empty() && Display_none != getDisplay())
+            if(aPrimitives.empty() && Display::None != getDisplay())
             {
                 decomposeSvgNode(const_cast< SvgMarkerNode* >(this)->aPrimitives, true);
             }
diff --git a/svgio/source/svgreader/svgmasknode.cxx b/svgio/source/svgreader/svgmasknode.cxx
index 631ae3e7c01f..7f3ab9a772ca 100644
--- a/svgio/source/svgreader/svgmasknode.cxx
+++ b/svgio/source/svgreader/svgmasknode.cxx
@@ -190,7 +190,7 @@ namespace svgio::svgreader
             drawinglayer::primitive2d::Primitive2DContainer& rTarget,
             const basegfx::B2DHomMatrix* pTransform) const
         {
-            if(rTarget.empty() || Display_none == getDisplay())
+            if(rTarget.empty() || Display::None == getDisplay())
                 return;
 
             drawinglayer::primitive2d::Primitive2DContainer aMaskTarget;
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx
index ac0c98a42000..7f534af23f80 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -268,8 +268,8 @@ namespace svgio::svgreader
             mpParent(pParent),
             mpAlternativeParent(nullptr),
             maChildren(),
-            maXmlSpace(XmlSpace_notset),
-            maDisplay(Display_inline),
+            maXmlSpace(XmlSpace::NotSet),
+            maDisplay(Display::Inline),
             maCssStyleVector(),
             mbDecomposing(false),
             mbCssStyleVectorBuilt(false)
@@ -341,80 +341,80 @@ namespace svgio::svgreader
             {
                 if(aContent.startsWith("inline"))
                 {
-                    return Display_inline;
+                    return Display::Inline;
                 }
                 else if(aContent.startsWith("none"))
                 {
-                    return Display_none;
+                    return Display::None;
                 }
                 else if(aContent.startsWith("inherit"))
                 {
-                    return Display_inherit;
+                    return Display::Inherit;
                 }
                 else if(aContent.startsWith("block"))
                 {
-                    return Display_block;
+                    return Display::Block;
                 }
                 else if(aContent.startsWith("list-item"))
                 {
-                    return Display_list_item;
+                    return Display::ListItem;
                 }
                 else if(aContent.startsWith("run-in"))
                 {
-                    return Display_run_in;
+                    return Display::RunIn;
                 }
                 else if(aContent.startsWith("compact"))
                 {
-                    return Display_compact;
+                    return Display::Compact;
                 }
                 else if(aContent.startsWith("marker"))
                 {
-                    return Display_marker;
+                    return Display::Marker;
                 }
                 else if(aContent.startsWith("table"))
                 {
-                    return Display_table;
+                    return Display::Table;
                 }
                 else if(aContent.startsWith("inline-table"))
                 {
-                    return Display_inline_table;
+                    return Display::InlineTable;
                 }
                 else if(aContent.startsWith("table-row-group"))
                 {
-                    return Display_table_row_group;
+                    return Display::TableRowGroup;
                 }
                 else if(aContent.startsWith("table-header-group"))
                 {
-                    return Display_table_header_group;
+                    return Display::TableHeaderGroup;
                 }
                 else if(aContent.startsWith("table-footer-group"))
                 {
-                    return Display_table_footer_group;
+                    return Display::TableFooterGroup;
                 }
                 else if(aContent.startsWith("table-row"))
                 {
-                    return Display_table_row;
+                    return Display::TableRow;
                 }
                 else if(aContent.startsWith("table-column-group"))
                 {
-                    return Display_table_column_group;
+                    return Display::TableColumnGroup;
                 }
                 else if(aContent.startsWith("table-column"))
                 {
-                    return Display_table_column;
+                    return Display::TableColumn;
                 }
                 else if(aContent.startsWith("table-cell"))
                 {
-                    return Display_table_cell;
+                    return Display::TableCell;
                 }
                 else if(aContent.startsWith("table-caption"))
                 {
-                    return Display_table_caption;
+                    return Display::TableCaption;
                 }
             }
 
             // return the default
-            return Display_inline;
+            return Display::Inline;
         }
 
         void SvgNode::parseAttribute(const OUString& /*rTokenName*/, SVGToken aSVGToken, const OUString& aContent)
@@ -443,11 +443,11 @@ namespace svgio::svgreader
                     {
                         if(aContent.startsWith("default"))
                         {
-                            setXmlSpace(XmlSpace_default);
+                            setXmlSpace(XmlSpace::Default);
                         }
                         else if(aContent.startsWith("preserve"))
                         {
-                            setXmlSpace(XmlSpace_preserve);
+                            setXmlSpace(XmlSpace::Preserve);
                         }
                     }
                     break;
@@ -472,7 +472,7 @@ namespace svgio::svgreader
             if (mbDecomposing) //guard against infinite recurse
                 return;
 
-            if(Display_none == getDisplay())
+            if(Display::None == getDisplay())
             {
                 return;
             }
@@ -516,7 +516,7 @@ namespace svgio::svgreader
             {
                 SvgNode* pCandidate = rChildren[a].get();
 
-                if(pCandidate && Display_none != pCandidate->getDisplay())
+                if(pCandidate && Display::None != pCandidate->getDisplay())
                 {
                     const auto& rGrandChildren = pCandidate->getChildren();
                     const SvgStyleAttributes* pChildStyles = pCandidate->getSvgStyleAttributes();
@@ -664,7 +664,7 @@ namespace svgio::svgreader
 
         XmlSpace SvgNode::getXmlSpace() const
         {
-            if(maXmlSpace != XmlSpace_notset)
+            if(maXmlSpace != XmlSpace::NotSet)
             {
                 return maXmlSpace;
             }
@@ -674,8 +674,8 @@ namespace svgio::svgreader
                 return getParent()->getXmlSpace();
             }
 
-            // default is XmlSpace_default
-            return XmlSpace_default;
+            // default is XmlSpace::Default
+            return XmlSpace::Default;
         }
 
         void SvgNode::accept(Visitor & rVisitor)
diff --git a/svgio/source/svgreader/svgpatternnode.cxx b/svgio/source/svgreader/svgpatternnode.cxx
index 3a62e2510c8a..8d8721a5ee27 100644
--- a/svgio/source/svgreader/svgpatternnode.cxx
+++ b/svgio/source/svgreader/svgpatternnode.cxx
@@ -257,7 +257,7 @@ namespace svgio::svgreader
 
         const drawinglayer::primitive2d::Primitive2DContainer& SvgPatternNode::getPatternPrimitives() const
         {
-            if(aPrimitives.empty() && Display_none != getDisplay())
+            if(aPrimitives.empty() && Display::None != getDisplay())
             {
                 decomposeSvgNode(const_cast< SvgPatternNode* >(this)->aPrimitives, true);
             }
diff --git a/svgio/source/svgreader/svgusenode.cxx b/svgio/source/svgreader/svgusenode.cxx
index e4b59ba733e3..e4fc03ae7345 100644
--- a/svgio/source/svgreader/svgusenode.cxx
+++ b/svgio/source/svgreader/svgusenode.cxx
@@ -140,7 +140,7 @@ namespace svgio::svgreader
             // try to access link to content
             const SvgNode* pXLink = getDocument().findSvgNodeById(maXLink);
 
-            if (!pXLink || Display_none == pXLink->getDisplay() || mbDecomposingSvgNode)
+            if (!pXLink || Display::None == pXLink->getDisplay() || mbDecomposingSvgNode)
                 return;
 
             // decompose children
diff --git a/svgio/source/svguno/xsvgparser.cxx b/svgio/source/svguno/xsvgparser.cxx
index ddd9d20cd74c..7e8f8abe4439 100644
--- a/svgio/source/svguno/xsvgparser.cxx
+++ b/svgio/source/svguno/xsvgparser.cxx
@@ -131,7 +131,7 @@ namespace svgio::svgreader
                 // decompose to primitives
                 for(std::unique_ptr<SvgNode> const & pCandidate : pSvgDocHdl->getSvgDocument().getSvgNodeVector())
                 {
-                    if(Display_none != pCandidate->getDisplay())
+                    if (Display::None != pCandidate->getDisplay())
                     {
                         pCandidate->decomposeSvgNode(aRetval, false);
                     }
@@ -160,7 +160,7 @@ namespace svgio::svgreader
             // decompose to primitives
             for (std::unique_ptr<SvgNode> const & pCandidate : pSvgDocHdl->getSvgDocument().getSvgNodeVector())
             {
-                if (Display_none != pCandidate->getDisplay())
+                if (Display::None != pCandidate->getDisplay())
                 {
                     mpVisitor = std::make_shared<SvgDrawVisitor>();
                     pCandidate->accept(*mpVisitor);


More information about the Libreoffice-commits mailing list