diff libgui/graphics/QtHandlesUtils.cc @ 22280:26109cce022e

New string utility functions to replace caseless_str for liboctave (bug #48726) * oct-string.h, oct-string.cc: new files that implement strcmp, strcmpi, strncmp, and strncmpi functions in the new octave::string namespace. This functions behave like the ones available in the Octave interpreter. * libinterp/corefcn/strfns.cc: make use of the new functions in liboctave. * libgui/graphics/QtHandlesUtils.cc, libgui/graphics/QtHandlesUtils.h, libinterp/corefcn/cellfun.cc, libinterp/dldfcn/chol.cc: make use of the new functions instead of caseless_str. * liboctave/util/module.mk: add new files to build system.
author Carnë Draug <carandraug@octave.org>
date Sat, 13 Aug 2016 15:35:58 +0100
parents 0806871e3e1e
children bac0d6f07a3e
line wrap: on
line diff
--- a/libgui/graphics/QtHandlesUtils.cc	Sat Aug 13 12:49:58 2016 +0100
+++ b/libgui/graphics/QtHandlesUtils.cc	Sat Aug 13 15:35:58 2016 +0100
@@ -39,6 +39,8 @@
 #include "Object.h"
 #include "QtHandlesUtils.h"
 
+#include "oct-string.h"
+
 namespace QtHandles
 {
 
@@ -249,24 +251,24 @@
 }
 
 Qt::Alignment
-fromHVAlign (const caseless_str& halign, const caseless_str& valign)
+fromHVAlign (const std::string& halign, const std::string& valign)
 {
   Qt::Alignment flags;
 
-  if (halign.compare ("left"))
+  if (octave::string::strcmpi (halign, "left"))
     flags |= Qt::AlignLeft;
-  else if (halign.compare ("center"))
+  else if (octave::string::strcmpi (halign, "center"))
     flags |= Qt::AlignHCenter;
-  else if (halign.compare ("right"))
+  else if (octave::string::strcmpi (halign, "right"))
     flags |= Qt::AlignRight;
   else
     flags |= Qt::AlignLeft;
 
-  if (valign.compare ("middle"))
+  if (octave::string::strcmpi (valign, "middle"))
     flags |= Qt::AlignVCenter;
-  else if (valign.compare ("top"))
+  else if (octave::string::strcmpi (valign, "top"))
     flags |= Qt::AlignTop;
-  else if (valign.compare ("bottom"))
+  else if (octave::string::strcmpi (valign, "bottom"))
     flags |= Qt::AlignBottom;
   else
     flags |= Qt::AlignVCenter;