Macros | Functions | Variables
qdir_win32.cpp File Reference
#include "qglobal.h"
#include "qdir.h"
#include "qfileinfo.h"
#include "qfiledefs_p.h"
#include "qregexp.h"
#include "qstringlist.h"
#include <stdlib.h>
#include <ctype.h>

Go to the source code of this file.

Macros

#define IS_SUBDIR   _A_SUBDIR
 
#define IS_RDONLY   _A_RDONLY
 
#define IS_ARCH   _A_ARCH
 
#define IS_HIDDEN   _A_HIDDEN
 
#define IS_SYSTEM   _A_SYSTEM
 
#define FF_GETFIRST   _findfirst
 
#define FF_GETNEXT   _findnext
 
#define FF_ERROR   -1
 

Functions

QStringList qt_makeFilterList (const QString &filter)
 
int qt_cmp_si (const void *, const void *)
 
static QString p_getenv (QString name)
 

Variables

int qt_cmp_si_sortSpec
 

Macro Definition Documentation

#define FF_ERROR   -1

Definition at line 284 of file qdir_win32.cpp.

#define FF_GETFIRST   _findfirst

Definition at line 282 of file qdir_win32.cpp.

#define FF_GETNEXT   _findnext

Definition at line 283 of file qdir_win32.cpp.

#define IS_ARCH   _A_ARCH

Definition at line 279 of file qdir_win32.cpp.

#define IS_HIDDEN   _A_HIDDEN

Definition at line 280 of file qdir_win32.cpp.

#define IS_RDONLY   _A_RDONLY

Definition at line 278 of file qdir_win32.cpp.

#define IS_SUBDIR   _A_SUBDIR

Definition at line 277 of file qdir_win32.cpp.

#define IS_SYSTEM   _A_SYSTEM

Definition at line 281 of file qdir_win32.cpp.

Function Documentation

static QString p_getenv ( QString  name)
static

Definition at line 62 of file qdir_win32.cpp.

63 {
64  DWORD len = GetEnvironmentVariableW( ( LPCWSTR ) qt_winTchar ( name, TRUE ), NULL, 0 );
65  if ( len == 0 )
66  return QString::null;
67  /* ansi: we allocate too much memory, but this shouldn't be the problem here ... */
68  LPWSTR buf = (LPWSTR)new WCHAR[ len ];
69  len = GetEnvironmentVariableW ( ( LPCWSTR ) qt_winTchar ( name, TRUE ), buf, len );
70  if ( len == 0 )
71  {
72  delete[] buf;
73  return QString::null;
74  }
75  QString ret = qt_winQString ( buf );
76  delete[] buf;
77  return ret;
78 }
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
static const Null null
Definition: qstring.h:376
UWORD32 buf[4]
Definition: md5.h:42
const bool TRUE
Definition: qglobal.h:371
int qt_cmp_si ( const void *  ,
const void *   
)

Definition at line 1145 of file qdir.cpp.

1146 {
1147  if ( !n1 || !n2 )
1148  return 0;
1149 
1150  QDirSortItem* f1 = (QDirSortItem*)n1;
1151  QDirSortItem* f2 = (QDirSortItem*)n2;
1152 
1154  if ( f1->item->isDir() != f2->item->isDir() )
1155  return f1->item->isDir() ? -1 : 1;
1156 
1157  int r = 0;
1158  int sortBy = qt_cmp_si_sortSpec & QDir::SortByMask;
1159 
1160  switch ( sortBy ) {
1161  case QDir::Time:
1162  r = f1->item->lastModified().secsTo(f2->item->lastModified());
1163  break;
1164  case QDir::Size:
1165  r = f2->item->size() - f1->item->size();
1166  break;
1167  default:
1168  ;
1169  }
1170 
1171  if ( r == 0 && sortBy != QDir::Unsorted ) {
1172  // Still not sorted - sort by name
1174 
1175  if ( f1->filename_cache.isNull() )
1176  f1->filename_cache = ic ? f1->item->fileName().lower()
1177  : f1->item->fileName();
1178  if ( f2->filename_cache.isNull() )
1179  f2->filename_cache = ic ? f2->item->fileName().lower()
1180  : f2->item->fileName();
1181 
1182  r = f1->filename_cache.compare(f2->filename_cache);
1183  }
1184 
1185  if ( r == 0 ) {
1186  // Enforce an order - the order the items appear in the array
1187  r = (int)((char*)n1 - (char*)n2);
1188  }
1189 
1191  return -r;
1192  else
1193  return r;
1194 }
QString lower() const
Definition: qstring.cpp:13375
int compare(const QString &s) const
Definition: qstring.cpp:14838
int secsTo(const QDateTime &) const
Definition: qdatetime.cpp:1260
QString filename_cache
Definition: qdir.h:230
uint size() const
QFileInfo * item
Definition: qdir.h:231
QDateTime lastModified() const
QString fileName() const
bool isNull() const
Definition: qstring.h:379
bool isDir() const
int qt_cmp_si_sortSpec
Definition: qdir.cpp:1139
QStringList qt_makeFilterList ( const QString filter)

Definition at line 1010 of file qdir.cpp.

1011 {
1012  if ( filter.isEmpty() )
1013  return QStringList();
1014 
1015  QChar sep( ';' );
1016  int i = filter.find( sep, 0 );
1017  if ( i == -1 && filter.find( ' ', 0 ) != -1 )
1018  sep = QChar( ' ' );
1019 
1020  QStringList lst = QStringList::split( sep, filter );
1021  QStringList lst2;
1022  QStringList::Iterator it = lst.begin();
1023 
1024  for ( ; it != lst.end(); ++it ) {
1025  QString s = *it;
1026  lst2 << s.stripWhiteSpace();
1027  }
1028  return lst2;
1029 }
bool isEmpty() const
Definition: qstring.h:682
Iterator end()
Definition: qvaluelist.h:363
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
The QChar class provides a light-weight Unicode character.
Definition: qstring.h:56
A list of strings.
Definition: qstringlist.h:51
QString stripWhiteSpace() const
Definition: qstring.cpp:13438
int find(QChar c, int index=0, bool cs=TRUE) const
Definition: qstring.cpp:12902
Iterator begin()
Definition: qvaluelist.h:361
static QStringList split(const QString &sep, const QString &str, bool allowEmptyEntries=FALSE)
static QCString * s
Definition: config.cpp:1042

Variable Documentation

int qt_cmp_si_sortSpec

Definition at line 1139 of file qdir.cpp.