Public Member Functions | Public Attributes | List of all members
SortModuleTimes.MaxItemLengthsClass Class Reference

Public Member Functions

def __init__ (self, n=0)
 
def add (self, items)
 
def __len__ (self)
 
def __iter__ (self)
 
def __getitem__ (self, index)
 

Public Attributes

 maxlength
 

Detailed Description

A list with the maximum length of items seen.

Facilitates the correct sizing of a table in text mode.

When a list of strings is add()ed, for each position in the list the length
of the string in that position is compared to the maximum one seen so far in
that position, and that maximum value is updated if proper.

Definition at line 617 of file SortModuleTimes.py.

Constructor & Destructor Documentation

def SortModuleTimes.MaxItemLengthsClass.__init__ (   self,
  n = 0 
)

Definition at line 626 of file SortModuleTimes.py.

626  def __init__(self, n = 0):
627  self.maxlength = [ None ] * n
628 

Member Function Documentation

def SortModuleTimes.MaxItemLengthsClass.__getitem__ (   self,
  index 
)

Definition at line 644 of file SortModuleTimes.py.

644  def __getitem__(self, index): return self.maxlength[index]
645 
646 # class MaxItemLengthsClass
647 
648 
def SortModuleTimes.MaxItemLengthsClass.__iter__ (   self)
def SortModuleTimes.MaxItemLengthsClass.__len__ (   self)
def SortModuleTimes.MaxItemLengthsClass.add (   self,
  items 
)

Definition at line 629 of file SortModuleTimes.py.

629  def add(self, items):
630  for iItem, item in enumerate(items):
631  try:
632  maxlength = self.maxlength[iItem]
633  except IndexError:
634  self.maxlength.extend([ None ] * (iItem + 1 - len(self.maxlength)))
635  maxlength = None
636  #
637  itemlength = len(str(item))
638  if maxlength < itemlength: self.maxlength[iItem] = itemlength
639  # for
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
static QCString str

Member Data Documentation

SortModuleTimes.MaxItemLengthsClass.maxlength

Definition at line 627 of file SortModuleTimes.py.


The documentation for this class was generated from the following file: