[Libreoffice-commits] core.git: include/svx

Tor Lillqvist tml at collabora.com
Tue Feb 14 15:53:25 UTC 2017


 include/svx/EnhancedCustomShapeFunctionParser.hxx |   47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)

New commits:
commit 3f5392c19676a7274a9c9f6e4406c6ab98eab7ad
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Feb 14 17:50:41 2017 +0200

    Add operator<< to output values of type enum class ExpressionFunct
    
    For debugging output.
    
    Change-Id: Ic2cd0dfc76eaa5814e718bd1e254427c334d6fab

diff --git a/include/svx/EnhancedCustomShapeFunctionParser.hxx b/include/svx/EnhancedCustomShapeFunctionParser.hxx
index 1539a7f..828a4ef 100644
--- a/include/svx/EnhancedCustomShapeFunctionParser.hxx
+++ b/include/svx/EnhancedCustomShapeFunctionParser.hxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
 #include <memory>
+#include <ostream>
 #include <vector>
 
 #include <svx/svxdllapi.h>
@@ -83,6 +84,52 @@ enum class ExpressionFunct
     TernaryIf
 };
 
+template< typename charT, typename traits >
+inline std::basic_ostream<charT, traits> & operator <<(
+    std::basic_ostream<charT, traits> & stream, const ExpressionFunct& eFunc )
+{
+    switch (eFunc)
+    {
+    case ExpressionFunct::Const : return stream << "const";
+
+    case ExpressionFunct::EnumPi : return stream << "pi";
+    case ExpressionFunct::EnumLeft : return stream << "left";
+    case ExpressionFunct::EnumTop : return stream << "top";
+    case ExpressionFunct::EnumRight : return stream << "right";
+    case ExpressionFunct::EnumBottom : return stream << "bottom";
+    case ExpressionFunct::EnumXStretch : return stream << "xstretch";
+    case ExpressionFunct::EnumYStretch : return stream << "ystretch";
+    case ExpressionFunct::EnumHasStroke : return stream << "hasstroke";
+    case ExpressionFunct::EnumHasFill : return stream << "hasfill";
+    case ExpressionFunct::EnumWidth : return stream << "width";
+    case ExpressionFunct::EnumHeight : return stream << "height";
+    case ExpressionFunct::EnumLogWidth : return stream << "logwidth";
+    case ExpressionFunct::EnumLogHeight : return stream << "logheight";
+    case ExpressionFunct::EnumAdjustment : return stream << "adjustment";
+    case ExpressionFunct::EnumEquation : return stream << "equation";
+
+    case ExpressionFunct::UnaryAbs : return stream << "abs";
+    case ExpressionFunct::UnarySqrt : return stream << "sqrt";
+    case ExpressionFunct::UnarySin : return stream << "sin";
+    case ExpressionFunct::UnaryCos : return stream << "cos";
+    case ExpressionFunct::UnaryTan : return stream << "tan";
+    case ExpressionFunct::UnaryAtan : return stream << "atan";
+    case ExpressionFunct::UnaryNeg : return stream << "neg";
+
+    case ExpressionFunct::BinaryPlus : return stream << "plus";
+    case ExpressionFunct::BinaryMinus : return stream << "minus";
+    case ExpressionFunct::BinaryMul : return stream << "mul";
+    case ExpressionFunct::BinaryDiv : return stream << "div";
+    case ExpressionFunct::BinaryMin : return stream << "min";
+    case ExpressionFunct::BinaryMax : return stream << "max";
+    case ExpressionFunct::BinaryAtan2 : return stream << "atan2";
+
+    case ExpressionFunct::TernaryIf : return stream << "if";
+
+    default: return stream << "?(" << (int)eFunc << ")";
+    }
+}
+
 #define EXPRESSION_FLAG_SUMANGLE_MODE 1
 
 SVX_DLLPUBLIC void FillEquationParameter( const css::drawing::EnhancedCustomShapeParameter&, const sal_Int32, EnhancedCustomShapeEquation& );


More information about the Libreoffice-commits mailing list