lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [6584] Use std::string instead of char* in wx_table_genera


From: gchicares
Subject: [lmi-commits] [6584] Use std::string instead of char* in wx_table_generator (VZ)
Date: Fri, 13 May 2016 13:49:15 +0000 (UTC)

Revision: 6584
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6584
Author:   chicares
Date:     2016-05-13 13:49:15 +0000 (Fri, 13 May 2016)
Log Message:
-----------
Use std::string instead of char* in wx_table_generator (VZ)

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/group_quote_pdf_gen_wx.cpp
    lmi/trunk/wx_table_generator.cpp
    lmi/trunk/wx_table_generator.hpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2016-05-12 15:48:17 UTC (rev 6583)
+++ lmi/trunk/ChangeLog 2016-05-13 13:49:15 UTC (rev 6584)
@@ -39106,3 +39106,12 @@
 Prevent crash if GUI test aborted (VZ). See:
   https://github.com/vadz/lmi/pull/24/
 
+20160513T1349Z <address@hidden> [451]
+
+  group_quote_pdf_gen_wx.cpp
+  wx_table_generator.cpp
+  wx_table_generator.hpp
+Use std::string instead of char* in wx_table_generator (VZ). See:
+  https://github.com/vadz/lmi/pull/28
+for this commit and the next several.
+

Modified: lmi/trunk/group_quote_pdf_gen_wx.cpp
===================================================================
--- lmi/trunk/group_quote_pdf_gen_wx.cpp        2016-05-12 15:48:17 UTC (rev 
6583)
+++ lmi/trunk/group_quote_pdf_gen_wx.cpp        2016-05-13 13:49:15 UTC (rev 
6584)
@@ -996,7 +996,7 @@
                 }
             }
 
-        table_gen.add_column(header.c_str(), cd.widest_text_);
+        table_gen.add_column(header, cd.widest_text_);
         }
 
     output_table_totals(pdf_dc, table_gen, &pos_y);

Modified: lmi/trunk/wx_table_generator.cpp
===================================================================
--- lmi/trunk/wx_table_generator.cpp    2016-05-12 15:48:17 UTC (rev 6583)
+++ lmi/trunk/wx_table_generator.cpp    2016-05-13 13:49:15 UTC (rev 6584)
@@ -70,14 +70,14 @@
 }
 
 void wx_table_generator::add_column
-    (char const* header
-    ,char const* widest_text
+    (std::string const& header
+    ,std::string const& widest_text
     )
 {
     wxDCFontChanger set_header_font(dc_, get_header_font());
 
     // Set width to the special value of 0 for the variable width columns.
-    int width = widest_text[0] ? dc_.GetTextExtent(widest_text).x : 0;
+    int width = widest_text.empty() ? 0 : dc_.GetTextExtent(widest_text).x;
 
     // Keep track of the maximal number of lines in a header as this determines
     // the number of lines used for all of them. This is one plus the number of

Modified: lmi/trunk/wx_table_generator.hpp
===================================================================
--- lmi/trunk/wx_table_generator.hpp    2016-05-12 15:48:17 UTC (rev 6583)
+++ lmi/trunk/wx_table_generator.hpp    2016-05-13 13:49:15 UTC (rev 6584)
@@ -54,9 +54,9 @@
     // Each column must either have a fixed width, specified as the width of
     // the longest text that may appear in this column, or be expandable
     // meaning that the rest of the page width is allocated to it which will be
-    // the case if widest_text is empty (but it shouldn't be null).
+    // the case if widest_text is empty.
     // Notice that column headers may be multiline strings.
-    void add_column(char const* header, char const* widest_text);
+    void add_column(std::string const& header, std::string const& widest_text);
 
     // Render the headers at the given position and update it.
     void output_header(int* pos_y);
@@ -113,7 +113,7 @@
 
     struct column_info
     {
-        column_info(char const* header, int width)
+        column_info(std::string const& header, int width)
             :header_(header)
             ,width_(width)
             // Fixed width columns are centered by default, variable width ones




reply via email to

[Prev in Thread] Current Thread [Next in Thread]