Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

utils.hpp File Reference

Various utility functions. More...

#include <wx/wxprec.h>
#include <wx/wx.h>
#include <wx/filename.h>
#include "bytedisp.hpp"

Include dependency graph for utils.hpp:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int compareFileName (const wxString &fn1, const wxString &fn2)
 Compares two file names.

void GetAllTokenCases (wxString token, wxArrayString &tk, size_t p=0)
 Get the given token with all the possible cases.

wxString getAppName (bool addVersion=true)
 Gets the application's name.

bool getFilesInSubdirectories (const wxArrayString &lFiles, wxArrayString &res, BytesDisplayer &filesSize, const wxString &matchPattern=wxEmptyString, unsigned int maxDepth=0)
 Find all the files in the subdirectories from a list of files and directories.

wxColour longTowxColour (long value)
 Convert a long value to a wxColour value.

void ToLower (wxString &s, size_t idx)
 Convert the specified character to the lower case.

void ToUpper (wxString &s, size_t idx)
 Convert the specified character to the upper case.

long wxColourToLong (const wxColour &value)
 Convert a wxColour value to a long value.


Detailed Description

Various utility functions.

Definition in file utils.hpp.


Function Documentation

int compareFileName const wxString &  fn1,
const wxString &  fn2
 

Compares two file names.

Under Windows the comparison is case insensitive.

Parameters:
fn1 First file name.
fn2 Second file name.
Returns:
A negative value if f1 < f2, a positive value if f1 > f2, 0 if f1 == f2.

Definition at line 76 of file utils.cpp.

Referenced by dlgFilesSelector::addFileNamesToListView(), dlgFilesSelector::addLineToComboBox(), dlgAddMatchFiles::addLineToComboBox(), removeFilesInListCompare(), and dlgFilesSelector::FilesListValidator::TransferToWindow().

void GetAllTokenCases wxString  token,
wxArrayString &  tk,
size_t  p
 

Get the given token with all the possible cases.

Result is added to tk.

Parameters:
token Token to get with all the possible cases.
tk Arary of string when the tokens will be added.
p Current position in the token (only for internal recursivity).

Definition at line 392 of file utils.cpp.

References ToLower(), and ToUpper().

Referenced by getFilesInSubdirectories(), and wxFileDialogFilterMaker::GetFilters().

wxString getAppName bool  addVersion  ) 
 

Gets the application's name.

Parameters:
addVersion If true, add the version number + special.
Returns:
The application's name.

Definition at line 293 of file utils.cpp.

References APP_MAJOR_VER, APP_MINOR_VER, APP_NAME, APP_SPECIAL, and APP_SUBVER.

Referenced by dlgAddMatchFiles::btnSaveListClick(), dlgConfigure::createControls(), dlgAbout::createControls(), CmdLineOptions::init(), CkSumsApp::OnInitCmdLine(), and MD5File::write().

bool getFilesInSubdirectories const wxArrayString &  lFiles,
wxArrayString &  res,
BytesDisplayer filesSize,
const wxString &  matchPattern,
unsigned int  maxDepth
 

Find all the files in the subdirectories from a list of files and directories.

A matching pattern can be speficied. Wildcards are * and ?. * subtitutes one or more characters, ? one character.
Matching patterns are separated by the ; character.
If no matching patterns are given, all the files will be matched.

The depth of recursion can be 0 for no limit, 1 for the given directories, 2 for the given directories and their subdirectories, etc...

Parameters:
lFiles List of files and directories to search into.
res Array of string where all the founded files will to stored. All files present in lFiles will be copied (but not the directories).
filesSize Will contains the total size of the parsed files.
matchPattern Optionnal matching pattern for files' names.
maxDepth Maximal depth of recursion.
Returns:
true on success, false on failure or if the user has canceled.

Definition at line 247 of file utils.cpp.

References GetAllTokenCases(), getFilesInSubdirectoriesRec(), dlgProgress::Update(), and UPDATE_PROGRESS_DLG.

wxColour longTowxColour long  value  ) 
 

Convert a long value to a wxColour value.

Parameters:
value The value to convert.
Returns:
The value converted to a wxColour value.

Definition at line 336 of file utils.cpp.

Referenced by dlgResultsProgress::getColour().

void ToLower wxString &  s,
size_t  idx
 

Convert the specified character to the lower case.

Parameters:
s String that contains the character to lower.
idx Index in s of the character to lower.

Definition at line 353 of file utils.cpp.

Referenced by GetAllTokenCases().

void ToUpper wxString &  s,
size_t  idx
 

Convert the specified character to the upper case.

Parameters:
s String that contains the character to upper.
idx Index in s of the character to upper.

Definition at line 372 of file utils.cpp.

Referenced by GetAllTokenCases().

long wxColourToLong const wxColour &  value  ) 
 

Convert a wxColour value to a long value.

Parameters:
value The value to convert.
Returns:
The value converted to a long value.

Definition at line 318 of file utils.cpp.

Referenced by frmSums::itmToolsConfigureClick().


Generated on Sun May 30 13:38:02 2004 for wxChecksums by doxygen 1.3.7