diff libinterp/corefcn/graphics.cc @ 21021:a5b99b09f8fd

maint: Use comparison operators rather than compare() for strings. * graphics.cc, graphics.in.h, load-path.cc, ls-oct-text.cc, ls-oct-text.h, __init_fltk__.cc, oct-parse.in.yy, file-ops.cc: Use comparison operators rather than compare() for strings.
author Rik <rik@octave.org>
date Thu, 31 Dec 2015 13:39:25 -0800
parents 93748bcaec17
children 4e2e93ec558a
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Thu Dec 31 12:01:01 2015 +0100
+++ b/libinterp/corefcn/graphics.cc	Thu Dec 31 13:39:25 2015 -0800
@@ -2022,7 +2022,7 @@
             {
               std::string sval = val.string_value ();
 
-              remove = (sval.compare ("remove") == 0);
+              remove = (sval == "remove");
             }
 
           pval_map_type& pval_map = plist_map[pfx];
@@ -2367,13 +2367,13 @@
 
       octave_value default_val;
 
-      if (sval.compare ("default") == 0)
+      if (sval == "default")
         {
           default_val = get_default (pname);
 
           rep->set (pname, default_val);
         }
-      else if (sval.compare ("factory") == 0)
+      else if (sval == "factory")
         {
           default_val = get_factory_default (pname);
 
@@ -2382,9 +2382,9 @@
       else
         {
           // Matlab specifically uses "\default" to escape string setting
-          if (sval.compare ("\\default") == 0)
+          if (sval == "\\default")
             rep->set (pname, "default");
-          else if (sval.compare ("\\factory") == 0)
+          else if (sval == "\\factory")
             rep->set (pname, "factory");
           else
             rep->set (pname, val);
@@ -3459,33 +3459,33 @@
 void
 root_figure::properties::update_units (void)
 {
-  caseless_str xunits = get_units ();
+  std::string xunits = get_units ();
 
   Matrix scrn_sz = default_screensize ();
 
   double dpi = get_screenpixelsperinch ();
 
-  if (xunits.compare ("inches"))
+  if (xunits == "inches")
     {
       scrn_sz(0) = 0;
       scrn_sz(1) = 0;
       scrn_sz(2) /= dpi;
       scrn_sz(3) /= dpi;
     }
-  else if (xunits.compare ("centimeters"))
+  else if (xunits == "centimeters")
     {
       scrn_sz(0) = 0;
       scrn_sz(1) = 0;
       scrn_sz(2) *= 2.54 / dpi;
       scrn_sz(3) *= 2.54 / dpi;
     }
-  else if (xunits.compare ("normalized"))
+  else if (xunits == "normalized")
     {
       scrn_sz = Matrix (1, 4, 1.0);
       scrn_sz(0) = 0;
       scrn_sz(1) = 0;
     }
-  else if (xunits.compare ("points"))
+  else if (xunits == "points")
     {
       scrn_sz(0) = 0;
       scrn_sz(1) = 0;
@@ -4109,8 +4109,8 @@
 void
 figure::properties::update_papertype (void)
 {
-  caseless_str typ = get_papertype ();
-  if (! typ.compare ("<custom>"))
+  std::string typ = get_papertype ();
+  if (typ != "<custom>")
     {
       Matrix sz = papersize_from_type (get_paperunits (), typ);
       if (get_paperorientation () == "landscape")
@@ -5593,9 +5593,9 @@
 {
   ColumnVector retval;
 
-  caseless_str to_units = props.get_units ();
-
-  if (! to_units.compare ("data"))
+  std::string to_units = props.get_units ();
+
+  if (to_units != "data")
     {
       ColumnVector v = xform.transform (p(0), p(1), p(2));
 
@@ -9372,9 +9372,9 @@
                                                                   data));
           else
             {
-              caseless_str busy_action (go.get_properties ().get_busyaction ());
-
-              if (busy_action.compare ("queue"))
+              std::string busy_action (go.get_properties ().get_busyaction ());
+
+              if (busy_action == "queue")
                 do_post_event (graphics_event::create_callback_event (h, name,
                                                                       data));
               else