just added some _T()s
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: filename.h
|
// Name: wx/filename.h
|
||||||
// Purpose: wxFileName - encapsulates ice cream
|
// Purpose: wxFileName - encapsulates a file path
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 28.12.00
|
// Created: 28.12.00
|
||||||
@@ -23,105 +23,123 @@
|
|||||||
// ridiculously enough, this will replace DirExists with wxDirExists etc
|
// ridiculously enough, this will replace DirExists with wxDirExists etc
|
||||||
#include "wx/filefn.h"
|
#include "wx/filefn.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// constants
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// the various values for the path format: this mainly affects the path
|
||||||
|
// separator but also whether or not the path has the drive part (as under
|
||||||
|
// Windows)
|
||||||
enum wxPathFormat
|
enum wxPathFormat
|
||||||
{
|
{
|
||||||
wxPATH_NATIVE = 0,
|
wxPATH_NATIVE = 0,
|
||||||
wxPATH_UNIX,
|
wxPATH_UNIX,
|
||||||
wxPATH_MAC,
|
wxPATH_MAC,
|
||||||
wxPATH_DOS,
|
wxPATH_DOS,
|
||||||
|
|
||||||
wxPATH_BEOS = wxPATH_UNIX,
|
|
||||||
wxPATH_WIN = wxPATH_DOS,
|
|
||||||
wxPATH_OS2 = wxPATH_DOS
|
|
||||||
|
|
||||||
|
wxPATH_BEOS = wxPATH_UNIX,
|
||||||
|
wxPATH_WIN = wxPATH_DOS,
|
||||||
|
wxPATH_OS2 = wxPATH_DOS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// the kind of normalization to do with the file name: these values can be
|
||||||
|
// or'd together to perform several operations at once
|
||||||
|
enum wxPathNormalize
|
||||||
|
{
|
||||||
|
wxPATH_NORM_ENV_VARS = 0x0001, // replace env vars with their values
|
||||||
|
wxPATH_NORM_ABSOLUTE = 0x0002, // squeeze all .. and . and prepend cwd
|
||||||
|
wxPATH_NORM_TILDE = 0x0004, // Unix only: replace ~ and ~user
|
||||||
|
wxPATH_NORM_ALL = 0x0007
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxFileName: encapsulates a file path
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxFileName
|
class WXDLLEXPORT wxFileName
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// constructors and assignment
|
// constructors and assignment
|
||||||
wxFileName()
|
wxFileName()
|
||||||
{ }
|
{ }
|
||||||
wxFileName( const wxFileName &filepath );
|
wxFileName( const wxFileName &filepath );
|
||||||
wxFileName( const wxString &path, bool dir_only = FALSE, wxPathFormat format = wxPATH_NATIVE )
|
wxFileName( const wxString &path, bool dir_only = FALSE, wxPathFormat format = wxPATH_NATIVE )
|
||||||
{ Assign( path, dir_only, format ); }
|
{ Assign( path, dir_only, format ); }
|
||||||
void Assign( const wxString &path, bool dir_only = FALSE, wxPathFormat format = wxPATH_NATIVE );
|
void Assign( const wxString &path, bool dir_only = FALSE, wxPathFormat format = wxPATH_NATIVE );
|
||||||
void Assign( const wxFileName &filepath );
|
void Assign( const wxFileName &filepath );
|
||||||
|
|
||||||
// Only native form
|
// Only native form
|
||||||
bool FileExists();
|
bool FileExists();
|
||||||
static bool FileExists( const wxString &file );
|
static bool FileExists( const wxString &file );
|
||||||
|
|
||||||
bool DirExists();
|
bool DirExists();
|
||||||
static bool DirExists( const wxString &dir );
|
static bool DirExists( const wxString &dir );
|
||||||
|
|
||||||
void AssignCwd();
|
void AssignCwd();
|
||||||
static wxString GetCwd();
|
static wxString GetCwd();
|
||||||
|
|
||||||
bool SetCwd();
|
bool SetCwd();
|
||||||
static bool SetCwd( const wxString &cwd );
|
static bool SetCwd( const wxString &cwd );
|
||||||
|
|
||||||
void AssignHomeDir();
|
void AssignHomeDir();
|
||||||
static wxString GetHomeDir();
|
static wxString GetHomeDir();
|
||||||
|
|
||||||
void AssignTempFileName( const wxString &prefix );
|
void AssignTempFileName( const wxString &prefix );
|
||||||
|
|
||||||
bool Mkdir( int perm = 0777 );
|
bool Mkdir( int perm = 0777 );
|
||||||
static bool Mkdir( const wxString &dir, int perm = 0777 );
|
static bool Mkdir( const wxString &dir, int perm = 0777 );
|
||||||
|
|
||||||
bool Rmdir();
|
bool Rmdir();
|
||||||
static bool Rmdir( const wxString &dir );
|
static bool Rmdir( const wxString &dir );
|
||||||
|
|
||||||
// Remove . and .. (under Unix ~ as well)
|
// Remove . and .. (under Unix ~ as well)
|
||||||
bool Normalize( const wxString &cwd = wxEmptyString, const wxString &home = wxEmptyString );
|
bool Normalize( const wxString &cwd = wxEmptyString, const wxString &home = wxEmptyString );
|
||||||
|
|
||||||
// Comparison
|
// Comparison
|
||||||
bool SameAs( const wxFileName &filepath, bool upper_case = TRUE );
|
bool SameAs( const wxFileName &filepath, bool upper_case = TRUE );
|
||||||
|
|
||||||
// Tests
|
// Tests
|
||||||
bool IsCaseSensitive( wxPathFormat format = wxPATH_NATIVE );
|
bool IsCaseSensitive( wxPathFormat format = wxPATH_NATIVE );
|
||||||
bool IsRelative( wxPathFormat format = wxPATH_NATIVE );
|
bool IsRelative( wxPathFormat format = wxPATH_NATIVE );
|
||||||
bool IsAbsolute( wxPathFormat format = wxPATH_NATIVE );
|
bool IsAbsolute( wxPathFormat format = wxPATH_NATIVE );
|
||||||
bool IsWild( wxPathFormat format = wxPATH_NATIVE );
|
bool IsWild( wxPathFormat format = wxPATH_NATIVE );
|
||||||
|
|
||||||
// Dir accessors
|
// Dir accessors
|
||||||
void AppendDir( const wxString &dir );
|
void AppendDir( const wxString &dir );
|
||||||
void PrependDir( const wxString &dir );
|
void PrependDir( const wxString &dir );
|
||||||
void InsertDir( int before, const wxString &dir );
|
void InsertDir( int before, const wxString &dir );
|
||||||
void RemoveDir( int pos );
|
void RemoveDir( int pos );
|
||||||
size_t GetDirCount() { return m_dirs.GetCount(); }
|
size_t GetDirCount() const { return m_dirs.GetCount(); }
|
||||||
|
|
||||||
// Other accessors
|
// Other accessors
|
||||||
void SetExt( const wxString &ext ) { m_ext = ext; }
|
void SetExt( const wxString &ext ) { m_ext = ext; }
|
||||||
wxString GetExt() const { return m_ext; }
|
wxString GetExt() const { return m_ext; }
|
||||||
bool HasExt() const { return !m_ext.IsEmpty(); }
|
bool HasExt() const { return !m_ext.IsEmpty(); }
|
||||||
|
|
||||||
void SetName( const wxString &name ) { m_name = name; }
|
void SetName( const wxString &name ) { m_name = name; }
|
||||||
wxString GetName() const { return m_name; }
|
wxString GetName() const { return m_name; }
|
||||||
bool HasName() const { return !m_name.IsEmpty(); }
|
bool HasName() const { return !m_name.IsEmpty(); }
|
||||||
|
|
||||||
// name and ext
|
// name and ext
|
||||||
void SetFullName( const wxString name, wxPathFormat format = wxPATH_NATIVE );
|
void SetFullName( const wxString name, wxPathFormat format = wxPATH_NATIVE );
|
||||||
wxString GetFullName();
|
wxString GetFullName();
|
||||||
|
|
||||||
const wxArrayString &GetDirs() const { return m_dirs; }
|
const wxArrayString &GetDirs() const { return m_dirs; }
|
||||||
|
|
||||||
// Construct path only
|
// Construct path only
|
||||||
wxString GetPath( bool add_separator = FALSE, wxPathFormat format = wxPATH_NATIVE ) const;
|
wxString GetPath( bool add_separator = FALSE, wxPathFormat format = wxPATH_NATIVE ) const;
|
||||||
|
|
||||||
// Construct full path with name and ext
|
// Construct full path with name and ext
|
||||||
wxString GetFullPath( wxPathFormat format = wxPATH_NATIVE ) const;
|
wxString GetFullPath( wxPathFormat format = wxPATH_NATIVE ) const;
|
||||||
|
|
||||||
|
|
||||||
static wxPathFormat GetFormat( wxPathFormat format = wxPATH_NATIVE );
|
static wxPathFormat GetFormat( wxPathFormat format = wxPATH_NATIVE );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxArrayString m_dirs;
|
wxArrayString m_dirs;
|
||||||
wxString m_name;
|
wxString m_name;
|
||||||
wxString m_ext;
|
wxString m_ext;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // _WX_FILENAME_H_
|
||||||
|
|
||||||
#endif // _WX_FFILENAME_H_
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: filename.cpp
|
// Name: src/common/filename.cpp
|
||||||
// Purpose: wxFileName - encapsulates candy
|
// Purpose: wxFileName - encapsulates a file path
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 28.12.2000
|
// Created: 28.12.2000
|
||||||
@@ -9,6 +9,14 @@
|
|||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "filename.h"
|
#pragma implementation "filename.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -29,9 +37,13 @@
|
|||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
// wxFileName
|
// wxFileName
|
||||||
//----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxFileName::wxFileName( const wxFileName &filepath )
|
wxFileName::wxFileName( const wxFileName &filepath )
|
||||||
{
|
{
|
||||||
@@ -63,16 +75,16 @@ void wxFileName::Assign( const wxString &path, bool dir_only, wxPathFormat forma
|
|||||||
wxString seps;
|
wxString seps;
|
||||||
if (format == wxPATH_DOS)
|
if (format == wxPATH_DOS)
|
||||||
{
|
{
|
||||||
seps = "/\\";
|
seps = _T("/\\");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (format == wxPATH_UNIX)
|
if (format == wxPATH_UNIX)
|
||||||
{
|
{
|
||||||
seps = "/";
|
seps = _T("/");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
seps = ":";
|
seps = _T(":");
|
||||||
}
|
}
|
||||||
|
|
||||||
wxStringTokenizer tn( path, seps, wxTOKEN_RET_EMPTY_ALL );
|
wxStringTokenizer tn( path, seps, wxTOKEN_RET_EMPTY_ALL );
|
||||||
@@ -116,7 +128,7 @@ void wxFileName::Assign( const wxString &path, bool dir_only, wxPathFormat forma
|
|||||||
if (pos == -1)
|
if (pos == -1)
|
||||||
{
|
{
|
||||||
// add dot back
|
// add dot back
|
||||||
m_name.Prepend( "." );
|
m_name.Prepend( _T(".") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,7 +140,7 @@ void wxFileName::Assign( const wxString &path, bool dir_only, wxPathFormat forma
|
|||||||
if (has_starting_dot && (format == wxPATH_UNIX))
|
if (has_starting_dot && (format == wxPATH_UNIX))
|
||||||
{
|
{
|
||||||
// add dot back
|
// add dot back
|
||||||
m_name.Prepend( "." );
|
m_name.Prepend( _T(".") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -370,7 +382,7 @@ void wxFileName::SetFullName( const wxString name, wxPathFormat format )
|
|||||||
if (pos == -1)
|
if (pos == -1)
|
||||||
{
|
{
|
||||||
// add dot back
|
// add dot back
|
||||||
m_name.Prepend( "." );
|
m_name.Prepend( _T(".") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -383,7 +395,7 @@ void wxFileName::SetFullName( const wxString name, wxPathFormat format )
|
|||||||
if (has_starting_dot && (format == wxPATH_UNIX))
|
if (has_starting_dot && (format == wxPATH_UNIX))
|
||||||
{
|
{
|
||||||
// add dot back
|
// add dot back
|
||||||
m_name.Prepend( "." );
|
m_name.Prepend( _T(".") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -429,7 +441,7 @@ wxString wxFileName::GetPath( bool add_separator, wxPathFormat format ) const
|
|||||||
{
|
{
|
||||||
ret += m_dirs[i];
|
ret += m_dirs[i];
|
||||||
if (add_separator || (i != m_dirs.GetCount()-1))
|
if (add_separator || (i != m_dirs.GetCount()-1))
|
||||||
ret += ":";
|
ret += _T(":");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user