[Libreoffice-commits] core.git: starmath/inc starmath/Library_sm.mk starmath/source

dante (via logerrit) logerrit at kemper.freedesktop.org
Sat Feb 27 19:37:28 UTC 2021


 starmath/Library_sm.mk    |    1 
 starmath/inc/parse.hxx    |    9 ++++++++
 starmath/source/parse.cxx |   51 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+)

New commits:
commit f89e85fdddd8bbccfa72ba9b4ad2ca31a8debcee
Author:     dante <dante19031999 at gmail.com>
AuthorDate: Sat Feb 27 18:36:52 2021 +0100
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Feb 27 20:36:49 2021 +0100

    Introduce the abstractsmparser getter methods
    
    Change-Id: Id8dee76aa7dfa7355f79fab9afb9471b2ec4575c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111686
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk
index ece71cc8d143..89f9f34c59bf 100644
--- a/starmath/Library_sm.mk
+++ b/starmath/Library_sm.mk
@@ -81,6 +81,7 @@ $(eval $(call gb_Library_add_exception_objects,sm,\
         starmath/source/ooxmlimport \
         starmath/source/rtfexport \
         starmath/source/parsebase \
+        starmath/source/parse \
         starmath/source/parse5 \
         starmath/source/rect \
         starmath/source/scrwin \
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index d033faa2bf06..9896eaa871fb 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -26,6 +26,15 @@
 
 #include "parse5.hxx"
 
+namespace starmathdatabase
+{
+
+AbstractSmParser* GetDefaultSmParser();
+
+AbstractSmParser* GetVersionSmParser(sal_uInt16 nVersion);
+
+}
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
new file mode 100644
index 000000000000..3ea272faef6b
--- /dev/null
+++ b/starmath/source/parse.cxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <parse.hxx>
+#include <smmod.hxx>
+#include <cfgitem.hxx>
+
+AbstractSmParser* starmathdatabase::GetDefaultSmParser()
+{
+    switch(SM_MOD()->GetConfig()->GetDefaultSmSyntaxVersion())
+    {
+    case 5:
+    {
+        AbstractSmParser* aParser = new SmParser();
+        return aParser;
+    }
+    default:
+        throw std::range_error("parser depth limit");
+    }
+}
+
+AbstractSmParser* starmathdatabase::GetVersionSmParser(sal_uInt16 nVersion)
+{
+    switch(nVersion)
+    {
+    case 5:
+    {
+        AbstractSmParser* aParser = new SmParser();
+        return aParser;
+    }
+    default:
+        throw std::range_error("parser depth limit");
+    }
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list