Source: scqtutil.h


Annotated List
Files
Globals
Hierarchy
Index
/***************************************************************************
                          scqtutil.h  -  description
                             -------------------
    begin                : Sun Dec 30 2001
    copyright            : (C) 2001 by Werner Schulte
    email                : werner@schulte-ac.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef SCQTUTIL_H
#define SCQTUTIL_H

#include 
#include 
#include 

/**
  This Class provides some multiple used methods.

  It is normally inherited by classes using listviews
  as editors, e.g.

  It contains various methods, and will be splitted in the
  near future to several classes.

  @author Werner Schulte (email : werner@schulte-ac.de, homepage : www.uv-ac.de)
  @version 0.1.0 - sc - 27.07.2002
  @version 0.1.1 - sc - 24.11.2002
added convAsciiStrToBinStr and related. **/ class ScQtUtil { public: /** deletes all hanging linefeeds and returns the string. @p src : source string
@return : the converted string
**/ const char *chomp( const char *src ); /** converts a BINARY String into an ASCII string containing the information bytewise (e.g. 0x01,0xfa,0xab). @p src : source string
@p *len : the string length (return)
@return : the converted string
**/ const char *convBinStrToAsciiStr( const unsigned char *src, int lenstr ); /** converts an ASCII String Line into an unsigned char string containing the binary information. The AsciiLine is a comma separated string of bytes / substrings follwing the following rules:
0x00,x21,123
0x : hexadecimal byte, x hexadecimal, no leading : decimal byte @p src : source string
@p *len : the string length (return)
@return : the converted string
**/ unsigned char *convAsciiStrToBinStr( const char *src, int *lenstr ); /** converts a MultiLine string containing e.g. linefeeds into one QString by replacing the linefeed through an ASCII Sequence. This class is used to prepare e.g. comment field contents for data file storage (one line). @p src : source string (MultiLineString
@return : the converted string (linefeed replaced)
**/ QString &convStrToLine( const QString &src ); /** does the opposit conversion than convStrLine. The line read from e.g. a data file is converted back to a MultiLineString (shown e.g. in MultiLineEdits). @p src : source string (SingleLineString
@return : the converted string (linefeed back in place)
**/ QString &convStrToMultiLine( const QString &src ); /** returns the word at prosition x from the string. Separators are blank and tab. @p linestr : the string to be searched for word x
@p x : the position where to grabe the word from
@return : the found word (or null string)
**/ QString getWord( const QString &linestr, int x ); /** returns string "day.month" from the datestring. At the moment this works only for the date format dd.mm.yyyy. @p dstr : the date string
@return : the string "dd.mm"
**/ QString getDayAndMonth( const QString &dstr=0 ); /** returns the dates day as a number (int). @p dstr : the date string
@return : the day
**/ int getDayFromDate( const QString &dstr ); /** returns the dates mounth as a number (int). @p dstr : the date string
@return : the month
**/ int getMonFromDate( const QString &dstr ); /** returns the dates year as a number (int). @p dstr : the date string
@return : the year
**/ int getYearFromDate( const QString &dstr ); /** resizes and defines all application fonts. @p FONTSTR : the font to be used
@p FONTSIZE : the size to be used
**/ void resizeFonts( const QString &FONTSTR=0, int FONTSIZE=10 ); /** defines the actual element of the combobox. This element is set to selected. @p com : the combobox
@p dstr : the string, which is the actual element
If null, empty or not found in the combobox, the box stay, as is. **/ void defComboBox( QComboBox *com=0, const QString &dstr=0 ); /** returns the string found in column col in the listview line which contains searchstr as the first element. The method searches in the listviews column 0 for the element which matches searchstr. If found the string from column col is returned. @p ql : the listview which is searched
@p searchstr : the string, which must match column 0 string
@p col : the column to get the string from
@return : the found string (or a string "not found")
**/ QString getTextFromListView( QListView *ql, const QString &searchstr, int col ); /** returns the string found in column col in the listview line which contains searchstr as the first element. The line is searched only as a sibling of the section string. The method searches in the listviews column 0 for the element which matches sectionstr. If found the searchstr is searched in the siblings. If found the string from column col is returned. @p ql : the listview which is searched
@p sectionstr : the string, which must be found as a section (column 0)
@p searchstr : the string, which must match column 0 string
@p col : the column to get the string from
@return : the found string (or a string "not found")
**/ QString getTextFromListViewSection( QListView *ql, const QString §ionstr, const QString &searchstr, int col ); /** returns the ListViewItem of the line which contains the string searchstring in the column col. The method searches in the listviews column col for the element which matches searchstr. If found the ListViewItem is returned. @p ql : the listview which is searched
@p searchstr : the string, which must match column 0 string
@p col : the column to get the string from
@return : the found ListViewItem (or 0)
**/ QListViewItem *getListViewItemByText( QListView *ql, const QString &searchstr, int col ); /** returns the ListViewItem of the line which contains the string searchstring in the column col below the parent string sectionstr. The method searches in the listviews column 0 for the element which matches sectionstr. If found the searchstr is searched in the siblings. If found the ListViewItem is returned. @p ql : the listview which is searched
@p sectionstr : the string, which must be found as a section (column 0)
@p searchstr : the string, which must match column 0 string
@p col : the column to get the string from
@return : the found ListViewItem (or 0)
**/ QListViewItem *getListViewItemByTextSection( QListView *ql, const QString §ionstr, const QString &searchstr, int col ); /** constructor **/ ScQtUtil( ); /** destructor **/ ~ScQtUtil(); private: /** two char arrays malloced to fit the size of the request. */ unsigned char *RETSTR, *TMPSTR; /** two length values */ unsigned int RETLEN, TMPLEN; /** converts an ASCII PartString (a byte) into an unsigned char string containing the binary information. The AsciiPart is a part of the comma separated string of bytes / substrings follwing the following rules:
0x00 or x21 or 123
0x : hexadecimal byte, x hexadecimal, no leading : decimal byte @p src : source string (MultiLineString
@p *len : the string length (return)
@return : the converted string
**/ unsigned char *convAsciiPartToBinStr( const QString &src, int *len ); }; #endif

Generated by: sc on schomep4 on Sun Nov 23 16:54:26 2003, using kdoc 2.0a54.