From 0e372f5a358c2a351d1267dc6a7f00a17b3bc968 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 26 Mar 2013 10:51:57 +0000
Subject: [PATCH] add OpenProject in the API + cleanup consts

---
 Common/Gmsh.cpp | 26 +++++++++++++++++++-------
 Common/Gmsh.h   | 23 +++++++++++++++--------
 2 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/Common/Gmsh.cpp b/Common/Gmsh.cpp
index 730b6fac8d..892c4f65a8 100644
--- a/Common/Gmsh.cpp
+++ b/Common/Gmsh.cpp
@@ -91,41 +91,53 @@ int GmshSetBoundingBox(double xmin, double xmax,
   return 1;
 }
 
-int GmshSetOption(std::string category, std::string name, std::string value, int index)
+int GmshSetOption(const std::string &category, const std::string &name,
+                  std::string value, int index)
 {
   return StringOption(GMSH_SET|GMSH_GUI, category.c_str(), index, name.c_str(), value);
 }
 
-int GmshSetOption(std::string category, std::string name, double value, int index)
+int GmshSetOption(const std::string &category, const std::string &name,
+                  double value, int index)
 {
   return NumberOption(GMSH_SET|GMSH_GUI, category.c_str(), index, name.c_str(), value);
 }
 
-int GmshSetOption(std::string category, std::string name, unsigned int value, int index)
+int GmshSetOption(const std::string &category, const std::string &name,
+                  unsigned int value, int index)
 {
   return ColorOption(GMSH_SET|GMSH_GUI, category.c_str(), index, name.c_str(), value);
 }
 
-int GmshGetOption(std::string category, std::string name, std::string &value, int index)
+int GmshGetOption(const std::string &category, const std::string &name,
+                  std::string &value, int index)
 {
   return StringOption(GMSH_GET, category.c_str(), index, name.c_str(), value);
 }
 
-int GmshGetOption(std::string category, std::string name, double &value, int index)
+int GmshGetOption(const std::string &category, const std::string &name,
+                  double &value, int index)
 {
   return NumberOption(GMSH_GET, category.c_str(), index, name.c_str(), value);
 }
 
-int GmshGetOption(std::string category, std::string name, unsigned int &value, int index)
+int GmshGetOption(const std::string &category, const std::string &name,
+                  unsigned int &value, int index)
 {
   return ColorOption(GMSH_GET, category.c_str(), index, name.c_str(), value);
 }
 
-int GmshMergeFile(std::string fileName)
+int GmshMergeFile(const std::string &fileName)
 {
   return MergeFile(fileName, true);
 }
 
+int GmshOpenProject(const std::string &fileName)
+{
+  OpenProject(fileName);
+  return 1;
+}
+
 int GmshWriteFile(std::string fileName)
 {
   CreateOutputFile(fileName, FORMAT_AUTO);
diff --git a/Common/Gmsh.h b/Common/Gmsh.h
index 40301090aa..a0c5e1ff4c 100644
--- a/Common/Gmsh.h
+++ b/Common/Gmsh.h
@@ -14,14 +14,21 @@ int GmshSetMessageHandler(GmshMessage *callback);
 int GmshSetBoundingBox(double xmin, double xmax,
                        double ymin, double ymax,
                        double zmin, double zmax);
-int GmshSetOption(std::string category, std::string name, std::string value, int index=0);
-int GmshSetOption(std::string category, std::string name, double value, int index=0);
-int GmshSetOption(std::string category, std::string name, unsigned int value, int index=0);
-int GmshGetOption(std::string category, std::string name, std::string &value, int index=0);
-int GmshGetOption(std::string category, std::string name, double &value, int index=0);
-int GmshGetOption(std::string category, std::string name, unsigned int &value, int index=0);
-int GmshMergeFile(std::string fileName);
-int GmshWriteFile(std::string fileName);
+int GmshSetOption(const std::string &category, const std::string &name,
+                  std::string value, int index=0);
+int GmshSetOption(const std::string &category, const std::string &name,
+                  double value, int index=0);
+int GmshSetOption(const std::string &category, const std::string &name,
+                  unsigned int value, int index=0);
+int GmshGetOption(const std::string &category, const std::string &name,
+                  std::string &value, int index=0);
+int GmshGetOption(const std::string &category, const std::string &name,
+                  double &value, int index=0);
+int GmshGetOption(const std::string &category, const std::string &name,
+                  unsigned int &value, int index=0);
+int GmshMergeFile(const std::string &fileName);
+int GmshOpenProject(const std::string &fileName);
+int GmshWriteFile(const std::string &fileName);
 int GmshFinalize();
 int GmshBatch();
 int GmshFLTK(int argc=0, char **argv=0);
-- 
GitLab