[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: koffice/filters/kspread/excel/import
From:       Carlos Licea <carlos_licea () hotmail ! com>
Date:       2010-08-03 18:14:04
Message-ID: 201008031214.04736.carlos_licea () hotmail ! com
[Download RAW message or body]

On Domingo 01 Agosto 2010 10:24:38 Marijn Kruisselbrink escribió:
> SVN commit 1157938 by mkruisselbrink:
> 
> no reason for these methods not to be static
> 
>  M  +6 -6      excelimport.cc
> 
> 
> --- trunk/koffice/filters/kspread/excel/import/excelimport.cc
> #1157937:1157938 @@ -64,28 +64,26 @@
>      return qHash(font.fontFamily()) ^ qRound(font.fontSize() * 100);
>  }
> 
> -qreal offset( unsigned long dimension, unsigned long offset ) {
> +static qreal offset( unsigned long dimension, unsigned long offset ) {
>      return (float)dimension * (float)offset / 1024.0;
>  }
> 
> -qreal columnWidth(Sheet* sheet, unsigned long col) {
> +static qreal columnWidth(Sheet* sheet, unsigned long col) {
>      if( sheet->column(col, false) )
>          return sheet->column(col)->width();
> 
>      return sheet->defaultColWidth();
>  }
> 
> -qreal rowHeight(Sheet* sheet, unsigned long row) {
> +static qreal rowHeight(Sheet* sheet, unsigned long row) {
>      if( sheet->row(row, false) )
>          return sheet->row(row)->height();
> 
>      return sheet->defaultRowHeight();
>  }
> 
> -}
> -
>  // Returns A for 1, B for 2, C for 3, etc.
> -QString columnName(uint column)
> +static QString columnName(uint column)
>  {
>      QString s;
>      unsigned digits = 1;
> @@ -97,6 +95,8 @@
>      return s;
>  }
> 
> +}
> +
>  using namespace Swinder;
> 
>  class ExcelImport::Private
Good catch, those function calls are better marked as "only-usable within-
this-compilation-unit," however, AFAICT the new "proper" way to do this is to 
use a anonymous namespace, that is

namespace {
//functions
}

Small discussion about the topic:
http://stackoverflow.com/questions/154469/unnamed-anonymous-namespaces-vs-
static-functions

Would it be worth to change?
-- 
Carlos Licea

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic