Source cleaning: whitespaces, tabs, -1/wxID_ANY/wxDefaultCoord, TRUE/true, FALSE/false, !!/!IsEmpty().
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29139 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -177,7 +177,7 @@ typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&);
|
|||||||
|
|
||||||
#define EVT_FIND(id, fn) \
|
#define EVT_FIND(id, fn) \
|
||||||
DECLARE_EVENT_TABLE_ENTRY( \
|
DECLARE_EVENT_TABLE_ENTRY( \
|
||||||
wxEVT_COMMAND_FIND, id, -1, \
|
wxEVT_COMMAND_FIND, id, wxID_ANY, \
|
||||||
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
|
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
|
||||||
& fn, \
|
& fn, \
|
||||||
(wxObject *) NULL \
|
(wxObject *) NULL \
|
||||||
@@ -185,7 +185,7 @@ typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&);
|
|||||||
|
|
||||||
#define EVT_FIND_NEXT(id, fn) \
|
#define EVT_FIND_NEXT(id, fn) \
|
||||||
DECLARE_EVENT_TABLE_ENTRY( \
|
DECLARE_EVENT_TABLE_ENTRY( \
|
||||||
wxEVT_COMMAND_FIND_NEXT, id, -1, \
|
wxEVT_COMMAND_FIND_NEXT, id, wxID_ANY, \
|
||||||
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
|
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
|
||||||
& fn, \
|
& fn, \
|
||||||
(wxObject *) NULL \
|
(wxObject *) NULL \
|
||||||
@@ -193,7 +193,7 @@ typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&);
|
|||||||
|
|
||||||
#define EVT_FIND_REPLACE(id, fn) \
|
#define EVT_FIND_REPLACE(id, fn) \
|
||||||
DECLARE_EVENT_TABLE_ENTRY( \
|
DECLARE_EVENT_TABLE_ENTRY( \
|
||||||
wxEVT_COMMAND_FIND_REPLACE, id, -1, \
|
wxEVT_COMMAND_FIND_REPLACE, id, wxID_ANY, \
|
||||||
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
|
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
|
||||||
& fn, \
|
& fn, \
|
||||||
(wxObject *) NULL \
|
(wxObject *) NULL \
|
||||||
@@ -201,7 +201,7 @@ typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&);
|
|||||||
|
|
||||||
#define EVT_FIND_REPLACE_ALL(id, fn) \
|
#define EVT_FIND_REPLACE_ALL(id, fn) \
|
||||||
DECLARE_EVENT_TABLE_ENTRY( \
|
DECLARE_EVENT_TABLE_ENTRY( \
|
||||||
wxEVT_COMMAND_FIND_REPLACE_ALL, id, -1, \
|
wxEVT_COMMAND_FIND_REPLACE_ALL, id, wxID_ANY, \
|
||||||
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
|
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
|
||||||
& fn, \
|
& fn, \
|
||||||
(wxObject *) NULL \
|
(wxObject *) NULL \
|
||||||
@@ -209,7 +209,7 @@ typedef void (wxEvtHandler::*wxFindDialogEventFunction)(wxFindDialogEvent&);
|
|||||||
|
|
||||||
#define EVT_FIND_CLOSE(id, fn) \
|
#define EVT_FIND_CLOSE(id, fn) \
|
||||||
DECLARE_EVENT_TABLE_ENTRY( \
|
DECLARE_EVENT_TABLE_ENTRY( \
|
||||||
wxEVT_COMMAND_FIND_CLOSE, id, -1, \
|
wxEVT_COMMAND_FIND_CLOSE, id, wxID_ANY, \
|
||||||
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
|
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
|
||||||
& fn, \
|
& fn, \
|
||||||
(wxObject *) NULL \
|
(wxObject *) NULL \
|
||||||
|
@@ -89,7 +89,7 @@
|
|||||||
in the entries it reads: for example, if you have an entry
|
in the entries it reads: for example, if you have an entry
|
||||||
score_file = $HOME/.score
|
score_file = $HOME/.score
|
||||||
a call to Read(&str, "score_file") will return a complete path to .score file
|
a call to Read(&str, "score_file") will return a complete path to .score file
|
||||||
unless the expansion was previousle disabled with SetExpandEnvVars(FALSE) call
|
unless the expansion was previousle disabled with SetExpandEnvVars(false) call
|
||||||
(it's on by default, the current status can be retrieved with
|
(it's on by default, the current status can be retrieved with
|
||||||
IsExpandingEnvVars function).
|
IsExpandingEnvVars function).
|
||||||
*/
|
*/
|
||||||
@@ -150,18 +150,18 @@ public:
|
|||||||
virtual bool GetFirstEntry(wxString& str, long& lIndex) const;
|
virtual bool GetFirstEntry(wxString& str, long& lIndex) const;
|
||||||
virtual bool GetNextEntry (wxString& str, long& lIndex) const;
|
virtual bool GetNextEntry (wxString& str, long& lIndex) const;
|
||||||
|
|
||||||
virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const;
|
virtual size_t GetNumberOfEntries(bool bRecursive = false) const;
|
||||||
virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const;
|
virtual size_t GetNumberOfGroups(bool bRecursive = false) const;
|
||||||
|
|
||||||
virtual bool HasGroup(const wxString& strName) const;
|
virtual bool HasGroup(const wxString& strName) const;
|
||||||
virtual bool HasEntry(const wxString& strName) const;
|
virtual bool HasEntry(const wxString& strName) const;
|
||||||
|
|
||||||
virtual bool Flush(bool bCurrentOnly = FALSE);
|
virtual bool Flush(bool bCurrentOnly = false);
|
||||||
|
|
||||||
virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
|
virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
|
||||||
virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
|
virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
|
||||||
|
|
||||||
virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = TRUE);
|
virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true);
|
||||||
virtual bool DeleteGroup(const wxString& szKey);
|
virtual bool DeleteGroup(const wxString& szKey);
|
||||||
virtual bool DeleteAll();
|
virtual bool DeleteAll();
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ private:
|
|||||||
*m_pCurrentGroup; // the current group
|
*m_pCurrentGroup; // the current group
|
||||||
|
|
||||||
wxMBConv &m_conv;
|
wxMBConv &m_conv;
|
||||||
|
|
||||||
#ifdef __UNIX__
|
#ifdef __UNIX__
|
||||||
int m_umask; // the umask to use for file creation
|
int m_umask; // the umask to use for file creation
|
||||||
#endif // __UNIX__
|
#endif // __UNIX__
|
||||||
@@ -222,6 +222,6 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
// wxUSE_CONFIG
|
// wxUSE_CONFIG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
//_FILECONF_H
|
//_FILECONF_H
|
||||||
|
|
||||||
|
@@ -124,7 +124,7 @@ wxFileSelector(const wxChar *message = wxFileSelectorPromptStr,
|
|||||||
const wxChar *wildcard = wxFileSelectorDefaultWildcardStr,
|
const wxChar *wildcard = wxFileSelectorDefaultWildcardStr,
|
||||||
int flags = 0,
|
int flags = 0,
|
||||||
wxWindow *parent = NULL,
|
wxWindow *parent = NULL,
|
||||||
int x = -1, int y = -1);
|
int x = wxDefaultCoord, int y = wxDefaultCoord);
|
||||||
|
|
||||||
// An extended version of wxFileSelector
|
// An extended version of wxFileSelector
|
||||||
WXDLLEXPORT wxString
|
WXDLLEXPORT wxString
|
||||||
@@ -135,7 +135,7 @@ wxFileSelectorEx(const wxChar *message = wxFileSelectorPromptStr,
|
|||||||
const wxChar *wildcard = wxFileSelectorDefaultWildcardStr,
|
const wxChar *wildcard = wxFileSelectorDefaultWildcardStr,
|
||||||
int flags = 0,
|
int flags = 0,
|
||||||
wxWindow *parent = NULL,
|
wxWindow *parent = NULL,
|
||||||
int x = -1, int y = -1);
|
int x = wxDefaultCoord, int y = wxDefaultCoord);
|
||||||
|
|
||||||
// Ask for filename to load
|
// Ask for filename to load
|
||||||
WXDLLEXPORT wxString
|
WXDLLEXPORT wxString
|
||||||
|
@@ -92,7 +92,7 @@ enum wxSeekMode
|
|||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
#if wxUSE_UNICODE_MSLU
|
#if wxUSE_UNICODE_MSLU
|
||||||
#define wxOpen wxMSLU__wopen
|
#define wxOpen wxMSLU__wopen
|
||||||
|
|
||||||
#define wxAccess wxMSLU__waccess
|
#define wxAccess wxMSLU__waccess
|
||||||
#define wxMkDir wxMSLU__wmkdir
|
#define wxMkDir wxMSLU__wmkdir
|
||||||
#define wxRmDir wxMSLU__wrmdir
|
#define wxRmDir wxMSLU__wrmdir
|
||||||
@@ -157,11 +157,11 @@ enum wxSeekMode
|
|||||||
#define wxTell(fd) lseek(fd, 0, SEEK_CUR)
|
#define wxTell(fd) lseek(fd, 0, SEEK_CUR)
|
||||||
|
|
||||||
#define wxStructStat struct stat
|
#define wxStructStat struct stat
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
# define wxNEED_WX_UNISTD_H
|
# define wxNEED_WX_UNISTD_H
|
||||||
#if defined(__MWERKS__) && defined(macintosh)
|
#if defined(__MWERKS__) && defined(macintosh)
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(__DMC__)
|
#if defined(__DMC__)
|
||||||
typedef unsigned long mode_t;
|
typedef unsigned long mode_t;
|
||||||
@@ -237,16 +237,16 @@ WXDLLIMPEXP_BASE wxString wxFindNextFile();
|
|||||||
WXDLLIMPEXP_BASE bool wxIsWild(const wxString& pattern);
|
WXDLLIMPEXP_BASE bool wxIsWild(const wxString& pattern);
|
||||||
|
|
||||||
// Does the pattern match the text (usually a filename)?
|
// Does the pattern match the text (usually a filename)?
|
||||||
// If dot_special is TRUE, doesn't match * against . (eliminating
|
// If dot_special is true, doesn't match * against . (eliminating
|
||||||
// `hidden' dot files)
|
// `hidden' dot files)
|
||||||
WXDLLIMPEXP_BASE bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = TRUE);
|
WXDLLIMPEXP_BASE bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = true);
|
||||||
|
|
||||||
// Concatenate two files to form third
|
// Concatenate two files to form third
|
||||||
WXDLLIMPEXP_BASE bool wxConcatFiles(const wxString& file1, const wxString& file2, const wxString& file3);
|
WXDLLIMPEXP_BASE bool wxConcatFiles(const wxString& file1, const wxString& file2, const wxString& file3);
|
||||||
|
|
||||||
// Copy file1 to file2
|
// Copy file1 to file2
|
||||||
WXDLLIMPEXP_BASE bool wxCopyFile(const wxString& file1, const wxString& file2,
|
WXDLLIMPEXP_BASE bool wxCopyFile(const wxString& file1, const wxString& file2,
|
||||||
bool overwrite = TRUE);
|
bool overwrite = true);
|
||||||
|
|
||||||
// Remove file
|
// Remove file
|
||||||
WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file);
|
WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file);
|
||||||
@@ -316,16 +316,16 @@ WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0);
|
|||||||
// this is useful for wxString::IsSameAs(): to compare two file names use
|
// this is useful for wxString::IsSameAs(): to compare two file names use
|
||||||
// filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE)
|
// filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE)
|
||||||
#if defined(__UNIX__) && !defined(__DARWIN__) && !defined(__OS2__)
|
#if defined(__UNIX__) && !defined(__DARWIN__) && !defined(__OS2__)
|
||||||
#define wxARE_FILENAMES_CASE_SENSITIVE TRUE
|
#define wxARE_FILENAMES_CASE_SENSITIVE true
|
||||||
#else // Windows, Mac OS and OS/2
|
#else // Windows, Mac OS and OS/2
|
||||||
#define wxARE_FILENAMES_CASE_SENSITIVE FALSE
|
#define wxARE_FILENAMES_CASE_SENSITIVE false
|
||||||
#endif // Unix/Windows
|
#endif // Unix/Windows
|
||||||
|
|
||||||
// is the char a path separator?
|
// is the char a path separator?
|
||||||
inline bool wxIsPathSeparator(wxChar c)
|
inline bool wxIsPathSeparator(wxChar c)
|
||||||
{
|
{
|
||||||
// under DOS/Windows we should understand both Unix and DOS file separators
|
// under DOS/Windows we should understand both Unix and DOS file separators
|
||||||
#if ( defined(__UNIX__) && !defined(__OS2__) )|| defined(__MAC__)
|
#if ( defined(__UNIX__) && !defined(__OS2__) )|| defined(__MAC__)
|
||||||
return c == wxFILE_SEP_PATH;
|
return c == wxFILE_SEP_PATH;
|
||||||
#else
|
#else
|
||||||
return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX;
|
return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX;
|
||||||
@@ -381,7 +381,7 @@ public:
|
|||||||
wxString FindAbsoluteValidPath(const wxString& filename);
|
wxString FindAbsoluteValidPath(const wxString& filename);
|
||||||
// Given full path and filename, add path to list
|
// Given full path and filename, add path to list
|
||||||
void EnsureFileAccessible(const wxString& path);
|
void EnsureFileAccessible(const wxString& path);
|
||||||
// Returns TRUE if the path is in the list
|
// Returns true if the path is in the list
|
||||||
bool Member(const wxString& path);
|
bool Member(const wxString& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -178,7 +178,7 @@ public:
|
|||||||
|
|
||||||
// is the filename valid at all?
|
// is the filename valid at all?
|
||||||
bool IsOk() const
|
bool IsOk() const
|
||||||
{
|
{
|
||||||
// we're fine if we have the path or the name or if we're a root dir
|
// we're fine if we have the path or the name or if we're a root dir
|
||||||
return m_dirs.size() != 0 || !m_name.IsEmpty() || !m_relative;
|
return m_dirs.size() != 0 || !m_name.IsEmpty() || !m_relative;
|
||||||
}
|
}
|
||||||
|
@@ -107,7 +107,7 @@ class WXDLLIMPEXP_BASE wxFileSystemHandler : public wxObject
|
|||||||
public:
|
public:
|
||||||
wxFileSystemHandler() : wxObject() {}
|
wxFileSystemHandler() : wxObject() {}
|
||||||
|
|
||||||
// returns TRUE if this handler is able to open given location
|
// returns true if this handler is able to open given location
|
||||||
virtual bool CanOpen(const wxString& location) = 0;
|
virtual bool CanOpen(const wxString& location) = 0;
|
||||||
|
|
||||||
// opens given file and returns pointer to input stream.
|
// opens given file and returns pointer to input stream.
|
||||||
@@ -165,10 +165,10 @@ public:
|
|||||||
// sets the current location. Every call to OpenFile is
|
// sets the current location. Every call to OpenFile is
|
||||||
// relative to this location.
|
// relative to this location.
|
||||||
// NOTE !!
|
// NOTE !!
|
||||||
// unless is_dir = TRUE 'location' is *not* the directory but
|
// unless is_dir = true 'location' is *not* the directory but
|
||||||
// file contained in this directory
|
// file contained in this directory
|
||||||
// (so ChangePathTo("dir/subdir/xh.htm") sets m_Path to "dir/subdir/")
|
// (so ChangePathTo("dir/subdir/xh.htm") sets m_Path to "dir/subdir/")
|
||||||
void ChangePathTo(const wxString& location, bool is_dir = FALSE);
|
void ChangePathTo(const wxString& location, bool is_dir = false);
|
||||||
|
|
||||||
wxString GetPath() const {return m_Path;}
|
wxString GetPath() const {return m_Path;}
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: wx/flags.h
|
// Name: wx/flags.h
|
||||||
// Purpose: a bitset suited for replacing the current style flags
|
// Purpose: a bitset suited for replacing the current style flags
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 27/07/03
|
// Created: 27/07/03
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2003 Stefan Csomor
|
// Copyright: (c) 2003 Stefan Csomor
|
||||||
@@ -20,16 +20,16 @@
|
|||||||
// bitwise operators but keeps the type safety and information, the
|
// bitwise operators but keeps the type safety and information, the
|
||||||
// enums must be in a sequence , their value determines the bit position
|
// enums must be in a sequence , their value determines the bit position
|
||||||
// that they represent
|
// that they represent
|
||||||
// The api is made as close as possible to <bitset>
|
// The api is made as close as possible to <bitset>
|
||||||
|
|
||||||
template <class T> class wxBitset
|
template <class T> class wxBitset
|
||||||
{
|
{
|
||||||
friend class wxEnumData ;
|
friend class wxEnumData ;
|
||||||
public:
|
public:
|
||||||
// creates a wxBitset<> object with all flags initialized to 0
|
// creates a wxBitset<> object with all flags initialized to 0
|
||||||
wxBitset() { m_data = 0; }
|
wxBitset() { m_data = 0; }
|
||||||
|
|
||||||
// created a wxBitset<> object initialized according to the bits of the
|
// created a wxBitset<> object initialized according to the bits of the
|
||||||
// integral value val
|
// integral value val
|
||||||
wxBitset(unsigned long val) { m_data = val ; }
|
wxBitset(unsigned long val) { m_data = val ; }
|
||||||
|
|
||||||
@@ -45,116 +45,116 @@ public:
|
|||||||
// assignment
|
// assignment
|
||||||
wxBitset &operator =(const wxBitset &rhs)
|
wxBitset &operator =(const wxBitset &rhs)
|
||||||
{
|
{
|
||||||
m_data = rhs.m_data;
|
m_data = rhs.m_data;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bitwise or operator, sets all bits that are in rhs and leaves
|
// bitwise or operator, sets all bits that are in rhs and leaves
|
||||||
// the rest unchanged
|
// the rest unchanged
|
||||||
wxBitset &operator |=(const wxBitset &rhs)
|
wxBitset &operator |=(const wxBitset &rhs)
|
||||||
{
|
{
|
||||||
m_data |= rhs.m_data;
|
m_data |= rhs.m_data;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bitwsie exclusive-or operator, toggles the value of all bits
|
// bitwsie exclusive-or operator, toggles the value of all bits
|
||||||
// that are set in bits and leaves all others unchanged
|
// that are set in bits and leaves all others unchanged
|
||||||
wxBitset &operator ^=(const wxBitset &rhs) // difference
|
wxBitset &operator ^=(const wxBitset &rhs) // difference
|
||||||
{
|
{
|
||||||
m_data ^= rhs.m_data;
|
m_data ^= rhs.m_data;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bitwise and operator, resets all bits that are not in rhs and leaves
|
// bitwise and operator, resets all bits that are not in rhs and leaves
|
||||||
// all others unchanged
|
// all others unchanged
|
||||||
wxBitset &operator &=(const wxBitset &rhs) // intersection
|
wxBitset &operator &=(const wxBitset &rhs) // intersection
|
||||||
{
|
{
|
||||||
m_data &= rhs.m_data;
|
m_data &= rhs.m_data;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bitwise or operator, returns a new bitset that has all bits set that set are in
|
// bitwise or operator, returns a new bitset that has all bits set that set are in
|
||||||
// bitset2 or in this bitset
|
// bitset2 or in this bitset
|
||||||
wxBitset operator |(const wxBitset &bitset2) const // union
|
wxBitset operator |(const wxBitset &bitset2) const // union
|
||||||
{
|
{
|
||||||
wxBitset<T> s;
|
wxBitset<T> s;
|
||||||
s.m_data = m_data | bitset2.m_data;
|
s.m_data = m_data | bitset2.m_data;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bitwise exclusive-or operator, returns a new bitset that has all bits set that are set either in
|
// bitwise exclusive-or operator, returns a new bitset that has all bits set that are set either in
|
||||||
// bitset2 or in this bitset but not in both
|
// bitset2 or in this bitset but not in both
|
||||||
wxBitset operator ^(const wxBitset &bitset2) const // difference
|
wxBitset operator ^(const wxBitset &bitset2) const // difference
|
||||||
{
|
{
|
||||||
wxBitset<T> s;
|
wxBitset<T> s;
|
||||||
s.m_data = m_data ^ bitset2.m_data;
|
s.m_data = m_data ^ bitset2.m_data;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bitwise and operator, returns a new bitset that has all bits set that are set both in
|
// bitwise and operator, returns a new bitset that has all bits set that are set both in
|
||||||
// bitset2 and in this bitset
|
// bitset2 and in this bitset
|
||||||
wxBitset operator &(const wxBitset &bitset2) const // intersection
|
wxBitset operator &(const wxBitset &bitset2) const // intersection
|
||||||
{
|
{
|
||||||
wxBitset<T> s;
|
wxBitset<T> s;
|
||||||
s.m_data = m_data & bitset2.m_data;
|
s.m_data = m_data & bitset2.m_data;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets appropriate the bit to true
|
// sets appropriate the bit to true
|
||||||
wxBitset& set(const T el) //Add element
|
wxBitset& set(const T el) //Add element
|
||||||
{
|
{
|
||||||
m_data |= 1 << el;
|
m_data |= 1 << el;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// clears the appropriate flag to false
|
// clears the appropriate flag to false
|
||||||
wxBitset& reset(const T el) //remove element
|
wxBitset& reset(const T el) //remove element
|
||||||
{
|
{
|
||||||
m_data &= ~(1 << el);
|
m_data &= ~(1 << el);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear all flags
|
// clear all flags
|
||||||
wxBitset& reset()
|
wxBitset& reset()
|
||||||
{
|
{
|
||||||
m_data = 0;
|
m_data = 0;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true if this flag is set
|
// true if this flag is set
|
||||||
bool test(const T el) const
|
bool test(const T el) const
|
||||||
{
|
{
|
||||||
return (m_data & (1 << el)) ? true : false;
|
return (m_data & (1 << el)) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true if no flag is set
|
// true if no flag is set
|
||||||
bool none() const
|
bool none() const
|
||||||
{
|
{
|
||||||
return m_data == 0;
|
return m_data == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true if any flag is set
|
// true if any flag is set
|
||||||
bool any() const
|
bool any() const
|
||||||
{
|
{
|
||||||
return m_data != 0;
|
return m_data != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true if both have the same flags
|
// true if both have the same flags
|
||||||
bool operator ==(const wxBitset &rhs) const
|
bool operator ==(const wxBitset &rhs) const
|
||||||
{
|
{
|
||||||
return m_data == rhs.m_data;
|
return m_data == rhs.m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// true if both differ in their flags set
|
// true if both differ in their flags set
|
||||||
bool operator !=(const wxBitset &rhs) const
|
bool operator !=(const wxBitset &rhs) const
|
||||||
{
|
{
|
||||||
return !operator==(rhs);
|
return !operator==(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator[] (const T el) const { return test(el) ; }
|
bool operator[] (const T el) const { return test(el) ; }
|
||||||
|
|
||||||
private :
|
private :
|
||||||
unsigned long m_data;
|
unsigned long m_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define WX_DEFINE_FLAGS( flags ) \
|
#define WX_DEFINE_FLAGS( flags ) \
|
||||||
|
@@ -123,7 +123,7 @@ public:
|
|||||||
int family, // see wxFontFamily enum
|
int family, // see wxFontFamily enum
|
||||||
int style, // see wxFontStyle enum
|
int style, // see wxFontStyle enum
|
||||||
int weight, // see wxFontWeight enum
|
int weight, // see wxFontWeight enum
|
||||||
bool underlined = FALSE, // not underlined by default
|
bool underlined = false, // not underlined by default
|
||||||
const wxString& face = wxEmptyString, // facename
|
const wxString& face = wxEmptyString, // facename
|
||||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ...
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ...
|
||||||
|
|
||||||
@@ -184,8 +184,8 @@ public:
|
|||||||
wxString GetWeightString() const;
|
wxString GetWeightString() const;
|
||||||
|
|
||||||
// Unofficial API, don't use
|
// Unofficial API, don't use
|
||||||
virtual void SetNoAntiAliasing( bool WXUNUSED(no) = TRUE ) { }
|
virtual void SetNoAntiAliasing( bool WXUNUSED(no) = true ) { }
|
||||||
virtual bool GetNoAntiAliasing() const { return FALSE; }
|
virtual bool GetNoAntiAliasing() const { return false; }
|
||||||
|
|
||||||
// the default encoding is used for creating all fonts with default
|
// the default encoding is used for creating all fonts with default
|
||||||
// encoding parameter
|
// encoding parameter
|
||||||
|
@@ -51,7 +51,7 @@ public:
|
|||||||
{ InitFontData(data); return Create(parent); }
|
{ InitFontData(data); return Create(parent); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return TRUE; }
|
virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; }
|
||||||
|
|
||||||
void InitFontData(const wxFontData *data = NULL)
|
void InitFontData(const wxFontData *data = NULL)
|
||||||
{ if ( data ) m_fontData = *data; }
|
{ if ( data ) m_fontData = *data; }
|
||||||
|
@@ -76,51 +76,51 @@ enum wxFontEncoding
|
|||||||
wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding
|
wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding
|
||||||
|
|
||||||
wxFONTENCODING_MACROMAN, // the standard mac encodings
|
wxFONTENCODING_MACROMAN, // the standard mac encodings
|
||||||
wxFONTENCODING_MACJAPANESE,
|
wxFONTENCODING_MACJAPANESE,
|
||||||
wxFONTENCODING_MACCHINESETRAD,
|
wxFONTENCODING_MACCHINESETRAD,
|
||||||
wxFONTENCODING_MACKOREAN,
|
wxFONTENCODING_MACKOREAN,
|
||||||
wxFONTENCODING_MACARABIC,
|
wxFONTENCODING_MACARABIC,
|
||||||
wxFONTENCODING_MACHEBREW,
|
wxFONTENCODING_MACHEBREW,
|
||||||
wxFONTENCODING_MACGREEK,
|
wxFONTENCODING_MACGREEK,
|
||||||
wxFONTENCODING_MACCYRILLIC,
|
wxFONTENCODING_MACCYRILLIC,
|
||||||
wxFONTENCODING_MACDEVANAGARI,
|
wxFONTENCODING_MACDEVANAGARI,
|
||||||
wxFONTENCODING_MACGURMUKHI,
|
wxFONTENCODING_MACGURMUKHI,
|
||||||
wxFONTENCODING_MACGUJARATI,
|
wxFONTENCODING_MACGUJARATI,
|
||||||
wxFONTENCODING_MACORIYA,
|
wxFONTENCODING_MACORIYA,
|
||||||
wxFONTENCODING_MACBENGALI,
|
wxFONTENCODING_MACBENGALI,
|
||||||
wxFONTENCODING_MACTAMIL,
|
wxFONTENCODING_MACTAMIL,
|
||||||
wxFONTENCODING_MACTELUGU,
|
wxFONTENCODING_MACTELUGU,
|
||||||
wxFONTENCODING_MACKANNADA,
|
wxFONTENCODING_MACKANNADA,
|
||||||
wxFONTENCODING_MACMALAJALAM,
|
wxFONTENCODING_MACMALAJALAM,
|
||||||
wxFONTENCODING_MACSINHALESE,
|
wxFONTENCODING_MACSINHALESE,
|
||||||
wxFONTENCODING_MACBURMESE,
|
wxFONTENCODING_MACBURMESE,
|
||||||
wxFONTENCODING_MACKHMER,
|
wxFONTENCODING_MACKHMER,
|
||||||
wxFONTENCODING_MACTHAI,
|
wxFONTENCODING_MACTHAI,
|
||||||
wxFONTENCODING_MACLAOTIAN,
|
wxFONTENCODING_MACLAOTIAN,
|
||||||
wxFONTENCODING_MACGEORGIAN,
|
wxFONTENCODING_MACGEORGIAN,
|
||||||
wxFONTENCODING_MACARMENIAN,
|
wxFONTENCODING_MACARMENIAN,
|
||||||
wxFONTENCODING_MACCHINESESIMP,
|
wxFONTENCODING_MACCHINESESIMP,
|
||||||
wxFONTENCODING_MACTIBETAN,
|
wxFONTENCODING_MACTIBETAN,
|
||||||
wxFONTENCODING_MACMONGOLIAN,
|
wxFONTENCODING_MACMONGOLIAN,
|
||||||
wxFONTENCODING_MACETHIOPIC,
|
wxFONTENCODING_MACETHIOPIC,
|
||||||
wxFONTENCODING_MACCENTRALEUR,
|
wxFONTENCODING_MACCENTRALEUR,
|
||||||
wxFONTENCODING_MACVIATNAMESE,
|
wxFONTENCODING_MACVIATNAMESE,
|
||||||
wxFONTENCODING_MACARABICEXT,
|
wxFONTENCODING_MACARABICEXT,
|
||||||
wxFONTENCODING_MACSYMBOL,
|
wxFONTENCODING_MACSYMBOL,
|
||||||
wxFONTENCODING_MACDINGBATS,
|
wxFONTENCODING_MACDINGBATS,
|
||||||
wxFONTENCODING_MACTURKISH,
|
wxFONTENCODING_MACTURKISH,
|
||||||
wxFONTENCODING_MACCROATIAN,
|
wxFONTENCODING_MACCROATIAN,
|
||||||
wxFONTENCODING_MACICELANDIC,
|
wxFONTENCODING_MACICELANDIC,
|
||||||
wxFONTENCODING_MACROMANIAN,
|
wxFONTENCODING_MACROMANIAN,
|
||||||
wxFONTENCODING_MACCELTIC,
|
wxFONTENCODING_MACCELTIC,
|
||||||
wxFONTENCODING_MACGAELIC,
|
wxFONTENCODING_MACGAELIC,
|
||||||
wxFONTENCODING_MACKEYBOARD,
|
wxFONTENCODING_MACKEYBOARD,
|
||||||
|
|
||||||
wxFONTENCODING_MAX, // highest enumerated encoding value
|
wxFONTENCODING_MAX, // highest enumerated encoding value
|
||||||
|
|
||||||
wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN ,
|
wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN ,
|
||||||
wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD ,
|
wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD ,
|
||||||
|
|
||||||
// aliases for endian-dependent UTF encodings
|
// aliases for endian-dependent UTF encodings
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16BE, // native UTF-16
|
wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16BE, // native UTF-16
|
||||||
|
@@ -92,7 +92,7 @@ private:
|
|||||||
inline bool HasElements() const;
|
inline bool HasElements() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// init the elements from an XLFD, return TRUE if ok
|
// init the elements from an XLFD, return true if ok
|
||||||
bool FromXFontName(const wxString& xFontName);
|
bool FromXFontName(const wxString& xFontName);
|
||||||
|
|
||||||
// return false if we were never initialized with a valid XLFD
|
// return false if we were never initialized with a valid XLFD
|
||||||
@@ -211,13 +211,13 @@ public:
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// translate a wxFontEncoding into native encoding parameter (defined above),
|
// translate a wxFontEncoding into native encoding parameter (defined above),
|
||||||
// returning TRUE if an (exact) macth could be found, FALSE otherwise (without
|
// returning true if an (exact) macth could be found, false otherwise (without
|
||||||
// attempting any substitutions)
|
// attempting any substitutions)
|
||||||
extern bool wxGetNativeFontEncoding(wxFontEncoding encoding,
|
extern bool wxGetNativeFontEncoding(wxFontEncoding encoding,
|
||||||
wxNativeEncodingInfo *info);
|
wxNativeEncodingInfo *info);
|
||||||
|
|
||||||
// test for the existence of the font described by this facename/encoding,
|
// test for the existence of the font described by this facename/encoding,
|
||||||
// return TRUE if such font(s) exist, FALSE otherwise
|
// return true if such font(s) exist, false otherwise
|
||||||
extern bool wxTestFontEncoding(const wxNativeEncodingInfo& info);
|
extern bool wxTestFontEncoding(const wxNativeEncodingInfo& info);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -91,7 +91,7 @@ public:
|
|||||||
virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; }
|
virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; }
|
||||||
#endif // wxUSE_MENUS
|
#endif // wxUSE_MENUS
|
||||||
|
|
||||||
// process menu command: returns TRUE if processed
|
// process menu command: returns true if processed
|
||||||
bool ProcessCommand(int winid);
|
bool ProcessCommand(int winid);
|
||||||
|
|
||||||
// status bar functions
|
// status bar functions
|
||||||
@@ -132,7 +132,7 @@ public:
|
|||||||
#if wxUSE_TOOLBAR
|
#if wxUSE_TOOLBAR
|
||||||
// create main toolbar bycalling OnCreateToolBar()
|
// create main toolbar bycalling OnCreateToolBar()
|
||||||
virtual wxToolBar* CreateToolBar(long style = -1,
|
virtual wxToolBar* CreateToolBar(long style = -1,
|
||||||
wxWindowID winid = -1,
|
wxWindowID winid = wxID_ANY,
|
||||||
const wxString& name = wxToolBarNameStr);
|
const wxString& name = wxToolBarNameStr);
|
||||||
// return a new toolbar
|
// return a new toolbar
|
||||||
virtual wxToolBar *OnCreateToolBar(long style,
|
virtual wxToolBar *OnCreateToolBar(long style,
|
||||||
@@ -172,13 +172,13 @@ public:
|
|||||||
#ifndef wxTopLevelWindowNative
|
#ifndef wxTopLevelWindowNative
|
||||||
virtual bool ShowFullScreen(bool WXUNUSED(show),
|
virtual bool ShowFullScreen(bool WXUNUSED(show),
|
||||||
long WXUNUSED(style) = wxFULLSCREEN_ALL)
|
long WXUNUSED(style) = wxFULLSCREEN_ALL)
|
||||||
{ return FALSE; }
|
{ return false; }
|
||||||
virtual bool IsFullScreen() const
|
virtual bool IsFullScreen() const
|
||||||
{ return FALSE; }
|
{ return false; }
|
||||||
#endif // no wxTopLevelWindowNative
|
#endif // no wxTopLevelWindowNative
|
||||||
|
|
||||||
// show help text (typically in the statusbar); show is FALSE
|
// show help text (typically in the statusbar); show is false
|
||||||
// if you are hiding the help, TRUE otherwise
|
// if you are hiding the help, true otherwise
|
||||||
virtual void DoGiveHelp(const wxString& text, bool show);
|
virtual void DoGiveHelp(const wxString& text, bool show);
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY_2_2
|
#if WXWIN_COMPATIBILITY_2_2
|
||||||
@@ -223,7 +223,7 @@ protected:
|
|||||||
virtual void PositionStatusBar() { }
|
virtual void PositionStatusBar() { }
|
||||||
|
|
||||||
// show the help string for this menu item in the given status bar: the
|
// show the help string for this menu item in the given status bar: the
|
||||||
// status bar pointer can be NULL; return TRUE if help was shown
|
// status bar pointer can be NULL; return true if help was shown
|
||||||
bool ShowMenuHelp(wxStatusBar *statbar, int helpid);
|
bool ShowMenuHelp(wxStatusBar *statbar, int helpid);
|
||||||
|
|
||||||
wxStatusBar *m_frameStatusBar;
|
wxStatusBar *m_frameStatusBar;
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__)
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__)
|
||||||
// Some older compilers (such as EMX) cannot handle
|
// Some older compilers (such as EMX) cannot handle
|
||||||
// #pragma interface/implementation correctly, iff
|
// #pragma interface/implementation correctly, iff
|
||||||
// #pragma implementation is used in _two_ translation
|
// #pragma implementation is used in _two_ translation
|
||||||
// units (as created by e.g. event.cpp compiled for
|
// units (as created by e.g. event.cpp compiled for
|
||||||
// libwx_base and event.cpp compiled for libwx_gui_core).
|
// libwx_base and event.cpp compiled for libwx_gui_core).
|
||||||
|
@@ -74,8 +74,8 @@ void wxFindReplaceDialogBase::Send(wxFindDialogEvent& event)
|
|||||||
|
|
||||||
m_FindReplaceData->m_Flags = event.GetFlags();
|
m_FindReplaceData->m_Flags = event.GetFlags();
|
||||||
m_FindReplaceData->m_FindWhat = event.GetFindString();
|
m_FindReplaceData->m_FindWhat = event.GetFindString();
|
||||||
if ( HasFlag(wxFR_REPLACEDIALOG) &&
|
if ( HasFlag(wxFR_REPLACEDIALOG) &&
|
||||||
(event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE ||
|
(event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE ||
|
||||||
event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL) )
|
event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL) )
|
||||||
{
|
{
|
||||||
m_FindReplaceData->m_ReplaceWith = event.GetReplaceString();
|
m_FindReplaceData->m_ReplaceWith = event.GetReplaceString();
|
||||||
|
@@ -62,12 +62,12 @@ bool wxFFile::Open(const wxChar *filename, const wxChar *mode)
|
|||||||
{
|
{
|
||||||
wxLogSysError(_("can't open file '%s'"), filename);
|
wxLogSysError(_("can't open file '%s'"), filename);
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_name = filename;
|
m_name = filename;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFFile::Close()
|
bool wxFFile::Close()
|
||||||
@@ -78,13 +78,13 @@ bool wxFFile::Close()
|
|||||||
{
|
{
|
||||||
wxLogSysError(_("can't close file '%s'"), m_name.c_str());
|
wxLogSysError(_("can't close file '%s'"), m_name.c_str());
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Detach();
|
Detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -93,8 +93,8 @@ bool wxFFile::Close()
|
|||||||
|
|
||||||
bool wxFFile::ReadAll(wxString *str)
|
bool wxFFile::ReadAll(wxString *str)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( str, FALSE, wxT("invalid parameter") );
|
wxCHECK_MSG( str, false, wxT("invalid parameter") );
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, wxT("can't read from closed file") );
|
wxCHECK_MSG( IsOpened(), false, wxT("can't read from closed file") );
|
||||||
|
|
||||||
clearerr(m_fp);
|
clearerr(m_fp);
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ bool wxFFile::ReadAll(wxString *str)
|
|||||||
{
|
{
|
||||||
wxLogSysError(_("Read error on file '%s'"), m_name.c_str());
|
wxLogSysError(_("Read error on file '%s'"), m_name.c_str());
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
//else: just EOF
|
//else: just EOF
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ bool wxFFile::ReadAll(wxString *str)
|
|||||||
*str += buf;
|
*str += buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wxFFile::Read(void *pBuf, size_t nCount)
|
size_t wxFFile::Read(void *pBuf, size_t nCount)
|
||||||
@@ -159,11 +159,11 @@ bool wxFFile::Flush()
|
|||||||
{
|
{
|
||||||
wxLogSysError(_("failed to flush the file '%s'"), m_name.c_str());
|
wxLogSysError(_("failed to flush the file '%s'"), m_name.c_str());
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -172,7 +172,7 @@ bool wxFFile::Flush()
|
|||||||
|
|
||||||
bool wxFFile::Seek(long ofs, wxSeekMode mode)
|
bool wxFFile::Seek(long ofs, wxSeekMode mode)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOpened(), FALSE, wxT("can't seek on closed file") );
|
wxCHECK_MSG( IsOpened(), false, wxT("can't seek on closed file") );
|
||||||
|
|
||||||
int origin;
|
int origin;
|
||||||
switch ( mode )
|
switch ( mode )
|
||||||
@@ -198,10 +198,10 @@ bool wxFFile::Seek(long ofs, wxSeekMode mode)
|
|||||||
{
|
{
|
||||||
wxLogSysError(_("Seek error on file '%s'"), m_name.c_str());
|
wxLogSysError(_("Seek error on file '%s'"), m_name.c_str());
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wxFFile::Tell() const
|
size_t wxFFile::Tell() const
|
||||||
|
@@ -202,7 +202,7 @@ bool wxFile::Access(const wxChar *name, OpenMode mode)
|
|||||||
|
|
||||||
#ifdef __WXWINCE__
|
#ifdef __WXWINCE__
|
||||||
// FIXME: use CreateFile with 0 access to query the file
|
// FIXME: use CreateFile with 0 access to query the file
|
||||||
return TRUE;
|
return true;
|
||||||
#else
|
#else
|
||||||
return wxAccess(name, how) == 0;
|
return wxAccess(name, how) == 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -216,7 +216,7 @@ bool wxFile::Access(const wxChar *name, OpenMode mode)
|
|||||||
wxFile::wxFile(const wxChar *szFileName, OpenMode mode)
|
wxFile::wxFile(const wxChar *szFileName, OpenMode mode)
|
||||||
{
|
{
|
||||||
m_fd = fd_invalid;
|
m_fd = fd_invalid;
|
||||||
m_error = FALSE;
|
m_error = false;
|
||||||
|
|
||||||
Open(szFileName, mode);
|
Open(szFileName, mode);
|
||||||
}
|
}
|
||||||
@@ -250,12 +250,12 @@ bool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode)
|
|||||||
if ( fd == -1 )
|
if ( fd == -1 )
|
||||||
{
|
{
|
||||||
wxLogSysError(_("can't create file '%s'"), szFileName);
|
wxLogSysError(_("can't create file '%s'"), szFileName);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Attach(fd);
|
Attach(fd);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,11 +357,11 @@ bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode)
|
|||||||
if ( fd == -1 )
|
if ( fd == -1 )
|
||||||
{
|
{
|
||||||
wxLogSysError(_("can't open file '%s'"), szFileName);
|
wxLogSysError(_("can't open file '%s'"), szFileName);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Attach(fd);
|
Attach(fd);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,13 +377,13 @@ bool wxFile::Close()
|
|||||||
{
|
{
|
||||||
wxLogSysError(_("can't close file descriptor %d"), m_fd);
|
wxLogSysError(_("can't close file descriptor %d"), m_fd);
|
||||||
m_fd = fd_invalid;
|
m_fd = fd_invalid;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_fd = fd_invalid;
|
m_fd = fd_invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -438,7 +438,7 @@ size_t wxFile::Write(const void *pBuf, size_t nCount)
|
|||||||
#endif
|
#endif
|
||||||
if ( iRc == -1 ) {
|
if ( iRc == -1 ) {
|
||||||
wxLogSysError(_("can't write to file descriptor %d"), m_fd);
|
wxLogSysError(_("can't write to file descriptor %d"), m_fd);
|
||||||
m_error = TRUE;
|
m_error = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -455,14 +455,14 @@ bool wxFile::Flush()
|
|||||||
if ( wxFsync(m_fd) == -1 )
|
if ( wxFsync(m_fd) == -1 )
|
||||||
{
|
{
|
||||||
wxLogSysError(_("can't flush file descriptor %d"), m_fd);
|
wxLogSysError(_("can't flush file descriptor %d"), m_fd);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
#else // no fsync
|
#else // no fsync
|
||||||
// just do nothing
|
// just do nothing
|
||||||
#endif // fsync
|
#endif // fsync
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -606,11 +606,11 @@ bool wxFile::Eof() const
|
|||||||
DWORD off0 = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_CURRENT);
|
DWORD off0 = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_CURRENT);
|
||||||
DWORD off1 = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_END);
|
DWORD off1 = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_END);
|
||||||
if (off0 == off1)
|
if (off0 == off1)
|
||||||
return TRUE;
|
return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetFilePointer((HANDLE) m_fd, off0, 0, FILE_BEGIN);
|
SetFilePointer((HANDLE) m_fd, off0, 0, FILE_BEGIN);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
int iRc;
|
int iRc;
|
||||||
@@ -632,7 +632,7 @@ bool wxFile::Eof() const
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
wxLogSysError(_("can't determine if the end of file is reached on descriptor %d"), m_fd);
|
wxLogSysError(_("can't determine if the end of file is reached on descriptor %d"), m_fd);
|
||||||
@@ -642,7 +642,7 @@ bool wxFile::Eof() const
|
|||||||
wxFAIL_MSG(_("invalid eof() return value."));
|
wxFAIL_MSG(_("invalid eof() return value."));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,13 +681,13 @@ bool wxTempFile::Open(const wxString& strName)
|
|||||||
if ( m_strTemp.empty() )
|
if ( m_strTemp.empty() )
|
||||||
{
|
{
|
||||||
// CreateTempFileName() failed
|
// CreateTempFileName() failed
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __UNIX__
|
#ifdef __UNIX__
|
||||||
// the temp file should have the same permissions as the original one
|
// the temp file should have the same permissions as the original one
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
|
|
||||||
wxStructStat st;
|
wxStructStat st;
|
||||||
if ( stat( (const char*) m_strName.fn_str(), &st) == 0 )
|
if ( stat( (const char*) m_strName.fn_str(), &st) == 0 )
|
||||||
{
|
{
|
||||||
@@ -710,7 +710,7 @@ bool wxTempFile::Open(const wxString& strName)
|
|||||||
}
|
}
|
||||||
#endif // Unix
|
#endif // Unix
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -729,15 +729,15 @@ bool wxTempFile::Commit()
|
|||||||
|
|
||||||
if ( wxFile::Exists(m_strName) && wxRemove(m_strName) != 0 ) {
|
if ( wxFile::Exists(m_strName) && wxRemove(m_strName) != 0 ) {
|
||||||
wxLogSysError(_("can't remove file '%s'"), m_strName.c_str());
|
wxLogSysError(_("can't remove file '%s'"), m_strName.c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !wxRenameFile(m_strTemp, m_strName) ) {
|
if ( !wxRenameFile(m_strTemp, m_strName) ) {
|
||||||
wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str());
|
wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTempFile::Discard()
|
void wxTempFile::Discard()
|
||||||
|
@@ -185,7 +185,7 @@ public:
|
|||||||
GetLine() const { return m_pLine; }
|
GetLine() const { return m_pLine; }
|
||||||
|
|
||||||
// modify entry attributes
|
// modify entry attributes
|
||||||
void SetValue(const wxString& strValue, bool bUser = TRUE);
|
void SetValue(const wxString& strValue, bool bUser = true);
|
||||||
void SetDirty();
|
void SetDirty();
|
||||||
void SetLine(wxFileConfigLineList *pLine);
|
void SetLine(wxFileConfigLineList *pLine);
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ private:
|
|||||||
ArrayEntries m_aEntries; // entries in this group
|
ArrayEntries m_aEntries; // entries in this group
|
||||||
ArrayGroups m_aSubgroups; // subgroups
|
ArrayGroups m_aSubgroups; // subgroups
|
||||||
wxString m_strName; // group's name
|
wxString m_strName; // group's name
|
||||||
bool m_bDirty; // if FALSE => all subgroups are not dirty
|
bool m_bDirty; // if false => all subgroups are not dirty
|
||||||
wxFileConfigLineList *m_pLine; // pointer to our line in the linked list
|
wxFileConfigLineList *m_pLine; // pointer to our line in the linked list
|
||||||
wxFileConfigEntry *m_pLastEntry; // last entry/subgroup of this group in the
|
wxFileConfigEntry *m_pLastEntry; // last entry/subgroup of this group in the
|
||||||
wxFileConfigGroup *m_pLastGroup; // local file (we insert new ones after it)
|
wxFileConfigGroup *m_pLastGroup; // local file (we insert new ones after it)
|
||||||
@@ -233,7 +233,7 @@ public:
|
|||||||
wxFileConfigGroup *FindSubgroup(const wxChar *szName) const;
|
wxFileConfigGroup *FindSubgroup(const wxChar *szName) const;
|
||||||
wxFileConfigEntry *FindEntry (const wxChar *szName) const;
|
wxFileConfigEntry *FindEntry (const wxChar *szName) const;
|
||||||
|
|
||||||
// delete entry/subgroup, return FALSE if doesn't exist
|
// delete entry/subgroup, return false if doesn't exist
|
||||||
bool DeleteSubgroupByName(const wxChar *szName);
|
bool DeleteSubgroupByName(const wxChar *szName);
|
||||||
bool DeleteEntry(const wxChar *szName);
|
bool DeleteEntry(const wxChar *szName);
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ wxString wxFileConfig::GetGlobalDir()
|
|||||||
strDir.Printf(wxT("%c:\\OS2\\"), 'A'+drive-1);
|
strDir.Printf(wxT("%c:\\OS2\\"), 'A'+drive-1);
|
||||||
}
|
}
|
||||||
#elif defined(__WXSTUBS__)
|
#elif defined(__WXSTUBS__)
|
||||||
wxASSERT_MSG( FALSE, wxT("TODO") ) ;
|
wxASSERT_MSG( false, wxT("TODO") ) ;
|
||||||
#elif defined(__DOS__)
|
#elif defined(__DOS__)
|
||||||
// There's no such thing as global cfg dir in MS-DOS, let's return
|
// There's no such thing as global cfg dir in MS-DOS, let's return
|
||||||
// current directory (FIXME_MGL?)
|
// current directory (FIXME_MGL?)
|
||||||
@@ -399,7 +399,7 @@ void wxFileConfig::Init()
|
|||||||
|
|
||||||
if ( fileGlobal.Open(m_conv/*ignored in ANSI build*/) )
|
if ( fileGlobal.Open(m_conv/*ignored in ANSI build*/) )
|
||||||
{
|
{
|
||||||
Parse(fileGlobal, FALSE /* global */);
|
Parse(fileGlobal, false /* global */);
|
||||||
SetRootPath();
|
SetRootPath();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -414,7 +414,7 @@ void wxFileConfig::Init()
|
|||||||
wxTextFile fileLocal(m_strLocalFile);
|
wxTextFile fileLocal(m_strLocalFile);
|
||||||
if ( fileLocal.Open(m_conv/*ignored in ANSI build*/) )
|
if ( fileLocal.Open(m_conv/*ignored in ANSI build*/) )
|
||||||
{
|
{
|
||||||
Parse(fileLocal, TRUE /* local */);
|
Parse(fileLocal, true /* local */);
|
||||||
SetRootPath();
|
SetRootPath();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -540,7 +540,7 @@ wxFileConfig::wxFileConfig(wxInputStream &inStream, wxMBConv& conv)
|
|||||||
memText.AddLine(strTrans);
|
memText.AddLine(strTrans);
|
||||||
|
|
||||||
// Finally we can parse it all.
|
// Finally we can parse it all.
|
||||||
Parse(memText, TRUE /* local */);
|
Parse(memText, true /* local */);
|
||||||
|
|
||||||
SetRootPath();
|
SetRootPath();
|
||||||
}
|
}
|
||||||
@@ -641,12 +641,12 @@ void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check that there is nothing except comments left on this line
|
// check that there is nothing except comments left on this line
|
||||||
bool bCont = TRUE;
|
bool bCont = true;
|
||||||
while ( *++pEnd != wxT('\0') && bCont ) {
|
while ( *++pEnd != wxT('\0') && bCont ) {
|
||||||
switch ( *pEnd ) {
|
switch ( *pEnd ) {
|
||||||
case wxT('#'):
|
case wxT('#'):
|
||||||
case wxT(';'):
|
case wxT(';'):
|
||||||
bCont = FALSE;
|
bCont = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxT(' '):
|
case wxT(' '):
|
||||||
@@ -657,7 +657,7 @@ void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal)
|
|||||||
default:
|
default:
|
||||||
wxLogWarning(_("file '%s', line %d: '%s' ignored after group header."),
|
wxLogWarning(_("file '%s', line %d: '%s' ignored after group header."),
|
||||||
buffer.GetName(), n + 1, pEnd);
|
buffer.GetName(), n + 1, pEnd);
|
||||||
bCont = FALSE;
|
bCont = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -724,7 +724,7 @@ void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal)
|
|||||||
if ( !(GetStyle() & wxCONFIG_USE_NO_ESCAPE_CHARACTERS) )
|
if ( !(GetStyle() & wxCONFIG_USE_NO_ESCAPE_CHARACTERS) )
|
||||||
value = FilterInValue(value);
|
value = FilterInValue(value);
|
||||||
|
|
||||||
pEntry->SetValue(value, FALSE);
|
pEntry->SetValue(value, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -791,10 +791,10 @@ bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const
|
|||||||
{
|
{
|
||||||
if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) {
|
if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) {
|
||||||
str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name();
|
str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name();
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const
|
bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const
|
||||||
@@ -807,10 +807,10 @@ bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const
|
|||||||
{
|
{
|
||||||
if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) {
|
if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) {
|
||||||
str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name();
|
str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name();
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wxFileConfig::GetNumberOfEntries(bool bRecursive) const
|
size_t wxFileConfig::GetNumberOfEntries(bool bRecursive) const
|
||||||
@@ -821,7 +821,7 @@ size_t wxFileConfig::GetNumberOfEntries(bool bRecursive) const
|
|||||||
size_t nSubgroups = m_pCurrentGroup->Groups().Count();
|
size_t nSubgroups = m_pCurrentGroup->Groups().Count();
|
||||||
for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
|
for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
|
||||||
CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
|
CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
|
||||||
n += GetNumberOfEntries(TRUE);
|
n += GetNumberOfEntries(true);
|
||||||
CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
|
CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -837,7 +837,7 @@ size_t wxFileConfig::GetNumberOfGroups(bool bRecursive) const
|
|||||||
size_t nSubgroups = m_pCurrentGroup->Groups().Count();
|
size_t nSubgroups = m_pCurrentGroup->Groups().Count();
|
||||||
for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
|
for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
|
||||||
CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
|
CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
|
||||||
n += GetNumberOfGroups(TRUE);
|
n += GetNumberOfGroups(true);
|
||||||
CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
|
CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -875,19 +875,19 @@ bool wxFileConfig::DoReadString(const wxString& key, wxString* pStr) const
|
|||||||
|
|
||||||
wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name());
|
wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name());
|
||||||
if (pEntry == NULL) {
|
if (pEntry == NULL) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pStr = pEntry->Value();
|
*pStr = pEntry->Value();
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const
|
bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const
|
||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
if ( !Read(key, &str) )
|
if ( !Read(key, &str) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// extra spaces shouldn't prevent us from reading numeric values
|
// extra spaces shouldn't prevent us from reading numeric values
|
||||||
str.Trim();
|
str.Trim();
|
||||||
@@ -933,7 +933,7 @@ bool wxFileConfig::DoWriteString(const wxString& key, const wxString& szValue)
|
|||||||
{
|
{
|
||||||
wxLogError( _("Config entry name cannot start with '%c'."),
|
wxLogError( _("Config entry name cannot start with '%c'."),
|
||||||
wxCONFIG_IMMUTABLE_PREFIX);
|
wxCONFIG_IMMUTABLE_PREFIX);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(strName);
|
wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(strName);
|
||||||
@@ -952,7 +952,7 @@ bool wxFileConfig::DoWriteString(const wxString& key, const wxString& szValue)
|
|||||||
pEntry->SetValue(szValue);
|
pEntry->SetValue(szValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileConfig::DoWriteLong(const wxString& key, long lValue)
|
bool wxFileConfig::DoWriteLong(const wxString& key, long lValue)
|
||||||
@@ -963,7 +963,7 @@ bool wxFileConfig::DoWriteLong(const wxString& key, long lValue)
|
|||||||
bool wxFileConfig::Flush(bool /* bCurrentOnly */)
|
bool wxFileConfig::Flush(bool /* bCurrentOnly */)
|
||||||
{
|
{
|
||||||
if ( LineListIsEmpty() || !m_pRootGroup->IsDirty() || !m_strLocalFile )
|
if ( LineListIsEmpty() || !m_pRootGroup->IsDirty() || !m_strLocalFile )
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
#ifdef __UNIX__
|
#ifdef __UNIX__
|
||||||
// set the umask if needed
|
// set the umask if needed
|
||||||
@@ -979,7 +979,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
|
|||||||
if ( !file.IsOpened() )
|
if ( !file.IsOpened() )
|
||||||
{
|
{
|
||||||
wxLogError(_("can't open user configuration file."));
|
wxLogError(_("can't open user configuration file."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write all strings to file
|
// write all strings to file
|
||||||
@@ -990,7 +990,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
|
|||||||
if ( !file.Write(line, m_conv) )
|
if ( !file.Write(line, m_conv) )
|
||||||
{
|
{
|
||||||
wxLogError(_("can't write user configuration file."));
|
wxLogError(_("can't write user configuration file."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1001,18 +1001,18 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
|
|||||||
{
|
{
|
||||||
FSRef fsRef ;
|
FSRef fsRef ;
|
||||||
FSCatalogInfo catInfo;
|
FSCatalogInfo catInfo;
|
||||||
FileInfo *finfo ;
|
FileInfo *finfo ;
|
||||||
|
|
||||||
if ( wxMacPathToFSRef( m_strLocalFile , &fsRef ) == noErr )
|
if ( wxMacPathToFSRef( m_strLocalFile , &fsRef ) == noErr )
|
||||||
{
|
{
|
||||||
if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
|
if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
|
||||||
{
|
{
|
||||||
finfo = (FileInfo*)&catInfo.finderInfo;
|
finfo = (FileInfo*)&catInfo.finderInfo;
|
||||||
finfo->fileType = 'TEXT' ;
|
finfo->fileType = 'TEXT' ;
|
||||||
finfo->fileCreator = 'ttxt' ;
|
finfo->fileCreator = 'ttxt' ;
|
||||||
FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ;
|
FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // __WXMAC__
|
#endif // __WXMAC__
|
||||||
|
|
||||||
@@ -1037,21 +1037,21 @@ bool wxFileConfig::RenameEntry(const wxString& oldName,
|
|||||||
// check that the entry exists
|
// check that the entry exists
|
||||||
wxFileConfigEntry *oldEntry = m_pCurrentGroup->FindEntry(oldName);
|
wxFileConfigEntry *oldEntry = m_pCurrentGroup->FindEntry(oldName);
|
||||||
if ( !oldEntry )
|
if ( !oldEntry )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// check that the new entry doesn't already exist
|
// check that the new entry doesn't already exist
|
||||||
if ( m_pCurrentGroup->FindEntry(newName) )
|
if ( m_pCurrentGroup->FindEntry(newName) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// delete the old entry, create the new one
|
// delete the old entry, create the new one
|
||||||
wxString value = oldEntry->Value();
|
wxString value = oldEntry->Value();
|
||||||
if ( !m_pCurrentGroup->DeleteEntry(oldName) )
|
if ( !m_pCurrentGroup->DeleteEntry(oldName) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
wxFileConfigEntry *newEntry = m_pCurrentGroup->AddEntry(newName);
|
wxFileConfigEntry *newEntry = m_pCurrentGroup->AddEntry(newName);
|
||||||
newEntry->SetValue(value);
|
newEntry->SetValue(value);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileConfig::RenameGroup(const wxString& oldName,
|
bool wxFileConfig::RenameGroup(const wxString& oldName,
|
||||||
@@ -1060,15 +1060,15 @@ bool wxFileConfig::RenameGroup(const wxString& oldName,
|
|||||||
// check that the group exists
|
// check that the group exists
|
||||||
wxFileConfigGroup *group = m_pCurrentGroup->FindSubgroup(oldName);
|
wxFileConfigGroup *group = m_pCurrentGroup->FindSubgroup(oldName);
|
||||||
if ( !group )
|
if ( !group )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// check that the new group doesn't already exist
|
// check that the new group doesn't already exist
|
||||||
if ( m_pCurrentGroup->FindSubgroup(newName) )
|
if ( m_pCurrentGroup->FindSubgroup(newName) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
group->Rename(newName);
|
group->Rename(newName);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1080,7 +1080,7 @@ bool wxFileConfig::DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso)
|
|||||||
wxConfigPathChanger path(this, key);
|
wxConfigPathChanger path(this, key);
|
||||||
|
|
||||||
if ( !m_pCurrentGroup->DeleteEntry(path.Name()) )
|
if ( !m_pCurrentGroup->DeleteEntry(path.Name()) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
if ( bGroupIfEmptyAlso && m_pCurrentGroup->IsEmpty() ) {
|
if ( bGroupIfEmptyAlso && m_pCurrentGroup->IsEmpty() ) {
|
||||||
if ( m_pCurrentGroup != m_pRootGroup ) {
|
if ( m_pCurrentGroup != m_pRootGroup ) {
|
||||||
@@ -1091,7 +1091,7 @@ bool wxFileConfig::DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso)
|
|||||||
//else: never delete the root group
|
//else: never delete the root group
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileConfig::DeleteGroup(const wxString& key)
|
bool wxFileConfig::DeleteGroup(const wxString& key)
|
||||||
@@ -1108,13 +1108,13 @@ bool wxFileConfig::DeleteAll()
|
|||||||
if ( wxFile::Exists(m_strLocalFile) && wxRemove(m_strLocalFile) == -1 )
|
if ( wxFile::Exists(m_strLocalFile) && wxRemove(m_strLocalFile) == -1 )
|
||||||
{
|
{
|
||||||
wxLogSysError(_("can't delete user configuration file '%s'"), m_strLocalFile.c_str());
|
wxLogSysError(_("can't delete user configuration file '%s'"), m_strLocalFile.c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_strLocalFile = m_strGlobalFile = wxT("");
|
m_strLocalFile = m_strGlobalFile = wxT("");
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1269,7 +1269,7 @@ wxFileConfigGroup::wxFileConfigGroup(wxFileConfigGroup *pParent,
|
|||||||
{
|
{
|
||||||
m_pConfig = pConfig;
|
m_pConfig = pConfig;
|
||||||
m_pParent = pParent;
|
m_pParent = pParent;
|
||||||
m_bDirty = FALSE;
|
m_bDirty = false;
|
||||||
m_pLine = NULL;
|
m_pLine = NULL;
|
||||||
|
|
||||||
m_pLastEntry = NULL;
|
m_pLastEntry = NULL;
|
||||||
@@ -1565,14 +1565,14 @@ bool wxFileConfigGroup::DeleteSubgroupByName(const wxChar *szName)
|
|||||||
{
|
{
|
||||||
wxFileConfigGroup * const pGroup = FindSubgroup(szName);
|
wxFileConfigGroup * const pGroup = FindSubgroup(szName);
|
||||||
|
|
||||||
return pGroup ? DeleteSubgroup(pGroup) : FALSE;
|
return pGroup ? DeleteSubgroup(pGroup) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the subgroup and remove all references to it from
|
// Delete the subgroup and remove all references to it from
|
||||||
// other data structures.
|
// other data structures.
|
||||||
bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup)
|
bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( pGroup, FALSE, _T("deleting non existing group?") );
|
wxCHECK_MSG( pGroup, false, _T("deleting non existing group?") );
|
||||||
|
|
||||||
wxLogTrace( _T("wxFileConfig"),
|
wxLogTrace( _T("wxFileConfig"),
|
||||||
_T("Deleting group '%s' from '%s'"),
|
_T("Deleting group '%s' from '%s'"),
|
||||||
@@ -1706,13 +1706,13 @@ bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup)
|
|||||||
m_aSubgroups.Remove(pGroup);
|
m_aSubgroups.Remove(pGroup);
|
||||||
delete pGroup;
|
delete pGroup;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileConfigGroup::DeleteEntry(const wxChar *szName)
|
bool wxFileConfigGroup::DeleteEntry(const wxChar *szName)
|
||||||
{
|
{
|
||||||
wxFileConfigEntry *pEntry = FindEntry(szName);
|
wxFileConfigEntry *pEntry = FindEntry(szName);
|
||||||
wxCHECK( pEntry != NULL, FALSE ); // deleting non existing item?
|
wxCHECK( pEntry != NULL, false ); // deleting non existing item?
|
||||||
|
|
||||||
wxFileConfigLineList *pLine = pEntry->GetLine();
|
wxFileConfigLineList *pLine = pEntry->GetLine();
|
||||||
if ( pLine != NULL ) {
|
if ( pLine != NULL ) {
|
||||||
@@ -1756,7 +1756,7 @@ bool wxFileConfigGroup::DeleteEntry(const wxChar *szName)
|
|||||||
m_aEntries.Remove(pEntry);
|
m_aEntries.Remove(pEntry);
|
||||||
delete pEntry;
|
delete pEntry;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1764,7 +1764,7 @@ bool wxFileConfigGroup::DeleteEntry(const wxChar *szName)
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void wxFileConfigGroup::SetDirty()
|
void wxFileConfigGroup::SetDirty()
|
||||||
{
|
{
|
||||||
m_bDirty = TRUE;
|
m_bDirty = true;
|
||||||
if ( Parent() != NULL ) // propagate upwards
|
if ( Parent() != NULL ) // propagate upwards
|
||||||
Parent()->SetDirty();
|
Parent()->SetDirty();
|
||||||
}
|
}
|
||||||
@@ -1788,7 +1788,7 @@ wxFileConfigEntry::wxFileConfigEntry(wxFileConfigGroup *pParent,
|
|||||||
m_pLine = NULL;
|
m_pLine = NULL;
|
||||||
|
|
||||||
m_bDirty =
|
m_bDirty =
|
||||||
m_bHasValue = FALSE;
|
m_bHasValue = false;
|
||||||
|
|
||||||
m_bImmutable = strName[0] == wxCONFIG_IMMUTABLE_PREFIX;
|
m_bImmutable = strName[0] == wxCONFIG_IMMUTABLE_PREFIX;
|
||||||
if ( m_bImmutable )
|
if ( m_bImmutable )
|
||||||
@@ -1810,7 +1810,7 @@ void wxFileConfigEntry::SetLine(wxFileConfigLineList *pLine)
|
|||||||
Group()->SetLastEntry(this);
|
Group()->SetLastEntry(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// second parameter is FALSE if we read the value from file and prevents the
|
// second parameter is false if we read the value from file and prevents the
|
||||||
// entry from being marked as 'dirty'
|
// entry from being marked as 'dirty'
|
||||||
void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser)
|
void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser)
|
||||||
{
|
{
|
||||||
@@ -1828,7 +1828,7 @@ void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser)
|
|||||||
if ( m_bHasValue && strValue == m_strValue )
|
if ( m_bHasValue && strValue == m_strValue )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_bHasValue = TRUE;
|
m_bHasValue = true;
|
||||||
m_strValue = strValue;
|
m_strValue = strValue;
|
||||||
|
|
||||||
if ( bUser )
|
if ( bUser )
|
||||||
@@ -1866,7 +1866,7 @@ void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser)
|
|||||||
|
|
||||||
void wxFileConfigEntry::SetDirty()
|
void wxFileConfigEntry::SetDirty()
|
||||||
{
|
{
|
||||||
m_bDirty = TRUE;
|
m_bDirty = true;
|
||||||
Group()->SetDirty();
|
Group()->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2033,7 +2033,7 @@ static wxString FilterOutEntryName(const wxString& str)
|
|||||||
//
|
//
|
||||||
// NB: note that wxCONFIG_IMMUTABLE_PREFIX and wxCONFIG_PATH_SEPARATOR
|
// NB: note that wxCONFIG_IMMUTABLE_PREFIX and wxCONFIG_PATH_SEPARATOR
|
||||||
// should *not* be quoted
|
// should *not* be quoted
|
||||||
if (
|
if (
|
||||||
#if !wxUSE_UNICODE
|
#if !wxUSE_UNICODE
|
||||||
((unsigned char)c < 127) &&
|
((unsigned char)c < 127) &&
|
||||||
#endif // ANSI
|
#endif // ANSI
|
||||||
|
@@ -564,9 +564,9 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name)
|
|||||||
trimchars[3] = 0;
|
trimchars[3] = 0;
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
const wxChar SEP = wxT('\\');
|
const wxChar SEP = wxT('\\');
|
||||||
#else
|
#else
|
||||||
const wxChar SEP = wxT('/');
|
const wxChar SEP = wxT('/');
|
||||||
#endif
|
#endif
|
||||||
buf[0] = wxT('\0');
|
buf[0] = wxT('\0');
|
||||||
if (name == NULL || *name == wxT('\0'))
|
if (name == NULL || *name == wxT('\0'))
|
||||||
@@ -915,9 +915,9 @@ wxString wxPathOnly (const wxString& path)
|
|||||||
#define kDefaultPathStyle kCFURLHFSPathStyle
|
#define kDefaultPathStyle kCFURLHFSPathStyle
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent )
|
wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent )
|
||||||
{
|
{
|
||||||
CFURLRef fullURLRef;
|
CFURLRef fullURLRef;
|
||||||
fullURLRef = CFURLCreateFromFSRef(NULL, fsRef);
|
fullURLRef = CFURLCreateFromFSRef(NULL, fsRef);
|
||||||
if ( additionalPathComponent )
|
if ( additionalPathComponent )
|
||||||
{
|
{
|
||||||
@@ -926,19 +926,19 @@ wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathCompon
|
|||||||
additionalPathComponent,false);
|
additionalPathComponent,false);
|
||||||
CFRelease( parentURLRef ) ;
|
CFRelease( parentURLRef ) ;
|
||||||
}
|
}
|
||||||
CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, kDefaultPathStyle);
|
CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, kDefaultPathStyle);
|
||||||
CFRelease( fullURLRef ) ;
|
CFRelease( fullURLRef ) ;
|
||||||
return wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding());
|
return wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding());
|
||||||
}
|
}
|
||||||
|
|
||||||
OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef )
|
OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef )
|
||||||
{
|
{
|
||||||
OSStatus err = noErr ;
|
OSStatus err = noErr ;
|
||||||
CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, wxMacCFStringHolder(path ,wxLocale::GetSystemEncoding() ) , kDefaultPathStyle, false);
|
CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, wxMacCFStringHolder(path ,wxLocale::GetSystemEncoding() ) , kDefaultPathStyle, false);
|
||||||
if ( NULL != url )
|
if ( NULL != url )
|
||||||
{
|
{
|
||||||
if ( CFURLGetFSRef(url, fsRef) == false )
|
if ( CFURLGetFSRef(url, fsRef) == false )
|
||||||
err = fnfErr ;
|
err = fnfErr ;
|
||||||
CFRelease( url ) ;
|
CFRelease( url ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -948,7 +948,7 @@ OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef )
|
|||||||
return err ;
|
return err ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname )
|
wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname )
|
||||||
{
|
{
|
||||||
CFStringRef cfname = CFStringCreateWithCharacters( kCFAllocatorDefault,
|
CFStringRef cfname = CFStringCreateWithCharacters( kCFAllocatorDefault,
|
||||||
uniname->unicode,
|
uniname->unicode,
|
||||||
@@ -1426,7 +1426,7 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
|||||||
if ( getcwd( lbuf , sizeof( lbuf ) ) )
|
if ( getcwd( lbuf , sizeof( lbuf ) ) )
|
||||||
{
|
{
|
||||||
wxString res( lbuf , *wxConvCurrent ) ;
|
wxString res( lbuf , *wxConvCurrent ) ;
|
||||||
wxStrcpy( buf , res ) ;
|
wxStrcpy( buf , res ) ;
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1435,12 +1435,12 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
|||||||
APIRET rc;
|
APIRET rc;
|
||||||
ULONG ulDriveNum = 0;
|
ULONG ulDriveNum = 0;
|
||||||
ULONG ulDriveMap = 0;
|
ULONG ulDriveMap = 0;
|
||||||
rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
|
rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
|
||||||
ok = rc == 0;
|
ok = rc == 0;
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
sz -= 3;
|
sz -= 3;
|
||||||
rc = ::DosQueryCurrentDir( 0 // current drive
|
rc = ::DosQueryCurrentDir( 0 // current drive
|
||||||
,cbuf + 3
|
,cbuf + 3
|
||||||
,(PULONG)&sz
|
,(PULONG)&sz
|
||||||
);
|
);
|
||||||
@@ -1517,7 +1517,7 @@ bool wxSetWorkingDirectory(const wxString& d)
|
|||||||
#elif defined(__UNIX__) || defined(__WXMAC__) || defined(__DOS__)
|
#elif defined(__UNIX__) || defined(__WXMAC__) || defined(__DOS__)
|
||||||
return (chdir(wxFNSTRINGCAST d.fn_str()) == 0);
|
return (chdir(wxFNSTRINGCAST d.fn_str()) == 0);
|
||||||
#elif defined(__WINDOWS__)
|
#elif defined(__WINDOWS__)
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
#ifdef __WXWINCE__
|
#ifdef __WXWINCE__
|
||||||
// No equivalent in WinCE
|
// No equivalent in WinCE
|
||||||
@@ -1531,11 +1531,11 @@ bool wxSetWorkingDirectory(const wxString& d)
|
|||||||
if (isDriveSpec)
|
if (isDriveSpec)
|
||||||
{
|
{
|
||||||
wxChar firstChar = d[0];
|
wxChar firstChar = d[0];
|
||||||
|
|
||||||
// To upper case
|
// To upper case
|
||||||
if (firstChar > 90)
|
if (firstChar > 90)
|
||||||
firstChar = firstChar - 32;
|
firstChar = firstChar - 32;
|
||||||
|
|
||||||
// To a drive number
|
// To a drive number
|
||||||
unsigned int driveNo = firstChar - 64;
|
unsigned int driveNo = firstChar - 64;
|
||||||
if (driveNo > 0)
|
if (driveNo > 0)
|
||||||
@@ -1545,10 +1545,10 @@ bool wxSetWorkingDirectory(const wxString& d)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool success = (chdir(WXSTRINGCAST d) == 0);
|
bool success = (chdir(WXSTRINGCAST d) == 0);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1649,13 +1649,13 @@ time_t WXDLLEXPORT wxFileModificationTime(const wxString& filename)
|
|||||||
{
|
{
|
||||||
wxLogLastError(_T("FileTimeToLocalFileTime"));
|
wxLogLastError(_T("FileTimeToLocalFileTime"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSTEMTIME st;
|
SYSTEMTIME st;
|
||||||
if ( !::FileTimeToSystemTime(&ftLocal, &st) )
|
if ( !::FileTimeToSystemTime(&ftLocal, &st) )
|
||||||
{
|
{
|
||||||
wxLogLastError(_T("FileTimeToSystemTime"));
|
wxLogLastError(_T("FileTimeToSystemTime"));
|
||||||
}
|
}
|
||||||
|
|
||||||
dateTime.Set(st.wDay, wxDateTime::Month(st.wMonth - 1), st.wYear,
|
dateTime.Set(st.wDay, wxDateTime::Month(st.wMonth - 1), st.wYear,
|
||||||
st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
|
st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
|
||||||
return dateTime.GetTicks();
|
return dateTime.GetTicks();
|
||||||
|
@@ -677,7 +677,7 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp)
|
|||||||
else // mkstemp() succeeded
|
else // mkstemp() succeeded
|
||||||
{
|
{
|
||||||
path = wxConvFile.cMB2WX( (const char*) buf );
|
path = wxConvFile.cMB2WX( (const char*) buf );
|
||||||
|
|
||||||
// avoid leaking the fd
|
// avoid leaking the fd
|
||||||
if ( fileTemp )
|
if ( fileTemp )
|
||||||
{
|
{
|
||||||
@@ -794,12 +794,12 @@ bool wxFileName::Mkdir( const wxString& dir, int perm, int flags )
|
|||||||
size_t count = dirs.GetCount();
|
size_t count = dirs.GetCount();
|
||||||
for ( size_t i = 0; i < count; i++ )
|
for ( size_t i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
if ( i > 0 ||
|
if ( i > 0 ||
|
||||||
#if defined(__WXMAC__) && !defined(__DARWIN__)
|
#if defined(__WXMAC__) && !defined(__DARWIN__)
|
||||||
// relative pathnames are exactely the other way round under mac...
|
// relative pathnames are exactely the other way round under mac...
|
||||||
!filename.IsAbsolute()
|
!filename.IsAbsolute()
|
||||||
#else
|
#else
|
||||||
filename.IsAbsolute()
|
filename.IsAbsolute()
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
currPath += wxFILE_SEP_PATH;
|
currPath += wxFILE_SEP_PATH;
|
||||||
@@ -951,7 +951,7 @@ bool wxFileName::Normalize(int flags,
|
|||||||
|
|
||||||
m_dirs.Add(dir);
|
m_dirs.Add(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE
|
#if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE
|
||||||
if ( (flags & wxPATH_NORM_SHORTCUT) )
|
if ( (flags & wxPATH_NORM_SHORTCUT) )
|
||||||
{
|
{
|
||||||
@@ -1021,49 +1021,49 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, wxString& targe
|
|||||||
{
|
{
|
||||||
wxString path, file, ext;
|
wxString path, file, ext;
|
||||||
wxSplitPath(shortcutPath, & path, & file, & ext);
|
wxSplitPath(shortcutPath, & path, & file, & ext);
|
||||||
|
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
IShellLink* psl;
|
IShellLink* psl;
|
||||||
bool success = FALSE;
|
bool success = false;
|
||||||
|
|
||||||
// Assume it's not a shortcut if it doesn't end with lnk
|
// Assume it's not a shortcut if it doesn't end with lnk
|
||||||
if (ext.Lower() != wxT("lnk"))
|
if (ext.Lower() != wxT("lnk"))
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// create a ShellLink object
|
|
||||||
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
|
||||||
IID_IShellLink, (LPVOID*) &psl);
|
|
||||||
|
|
||||||
if (SUCCEEDED(hres))
|
|
||||||
{
|
|
||||||
IPersistFile* ppf;
|
|
||||||
hres = psl->QueryInterface( IID_IPersistFile, (LPVOID *) &ppf);
|
|
||||||
if (SUCCEEDED(hres))
|
|
||||||
{
|
|
||||||
WCHAR wsz[MAX_PATH];
|
|
||||||
|
|
||||||
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, shortcutPath.mb_str(), -1, wsz,
|
// create a ShellLink object
|
||||||
MAX_PATH);
|
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
||||||
|
IID_IShellLink, (LPVOID*) &psl);
|
||||||
hres = ppf->Load(wsz, 0);
|
|
||||||
if (SUCCEEDED(hres))
|
if (SUCCEEDED(hres))
|
||||||
{
|
{
|
||||||
|
IPersistFile* ppf;
|
||||||
|
hres = psl->QueryInterface( IID_IPersistFile, (LPVOID *) &ppf);
|
||||||
|
if (SUCCEEDED(hres))
|
||||||
|
{
|
||||||
|
WCHAR wsz[MAX_PATH];
|
||||||
|
|
||||||
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, shortcutPath.mb_str(), -1, wsz,
|
||||||
|
MAX_PATH);
|
||||||
|
|
||||||
|
hres = ppf->Load(wsz, 0);
|
||||||
|
if (SUCCEEDED(hres))
|
||||||
|
{
|
||||||
wxChar buf[2048];
|
wxChar buf[2048];
|
||||||
psl->GetPath(buf, 2048, NULL, SLGP_UNCPRIORITY);
|
psl->GetPath(buf, 2048, NULL, SLGP_UNCPRIORITY);
|
||||||
targetFilename = wxString(buf);
|
targetFilename = wxString(buf);
|
||||||
success = (shortcutPath != targetFilename);
|
success = (shortcutPath != targetFilename);
|
||||||
|
|
||||||
psl->GetArguments(buf, 2048);
|
psl->GetArguments(buf, 2048);
|
||||||
wxString args(buf);
|
wxString args(buf);
|
||||||
if (!args.IsEmpty() && arguments)
|
if (!args.IsEmpty() && arguments)
|
||||||
{
|
{
|
||||||
*arguments = args;
|
*arguments = args;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
psl->Release();
|
psl->Release();
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2040,14 +2040,14 @@ bool wxFileName::MacSetTypeAndCreator( wxUint32 type , wxUint32 creator )
|
|||||||
|
|
||||||
if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr )
|
if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr )
|
||||||
{
|
{
|
||||||
if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
|
if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
|
||||||
{
|
{
|
||||||
finfo = (FileInfo*)&catInfo.finderInfo;
|
finfo = (FileInfo*)&catInfo.finderInfo;
|
||||||
finfo->fileType = type ;
|
finfo->fileType = type ;
|
||||||
finfo->fileCreator = creator ;
|
finfo->fileCreator = creator ;
|
||||||
FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ;
|
FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -2060,13 +2060,13 @@ bool wxFileName::MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator )
|
|||||||
|
|
||||||
if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr )
|
if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr )
|
||||||
{
|
{
|
||||||
if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
|
if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
|
||||||
{
|
{
|
||||||
finfo = (FileInfo*)&catInfo.finderInfo;
|
finfo = (FileInfo*)&catInfo.finderInfo;
|
||||||
*type = finfo->fileType ;
|
*type = finfo->fileType ;
|
||||||
*creator = finfo->fileCreator ;
|
*creator = finfo->fileCreator ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
@@ -105,15 +105,15 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location)
|
|||||||
|
|
||||||
return mime;
|
return mime;
|
||||||
#else
|
#else
|
||||||
if ( ext.IsSameAs(wxT("htm"), FALSE) || ext.IsSameAs(_T("html"), FALSE) )
|
if ( ext.IsSameAs(wxT("htm"), false) || ext.IsSameAs(_T("html"), false) )
|
||||||
return wxT("text/html");
|
return wxT("text/html");
|
||||||
if ( ext.IsSameAs(wxT("jpg"), FALSE) || ext.IsSameAs(_T("jpeg"), FALSE) )
|
if ( ext.IsSameAs(wxT("jpg"), false) || ext.IsSameAs(_T("jpeg"), false) )
|
||||||
return wxT("image/jpeg");
|
return wxT("image/jpeg");
|
||||||
if ( ext.IsSameAs(wxT("gif"), FALSE) )
|
if ( ext.IsSameAs(wxT("gif"), false) )
|
||||||
return wxT("image/gif");
|
return wxT("image/gif");
|
||||||
if ( ext.IsSameAs(wxT("png"), FALSE) )
|
if ( ext.IsSameAs(wxT("png"), false) )
|
||||||
return wxT("image/png");
|
return wxT("image/png");
|
||||||
if ( ext.IsSameAs(wxT("bmp"), FALSE) )
|
if ( ext.IsSameAs(wxT("bmp"), false) )
|
||||||
return wxT("image/bmp");
|
return wxT("image/bmp");
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
#endif
|
#endif
|
||||||
@@ -125,11 +125,10 @@ wxString wxFileSystemHandler::GetProtocol(const wxString& location) const
|
|||||||
{
|
{
|
||||||
wxString s = wxEmptyString;
|
wxString s = wxEmptyString;
|
||||||
int i, l = location.Length();
|
int i, l = location.Length();
|
||||||
bool fnd;
|
bool fnd = false;
|
||||||
|
|
||||||
fnd = FALSE;
|
|
||||||
for (i = l-1; (i >= 0) && ((location[i] != wxT('#')) || (!fnd)); i--) {
|
for (i = l-1; (i >= 0) && ((location[i] != wxT('#')) || (!fnd)); i--) {
|
||||||
if ((location[i] == wxT(':')) && (i != 1 /*win: C:\path*/)) fnd = TRUE;
|
if ((location[i] == wxT(':')) && (i != 1 /*win: C:\path*/)) fnd = true;
|
||||||
}
|
}
|
||||||
if (!fnd) return wxT("file");
|
if (!fnd) return wxT("file");
|
||||||
for (++i; (i < l) && (location[i] != wxT(':')); i++) s << location[i];
|
for (++i; (i < l) && (location[i] != wxT(':')); i++) s << location[i];
|
||||||
@@ -140,11 +139,10 @@ wxString wxFileSystemHandler::GetProtocol(const wxString& location) const
|
|||||||
wxString wxFileSystemHandler::GetLeftLocation(const wxString& location) const
|
wxString wxFileSystemHandler::GetLeftLocation(const wxString& location) const
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
bool fnd;
|
bool fnd = false;
|
||||||
|
|
||||||
fnd = FALSE;
|
|
||||||
for (i = location.Length()-1; i >= 0; i--) {
|
for (i = location.Length()-1; i >= 0; i--) {
|
||||||
if ((location[i] == wxT(':')) && (i != 1 /*win: C:\path*/)) fnd = TRUE;
|
if ((location[i] == wxT(':')) && (i != 1 /*win: C:\path*/)) fnd = true;
|
||||||
else if (fnd && (location[i] == wxT('#'))) return location.Left(i);
|
else if (fnd && (location[i] == wxT('#'))) return location.Left(i);
|
||||||
}
|
}
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
@@ -155,8 +153,8 @@ wxString wxFileSystemHandler::GetRightLocation(const wxString& location) const
|
|||||||
int i, l = location.Length();
|
int i, l = location.Length();
|
||||||
int l2 = l + 1;
|
int l2 = l + 1;
|
||||||
|
|
||||||
for (i = l-1;
|
for (i = l-1;
|
||||||
(i >= 0) &&
|
(i >= 0) &&
|
||||||
((location[i] != wxT(':')) || (i == 1) || (location[i-2] == wxT(':')));
|
((location[i] != wxT(':')) || (i == 1) || (location[i-2] == wxT(':')));
|
||||||
i--)
|
i--)
|
||||||
{
|
{
|
||||||
@@ -468,44 +466,44 @@ const static wxString g_nativePathString(wxFILE_SEP_PATH);
|
|||||||
// Returns the native path for a file URL
|
// Returns the native path for a file URL
|
||||||
wxFileName wxFileSystem::URLToFileName(const wxString& url)
|
wxFileName wxFileSystem::URLToFileName(const wxString& url)
|
||||||
{
|
{
|
||||||
wxString path = url;
|
wxString path = url;
|
||||||
|
|
||||||
if ( path.Find(wxT("file://")) == 0 )
|
if ( path.Find(wxT("file://")) == 0 )
|
||||||
{
|
{
|
||||||
path = path.Mid(7);
|
path = path.Mid(7);
|
||||||
}
|
}
|
||||||
else if ( path.Find(wxT("file:")) == 0 )
|
else if ( path.Find(wxT("file:")) == 0 )
|
||||||
{
|
{
|
||||||
path = path.Mid(5);
|
path = path.Mid(5);
|
||||||
}
|
}
|
||||||
// Remove preceding double slash on Mac Classic
|
// Remove preceding double slash on Mac Classic
|
||||||
#if defined(__WXMAC__) && !defined(__UNIX__)
|
#if defined(__WXMAC__) && !defined(__UNIX__)
|
||||||
else if ( path.Find(wxT("//")) == 0 )
|
else if ( path.Find(wxT("//")) == 0 )
|
||||||
path = path.Mid(2);
|
path = path.Mid(2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
path.Replace(wxT("%25"), wxT("%"));
|
path.Replace(wxT("%25"), wxT("%"));
|
||||||
path.Replace(wxT("%3A"), wxT(":"));
|
path.Replace(wxT("%3A"), wxT(":"));
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
// file urls either start with a forward slash (local harddisk),
|
// file urls either start with a forward slash (local harddisk),
|
||||||
// otherwise they have a servername/sharename notation,
|
// otherwise they have a servername/sharename notation,
|
||||||
// which only exists on msw and corresponds to a unc
|
// which only exists on msw and corresponds to a unc
|
||||||
if ( path[0u] == wxT('/') && path [1u] != wxT('/'))
|
if ( path[0u] == wxT('/') && path [1u] != wxT('/'))
|
||||||
{
|
{
|
||||||
path = path.Mid(1);
|
path = path.Mid(1);
|
||||||
}
|
}
|
||||||
else if ( (url.Find(wxT("file://")) == 0) &&
|
else if ( (url.Find(wxT("file://")) == 0) &&
|
||||||
(path.Find(wxT('/')) != wxNOT_FOUND) &&
|
(path.Find(wxT('/')) != wxNOT_FOUND) &&
|
||||||
(path.Length() > 1) && (path[1u] != wxT(':')) )
|
(path.Length() > 1) && (path[1u] != wxT(':')) )
|
||||||
{
|
{
|
||||||
path = wxT("//") + path;
|
path = wxT("//") + path;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
path.Replace(g_unixPathString, g_nativePathString);
|
path.Replace(g_unixPathString, g_nativePathString);
|
||||||
|
|
||||||
return wxFileName(path, wxPATH_NATIVE);
|
return wxFileName(path, wxPATH_NATIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the file URL for a native path
|
// Returns the file URL for a native path
|
||||||
@@ -517,7 +515,7 @@ wxString wxFileSystem::FileNameToURL(const wxFileName& filename)
|
|||||||
|
|
||||||
#ifndef __UNIX__
|
#ifndef __UNIX__
|
||||||
// unc notation, wxMSW
|
// unc notation, wxMSW
|
||||||
if ( url.Find(wxT("\\\\")) == 0 )
|
if ( url.Find(wxT("\\\\")) == 0 )
|
||||||
{
|
{
|
||||||
url = wxT("//") + url.Mid(2);
|
url = wxT("//") + url.Mid(2);
|
||||||
}
|
}
|
||||||
|
@@ -99,7 +99,7 @@ wxString wxFileDialogBase::AppendExtension(const wxString &filePath,
|
|||||||
wxString fileName = filePath.AfterLast(wxFILE_SEP_PATH);
|
wxString fileName = filePath.AfterLast(wxFILE_SEP_PATH);
|
||||||
|
|
||||||
// if fileName is of form "foo.bar" it's ok, return it
|
// if fileName is of form "foo.bar" it's ok, return it
|
||||||
int idx_dot = fileName.Find(wxT('.'), TRUE);
|
int idx_dot = fileName.Find(wxT('.'), true);
|
||||||
if ((idx_dot != wxNOT_FOUND) && (idx_dot < (int)fileName.Len() - 1))
|
if ((idx_dot != wxNOT_FOUND) && (idx_dot < (int)fileName.Len() - 1))
|
||||||
return filePath;
|
return filePath;
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ wxString wxFileDialogBase::AppendExtension(const wxString &filePath,
|
|||||||
wxString ext = extensionList.BeforeFirst(wxT(';'));
|
wxString ext = extensionList.BeforeFirst(wxT(';'));
|
||||||
|
|
||||||
// if ext == "foo" or "foo." there's no extension
|
// if ext == "foo" or "foo." there's no extension
|
||||||
int idx_ext_dot = ext.Find(wxT('.'), TRUE);
|
int idx_ext_dot = ext.Find(wxT('.'), true);
|
||||||
if ((idx_ext_dot == wxNOT_FOUND) || (idx_ext_dot == (int)ext.Len() - 1))
|
if ((idx_ext_dot == wxNOT_FOUND) || (idx_ext_dot == (int)ext.Len() - 1))
|
||||||
return filePath;
|
return filePath;
|
||||||
else
|
else
|
||||||
@@ -277,7 +277,7 @@ WXDLLEXPORT wxString wxLoadFileSelector(const wxChar *what,
|
|||||||
const wxChar *default_name,
|
const wxChar *default_name,
|
||||||
wxWindow *parent)
|
wxWindow *parent)
|
||||||
{
|
{
|
||||||
return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
|
return wxDefaultFileSelector(true, what, extension, default_name, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -289,7 +289,7 @@ WXDLLEXPORT wxString wxSaveFileSelector(const wxChar *what,
|
|||||||
const wxChar *default_name,
|
const wxChar *default_name,
|
||||||
wxWindow *parent)
|
wxWindow *parent)
|
||||||
{
|
{
|
||||||
return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
|
return wxDefaultFileSelector(false, what, extension, default_name, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_FILEDLG
|
#endif // wxUSE_FILEDLG
|
||||||
|
@@ -198,7 +198,7 @@ class wxFontMapperModule : public wxModule
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxFontMapperModule() : wxModule() { }
|
wxFontMapperModule() : wxModule() { }
|
||||||
virtual bool OnInit() { return TRUE; }
|
virtual bool OnInit() { return true; }
|
||||||
virtual void OnExit() { delete wxFontMapper::Set(NULL); }
|
virtual void OnExit() { delete wxFontMapper::Set(NULL); }
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxFontMapperModule)
|
DECLARE_DYNAMIC_CLASS(wxFontMapperModule)
|
||||||
@@ -221,7 +221,7 @@ wxFontMapperBase::wxFontMapperBase()
|
|||||||
{
|
{
|
||||||
#if wxUSE_CONFIG && wxUSE_FILECONFIG
|
#if wxUSE_CONFIG && wxUSE_FILECONFIG
|
||||||
m_config = NULL;
|
m_config = NULL;
|
||||||
m_configIsDummy = FALSE;
|
m_configIsDummy = false;
|
||||||
#endif // wxUSE_CONFIG
|
#endif // wxUSE_CONFIG
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ wxConfigBase *wxFontMapperBase::GetConfig()
|
|||||||
if ( !m_config )
|
if ( !m_config )
|
||||||
{
|
{
|
||||||
// try the default
|
// try the default
|
||||||
m_config = wxConfig::Get(FALSE /*don't create on demand*/ );
|
m_config = wxConfig::Get(false /*don't create on demand*/ );
|
||||||
|
|
||||||
if ( !m_config )
|
if ( !m_config )
|
||||||
{
|
{
|
||||||
@@ -305,7 +305,7 @@ wxConfigBase *wxFontMapperBase::GetConfig()
|
|||||||
// but will allow us to remember the results of the questions at
|
// but will allow us to remember the results of the questions at
|
||||||
// least during this run
|
// least during this run
|
||||||
m_config = new wxMemoryConfig;
|
m_config = new wxMemoryConfig;
|
||||||
m_configIsDummy = TRUE;
|
m_configIsDummy = true;
|
||||||
// VS: we can't call wxConfig::Set(m_config) here because that would
|
// VS: we can't call wxConfig::Set(m_config) here because that would
|
||||||
// disable automatic wxConfig instance creation if this code was
|
// disable automatic wxConfig instance creation if this code was
|
||||||
// called before wxApp::OnInit (this happens in wxGTK -- it sets
|
// called before wxApp::OnInit (this happens in wxGTK -- it sets
|
||||||
@@ -313,13 +313,13 @@ wxConfigBase *wxFontMapperBase::GetConfig()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_configIsDummy && wxConfig::Get(FALSE) != NULL )
|
if ( m_configIsDummy && wxConfig::Get(false) != NULL )
|
||||||
{
|
{
|
||||||
// VS: in case we created dummy m_config (see above), we want to switch back
|
// VS: in case we created dummy m_config (see above), we want to switch back
|
||||||
// to the real one as soon as one becomes available.
|
// to the real one as soon as one becomes available.
|
||||||
delete m_config;
|
delete m_config;
|
||||||
m_config = wxConfig::Get(FALSE);
|
m_config = wxConfig::Get(false);
|
||||||
m_configIsDummy = FALSE;
|
m_configIsDummy = false;
|
||||||
// FIXME: ideally, we should add keys from dummy config to the real one now,
|
// FIXME: ideally, we should add keys from dummy config to the real one now,
|
||||||
// but it is a low-priority task because typical wxWin application
|
// but it is a low-priority task because typical wxWin application
|
||||||
// either doesn't use wxConfig at all or creates wxConfig object in
|
// either doesn't use wxConfig at all or creates wxConfig object in
|
||||||
@@ -349,7 +349,7 @@ bool wxFontMapperBase::ChangePath(const wxString& pathNew, wxString *pathOld)
|
|||||||
{
|
{
|
||||||
wxConfigBase *config = GetConfig();
|
wxConfigBase *config = GetConfig();
|
||||||
if ( !config )
|
if ( !config )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
*pathOld = config->GetPath();
|
*pathOld = config->GetPath();
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ bool wxFontMapperBase::ChangePath(const wxString& pathNew, wxString *pathOld)
|
|||||||
|
|
||||||
config->SetPath(path);
|
config->SetPath(path);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFontMapperBase::RestorePath(const wxString& pathOld)
|
void wxFontMapperBase::RestorePath(const wxString& pathOld)
|
||||||
@@ -437,7 +437,7 @@ wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset)
|
|||||||
config->SetPath(FONTMAPPER_CHARSET_ALIAS_PATH);
|
config->SetPath(FONTMAPPER_CHARSET_ALIAS_PATH);
|
||||||
|
|
||||||
wxString alias = config->Read(charset);
|
wxString alias = config->Read(charset);
|
||||||
if ( !!alias )
|
if ( !alias.IsEmpty() )
|
||||||
{
|
{
|
||||||
// yes, we do - use it instead
|
// yes, we do - use it instead
|
||||||
cs = alias;
|
cs = alias;
|
||||||
@@ -523,7 +523,7 @@ wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset)
|
|||||||
cs == wxT("EUC_KR") )
|
cs == wxT("EUC_KR") )
|
||||||
{
|
{
|
||||||
encoding = wxFONTENCODING_CP949;
|
encoding = wxFONTENCODING_CP949;
|
||||||
}
|
}
|
||||||
else if ( cs == wxT("KOI8-R") ||
|
else if ( cs == wxT("KOI8-R") ||
|
||||||
cs == wxT("KOI8-RU") )
|
cs == wxT("KOI8-RU") )
|
||||||
{
|
{
|
||||||
@@ -543,14 +543,14 @@ wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset)
|
|||||||
const wxChar *p = cs.c_str() + 3;
|
const wxChar *p = cs.c_str() + 3;
|
||||||
if ( *p == wxT('-') )
|
if ( *p == wxT('-') )
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
// printf( "iso %s\n", (const char*) cs.ToAscii() );
|
// printf( "iso %s\n", (const char*) cs.ToAscii() );
|
||||||
|
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 )
|
if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 )
|
||||||
{
|
{
|
||||||
// printf( "value %d\n", (int)value );
|
// printf( "value %d\n", (int)value );
|
||||||
|
|
||||||
// make it 0 based and check that it is strictly positive in
|
// make it 0 based and check that it is strictly positive in
|
||||||
// the process (no such thing as iso8859-0 encoding)
|
// the process (no such thing as iso8859-0 encoding)
|
||||||
if ( (value-- > 0) &&
|
if ( (value-- > 0) &&
|
||||||
@@ -566,12 +566,12 @@ wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset)
|
|||||||
else if ( cs.Left(4) == wxT("8859") )
|
else if ( cs.Left(4) == wxT("8859") )
|
||||||
{
|
{
|
||||||
const wxChar *p = cs.c_str();
|
const wxChar *p = cs.c_str();
|
||||||
|
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 )
|
if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 )
|
||||||
{
|
{
|
||||||
// printf( "value %d\n", (int)value );
|
// printf( "value %d\n", (int)value );
|
||||||
|
|
||||||
// make it 0 based and check that it is strictly positive in
|
// make it 0 based and check that it is strictly positive in
|
||||||
// the process (no such thing as iso8859-0 encoding)
|
// the process (no such thing as iso8859-0 encoding)
|
||||||
if ( (value-- > 0) &&
|
if ( (value-- > 0) &&
|
||||||
|
@@ -284,42 +284,42 @@ bool wxNativeFontInfo::FromString(const wxString& s)
|
|||||||
|
|
||||||
token = tokenizer.GetNextToken();
|
token = tokenizer.GetNextToken();
|
||||||
if ( !token.ToLong(&l) )
|
if ( !token.ToLong(&l) )
|
||||||
return FALSE;
|
return false;
|
||||||
pointSize = (int)l;
|
pointSize = (int)l;
|
||||||
|
|
||||||
token = tokenizer.GetNextToken();
|
token = tokenizer.GetNextToken();
|
||||||
if ( !token.ToLong(&l) )
|
if ( !token.ToLong(&l) )
|
||||||
return FALSE;
|
return false;
|
||||||
family = (wxFontFamily)l;
|
family = (wxFontFamily)l;
|
||||||
|
|
||||||
token = tokenizer.GetNextToken();
|
token = tokenizer.GetNextToken();
|
||||||
if ( !token.ToLong(&l) )
|
if ( !token.ToLong(&l) )
|
||||||
return FALSE;
|
return false;
|
||||||
style = (wxFontStyle)l;
|
style = (wxFontStyle)l;
|
||||||
|
|
||||||
token = tokenizer.GetNextToken();
|
token = tokenizer.GetNextToken();
|
||||||
if ( !token.ToLong(&l) )
|
if ( !token.ToLong(&l) )
|
||||||
return FALSE;
|
return false;
|
||||||
weight = (wxFontWeight)l;
|
weight = (wxFontWeight)l;
|
||||||
|
|
||||||
token = tokenizer.GetNextToken();
|
token = tokenizer.GetNextToken();
|
||||||
if ( !token.ToLong(&l) )
|
if ( !token.ToLong(&l) )
|
||||||
return FALSE;
|
return false;
|
||||||
underlined = l != 0;
|
underlined = l != 0;
|
||||||
|
|
||||||
faceName = tokenizer.GetNextToken();
|
faceName = tokenizer.GetNextToken();
|
||||||
|
|
||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
if( !faceName )
|
if( !faceName )
|
||||||
return FALSE;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
token = tokenizer.GetNextToken();
|
token = tokenizer.GetNextToken();
|
||||||
if ( !token.ToLong(&l) )
|
if ( !token.ToLong(&l) )
|
||||||
return FALSE;
|
return false;
|
||||||
encoding = (wxFontEncoding)l;
|
encoding = (wxFontEncoding)l;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxNativeFontInfo::ToString() const
|
wxString wxNativeFontInfo::ToString() const
|
||||||
@@ -345,7 +345,7 @@ void wxNativeFontInfo::Init()
|
|||||||
family = wxFONTFAMILY_DEFAULT;
|
family = wxFONTFAMILY_DEFAULT;
|
||||||
style = wxFONTSTYLE_NORMAL;
|
style = wxFONTSTYLE_NORMAL;
|
||||||
weight = wxFONTWEIGHT_NORMAL;
|
weight = wxFONTWEIGHT_NORMAL;
|
||||||
underlined = FALSE;
|
underlined = false;
|
||||||
faceName.clear();
|
faceName.clear();
|
||||||
encoding = wxFONTENCODING_DEFAULT;
|
encoding = wxFONTENCODING_DEFAULT;
|
||||||
}
|
}
|
||||||
@@ -519,12 +519,12 @@ bool wxNativeFontInfo::FromUserString(const wxString& s)
|
|||||||
wxString token = tokenizer.GetNextToken();
|
wxString token = tokenizer.GetNextToken();
|
||||||
|
|
||||||
// normalize it
|
// normalize it
|
||||||
token.Trim(TRUE).Trim(FALSE).MakeLower();
|
token.Trim(true).Trim(false).MakeLower();
|
||||||
|
|
||||||
// look for the known tokens
|
// look for the known tokens
|
||||||
if ( token == _T("underlined") || token == _("underlined") )
|
if ( token == _T("underlined") || token == _("underlined") )
|
||||||
{
|
{
|
||||||
SetUnderlined(TRUE);
|
SetUnderlined(true);
|
||||||
}
|
}
|
||||||
else if ( token == _T("light") || token == _("light") )
|
else if ( token == _T("light") || token == _("light") )
|
||||||
{
|
{
|
||||||
@@ -543,7 +543,7 @@ bool wxNativeFontInfo::FromUserString(const wxString& s)
|
|||||||
SetPointSize(size);
|
SetPointSize(size);
|
||||||
}
|
}
|
||||||
#if wxUSE_FONTMAP
|
#if wxUSE_FONTMAP
|
||||||
else if ( (encoding = wxFontMapper::Get()->CharsetToEncoding(token, FALSE))
|
else if ( (encoding = wxFontMapper::Get()->CharsetToEncoding(token, false))
|
||||||
!= wxFONTENCODING_DEFAULT )
|
!= wxFONTENCODING_DEFAULT )
|
||||||
{
|
{
|
||||||
SetEncoding(encoding);
|
SetEncoding(encoding);
|
||||||
@@ -578,7 +578,7 @@ bool wxNativeFontInfo::FromUserString(const wxString& s)
|
|||||||
SetFaceName(face);
|
SetFaceName(face);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // generic or wxMSW or wxOS2
|
#endif // generic or wxMSW or wxOS2
|
||||||
|
@@ -316,7 +316,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
|
|||||||
|
|
||||||
wxString configEntry,
|
wxString configEntry,
|
||||||
encName = GetEncodingName(encoding);
|
encName = GetEncodingName(encoding);
|
||||||
if ( !!facename )
|
if ( !facename.IsEmpty() )
|
||||||
{
|
{
|
||||||
configEntry = facename + _T("_");
|
configEntry = facename + _T("_");
|
||||||
}
|
}
|
||||||
@@ -340,13 +340,13 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
|
|||||||
}
|
}
|
||||||
else // use the info entered the last time
|
else // use the info entered the last time
|
||||||
{
|
{
|
||||||
if ( !!fontinfo && !!facename )
|
if ( !fontinfo.IsEmpty() && !facename.IsEmpty() )
|
||||||
{
|
{
|
||||||
// we tried to find a match with facename -- now try without it
|
// we tried to find a match with facename -- now try without it
|
||||||
fontinfo = GetConfig()->Read(encName);
|
fontinfo = GetConfig()->Read(encName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !!fontinfo )
|
if ( !fontinfo.IsEmpty() )
|
||||||
{
|
{
|
||||||
if ( info->FromString(fontinfo) )
|
if ( info->FromString(fontinfo) )
|
||||||
{
|
{
|
||||||
|
@@ -218,7 +218,7 @@ bool wxFrameBase::ProcessCommand(int id)
|
|||||||
void wxFrameBase::UpdateWindowUI(long flags)
|
void wxFrameBase::UpdateWindowUI(long flags)
|
||||||
{
|
{
|
||||||
wxWindowBase::UpdateWindowUI(flags);
|
wxWindowBase::UpdateWindowUI(flags);
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
#if wxUSE_TOOLBAR
|
||||||
if (GetToolBar())
|
if (GetToolBar())
|
||||||
GetToolBar()->UpdateWindowUI(flags);
|
GetToolBar()->UpdateWindowUI(flags);
|
||||||
@@ -286,7 +286,7 @@ void wxFrameBase::OnMenuClose(wxMenuEvent& WXUNUSED(event))
|
|||||||
void wxFrameBase::OnInternalIdle()
|
void wxFrameBase::OnInternalIdle()
|
||||||
{
|
{
|
||||||
wxTopLevelWindow::OnInternalIdle();
|
wxTopLevelWindow::OnInternalIdle();
|
||||||
|
|
||||||
#if wxUSE_MENUS && wxUSE_IDLEMENUUPDATES
|
#if wxUSE_MENUS && wxUSE_IDLEMENUUPDATES
|
||||||
if (wxUpdateUIEvent::CanUpdate(this))
|
if (wxUpdateUIEvent::CanUpdate(this))
|
||||||
DoMenuUpdates();
|
DoMenuUpdates();
|
||||||
|
@@ -42,7 +42,7 @@ class wxTemporaryFileInputStream : public wxFileInputStream
|
|||||||
public:
|
public:
|
||||||
wxTemporaryFileInputStream(const wxString& filename) :
|
wxTemporaryFileInputStream(const wxString& filename) :
|
||||||
wxFileInputStream(filename), m_filename(filename) {}
|
wxFileInputStream(filename), m_filename(filename) {}
|
||||||
|
|
||||||
~wxTemporaryFileInputStream()
|
~wxTemporaryFileInputStream()
|
||||||
{
|
{
|
||||||
// NB: copied from wxFileInputStream dtor, we need to do it before
|
// NB: copied from wxFileInputStream dtor, we need to do it before
|
||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
delete m_file;
|
delete m_file;
|
||||||
m_file_destroy = false;
|
m_file_destroy = false;
|
||||||
}
|
}
|
||||||
wxRemoveFile(m_filename);
|
wxRemoveFile(m_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -91,7 +91,7 @@ bool wxInternetFSHandler::CanOpen(const wxString& location)
|
|||||||
return (url.GetError() == wxURL_NOERR);
|
return (url.GetError() == wxURL_NOERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs),
|
|||||||
s->Read(sout);
|
s->Read(sout);
|
||||||
}
|
}
|
||||||
delete s;
|
delete s;
|
||||||
|
|
||||||
return new wxFSFile(new wxTemporaryFileInputStream(tmpfile),
|
return new wxFSFile(new wxTemporaryFileInputStream(tmpfile),
|
||||||
right,
|
right,
|
||||||
content,
|
content,
|
||||||
@@ -141,7 +141,7 @@ class wxFileSystemInternetModule : public wxModule
|
|||||||
virtual bool OnInit()
|
virtual bool OnInit()
|
||||||
{
|
{
|
||||||
wxFileSystem::AddHandler(new wxInternetFSHandler);
|
wxFileSystem::AddHandler(new wxInternetFSHandler);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
virtual void OnExit() {}
|
virtual void OnExit() {}
|
||||||
};
|
};
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__)
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__)
|
||||||
// Some older compilers (such as EMX) cannot handle
|
// Some older compilers (such as EMX) cannot handle
|
||||||
// #pragma interface/implementation correctly, iff
|
// #pragma interface/implementation correctly, iff
|
||||||
// #pragma implementation is used in _two_ translation
|
// #pragma implementation is used in _two_ translation
|
||||||
// units (as created by e.g. event.cpp compiled for
|
// units (as created by e.g. event.cpp compiled for
|
||||||
// libwx_base and event.cpp compiled for libwx_gui_core).
|
// libwx_base and event.cpp compiled for libwx_gui_core).
|
||||||
@@ -79,7 +79,7 @@ class MemFSHashObj : public wxObject
|
|||||||
{
|
{
|
||||||
#if wxUSE_DATETIME
|
#if wxUSE_DATETIME
|
||||||
m_Time = wxDateTime::Now();
|
m_Time = wxDateTime::Now();
|
||||||
#endif // wxUSE_DATETIME
|
#endif // wxUSE_DATETIME
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ wxFSFile* wxMemoryFSHandlerBase::OpenFile(wxFileSystem& WXUNUSED(fs), const wxSt
|
|||||||
GetAnchor(location)
|
GetAnchor(location)
|
||||||
#if wxUSE_DATETIME
|
#if wxUSE_DATETIME
|
||||||
, obj -> m_Time
|
, obj -> m_Time
|
||||||
#endif // wxUSE_DATETIME
|
#endif // wxUSE_DATETIME
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else return NULL;
|
else return NULL;
|
||||||
@@ -175,10 +175,10 @@ bool wxMemoryFSHandlerBase::CheckHash(const wxString& filename)
|
|||||||
wxString s;
|
wxString s;
|
||||||
s.Printf(_("Memory VFS already contains file '%s'!"), filename.c_str());
|
s.Printf(_("Memory VFS already contains file '%s'!"), filename.c_str());
|
||||||
wxLogError(s);
|
wxLogError(s);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@ wxZipFSHandler::wxZipFSHandler() : wxFileSystemHandler()
|
|||||||
{
|
{
|
||||||
m_Archive = NULL;
|
m_Archive = NULL;
|
||||||
m_ZipFile = m_Pattern = m_BaseDir = wxEmptyString;
|
m_ZipFile = m_Pattern = m_BaseDir = wxEmptyString;
|
||||||
m_AllowDirs = m_AllowFiles = TRUE;
|
m_AllowDirs = m_AllowFiles = true;
|
||||||
m_DirsFound = NULL;
|
m_DirsFound = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& l
|
|||||||
rightPart.Normalize(wxPATH_NORM_DOTS, wxT("/"), wxPATH_UNIX);
|
rightPart.Normalize(wxPATH_NORM_DOTS, wxT("/"), wxPATH_UNIX);
|
||||||
right = rightPart.GetFullPath(wxPATH_UNIX);
|
right = rightPart.GetFullPath(wxPATH_UNIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (right.GetChar(0) == wxT('/')) right = right.Mid(1);
|
if (right.GetChar(0) == wxT('/')) right = right.Mid(1);
|
||||||
|
|
||||||
wxFileName leftFilename = wxFileSystem::URLToFileName(left);
|
wxFileName leftFilename = wxFileSystem::URLToFileName(left);
|
||||||
@@ -138,11 +138,11 @@ wxString wxZipFSHandler::FindFirst(const wxString& spec, int flags)
|
|||||||
switch (flags)
|
switch (flags)
|
||||||
{
|
{
|
||||||
case wxFILE:
|
case wxFILE:
|
||||||
m_AllowDirs = FALSE, m_AllowFiles = TRUE; break;
|
m_AllowDirs = false, m_AllowFiles = true; break;
|
||||||
case wxDIR:
|
case wxDIR:
|
||||||
m_AllowDirs = TRUE, m_AllowFiles = FALSE; break;
|
m_AllowDirs = true, m_AllowFiles = false; break;
|
||||||
default:
|
default:
|
||||||
m_AllowDirs = m_AllowFiles = TRUE; break;
|
m_AllowDirs = m_AllowFiles = true; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ZipFile = left;
|
m_ZipFile = left;
|
||||||
@@ -208,7 +208,7 @@ wxString wxZipFSHandler::DoFind()
|
|||||||
filename = dir.AfterLast(wxT('/'));
|
filename = dir.AfterLast(wxT('/'));
|
||||||
dir = dir.BeforeLast(wxT('/'));
|
dir = dir.BeforeLast(wxT('/'));
|
||||||
if (!filename.IsEmpty() && m_BaseDir == dir &&
|
if (!filename.IsEmpty() && m_BaseDir == dir &&
|
||||||
wxMatchWild(m_Pattern, filename, FALSE))
|
wxMatchWild(m_Pattern, filename, false))
|
||||||
match = m_ZipFile + wxT("#zip:") + dir + wxT("/") + filename;
|
match = m_ZipFile + wxT("#zip:") + dir + wxT("/") + filename;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -219,7 +219,7 @@ wxString wxZipFSHandler::DoFind()
|
|||||||
filename = namestr.AfterLast(wxT('/'));
|
filename = namestr.AfterLast(wxT('/'));
|
||||||
dir = namestr.BeforeLast(wxT('/'));
|
dir = namestr.BeforeLast(wxT('/'));
|
||||||
if (m_AllowFiles && !filename.IsEmpty() && m_BaseDir == dir &&
|
if (m_AllowFiles && !filename.IsEmpty() && m_BaseDir == dir &&
|
||||||
wxMatchWild(m_Pattern, filename, FALSE))
|
wxMatchWild(m_Pattern, filename, false))
|
||||||
match = m_ZipFile + wxT("#zip:") + namestr;
|
match = m_ZipFile + wxT("#zip:") + namestr;
|
||||||
|
|
||||||
if (unzGoToNextFile((unzFile)m_Archive) != UNZ_OK)
|
if (unzGoToNextFile((unzFile)m_Archive) != UNZ_OK)
|
||||||
|
@@ -69,7 +69,7 @@ static const size_t LEN_CODE = 3;
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFTP, wxProtocol)
|
IMPLEMENT_DYNAMIC_CLASS(wxFTP, wxProtocol)
|
||||||
IMPLEMENT_PROTOCOL(wxFTP, wxT("ftp"), wxT("ftp"), TRUE)
|
IMPLEMENT_PROTOCOL(wxFTP, wxT("ftp"), wxT("ftp"), true)
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
@@ -82,7 +82,7 @@ IMPLEMENT_PROTOCOL(wxFTP, wxT("ftp"), wxT("ftp"), TRUE)
|
|||||||
wxFTP::wxFTP()
|
wxFTP::wxFTP()
|
||||||
{
|
{
|
||||||
m_lastError = wxPROTO_NOERR;
|
m_lastError = wxPROTO_NOERR;
|
||||||
m_streaming = FALSE;
|
m_streaming = false;
|
||||||
m_currentTransfermode = NONE;
|
m_currentTransfermode = NONE;
|
||||||
|
|
||||||
m_user = wxT("anonymous");
|
m_user = wxT("anonymous");
|
||||||
@@ -111,20 +111,20 @@ bool wxFTP::Connect(wxSockAddress& addr, bool WXUNUSED(wait))
|
|||||||
if ( !wxProtocol::Connect(addr) )
|
if ( !wxProtocol::Connect(addr) )
|
||||||
{
|
{
|
||||||
m_lastError = wxPROTO_NETERR;
|
m_lastError = wxPROTO_NETERR;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !m_user )
|
if ( !m_user )
|
||||||
{
|
{
|
||||||
m_lastError = wxPROTO_CONNERR;
|
m_lastError = wxPROTO_CONNERR;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we should have 220 welcome message
|
// we should have 220 welcome message
|
||||||
if ( !CheckResult('2') )
|
if ( !CheckResult('2') )
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString command;
|
wxString command;
|
||||||
@@ -133,23 +133,23 @@ bool wxFTP::Connect(wxSockAddress& addr, bool WXUNUSED(wait))
|
|||||||
if ( rc == '2' )
|
if ( rc == '2' )
|
||||||
{
|
{
|
||||||
// 230 return: user accepted without password
|
// 230 return: user accepted without password
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( rc != '3' )
|
if ( rc != '3' )
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
command.Printf(wxT("PASS %s"), m_passwd.c_str());
|
command.Printf(wxT("PASS %s"), m_passwd.c_str());
|
||||||
if ( !CheckCommand(command, '2') )
|
if ( !CheckCommand(command, '2') )
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFTP::Connect(const wxString& host)
|
bool wxFTP::Connect(const wxString& host)
|
||||||
@@ -166,7 +166,7 @@ bool wxFTP::Close()
|
|||||||
if ( m_streaming )
|
if ( m_streaming )
|
||||||
{
|
{
|
||||||
m_lastError = wxPROTO_STREAMING;
|
m_lastError = wxPROTO_STREAMING;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( IsConnected() )
|
if ( IsConnected() )
|
||||||
@@ -241,9 +241,9 @@ char wxFTP::GetResult()
|
|||||||
// ...
|
// ...
|
||||||
// xyz ...
|
// xyz ...
|
||||||
// and the intermeidate lines may start with xyz or not
|
// and the intermeidate lines may start with xyz or not
|
||||||
bool badReply = FALSE;
|
bool badReply = false;
|
||||||
bool firstLine = TRUE;
|
bool firstLine = true;
|
||||||
bool endOfReply = FALSE;
|
bool endOfReply = false;
|
||||||
while ( !endOfReply && !badReply )
|
while ( !endOfReply && !badReply )
|
||||||
{
|
{
|
||||||
wxString line;
|
wxString line;
|
||||||
@@ -265,7 +265,7 @@ char wxFTP::GetResult()
|
|||||||
{
|
{
|
||||||
if ( firstLine )
|
if ( firstLine )
|
||||||
{
|
{
|
||||||
badReply = TRUE;
|
badReply = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -287,16 +287,16 @@ char wxFTP::GetResult()
|
|||||||
switch ( chMarker )
|
switch ( chMarker )
|
||||||
{
|
{
|
||||||
case _T(' '):
|
case _T(' '):
|
||||||
endOfReply = TRUE;
|
endOfReply = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _T('-'):
|
case _T('-'):
|
||||||
firstLine = FALSE;
|
firstLine = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// unexpected
|
// unexpected
|
||||||
badReply = TRUE;
|
badReply = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // subsequent line of multiline reply
|
else // subsequent line of multiline reply
|
||||||
@@ -305,7 +305,7 @@ char wxFTP::GetResult()
|
|||||||
{
|
{
|
||||||
if ( chMarker == _T(' ') )
|
if ( chMarker == _T(' ') )
|
||||||
{
|
{
|
||||||
endOfReply = TRUE;
|
endOfReply = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogTrace(FTP_TRACE_MASK, _T("<== %s %s"),
|
wxLogTrace(FTP_TRACE_MASK, _T("<== %s %s"),
|
||||||
@@ -344,7 +344,7 @@ bool wxFTP::SetTransferMode(TransferMode transferMode)
|
|||||||
if ( transferMode == m_currentTransfermode )
|
if ( transferMode == m_currentTransfermode )
|
||||||
{
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString mode;
|
wxString mode;
|
||||||
@@ -368,14 +368,14 @@ bool wxFTP::SetTransferMode(TransferMode transferMode)
|
|||||||
wxLogError(_("Failed to set FTP transfer mode to %s."), (const wxChar*)
|
wxLogError(_("Failed to set FTP transfer mode to %s."), (const wxChar*)
|
||||||
(transferMode == ASCII ? _("ASCII") : _("binary")));
|
(transferMode == ASCII ? _("ASCII") : _("binary")));
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we get here the operation has been succesfully completed
|
// If we get here the operation has been succesfully completed
|
||||||
// Set the status-member
|
// Set the status-member
|
||||||
m_currentTransfermode = transferMode;
|
m_currentTransfermode = transferMode;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFTP::DoSimpleCommand(const wxChar *command, const wxString& arg)
|
bool wxFTP::DoSimpleCommand(const wxChar *command, const wxString& arg)
|
||||||
@@ -390,10 +390,10 @@ bool wxFTP::DoSimpleCommand(const wxChar *command, const wxString& arg)
|
|||||||
{
|
{
|
||||||
wxLogDebug(_T("FTP command '%s' failed."), fullcmd.c_str());
|
wxLogDebug(_T("FTP command '%s' failed."), fullcmd.c_str());
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFTP::ChDir(const wxString& dir)
|
bool wxFTP::ChDir(const wxString& dir)
|
||||||
@@ -468,7 +468,7 @@ bool wxFTP::Rename(const wxString& src, const wxString& dst)
|
|||||||
|
|
||||||
str = wxT("RNFR ") + src;
|
str = wxT("RNFR ") + src;
|
||||||
if ( !CheckCommand(str, '3') )
|
if ( !CheckCommand(str, '3') )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
str = wxT("RNTO ") + dst;
|
str = wxT("RNTO ") + dst;
|
||||||
|
|
||||||
@@ -512,7 +512,7 @@ public:
|
|||||||
// wait for "226 transfer completed"
|
// wait for "226 transfer completed"
|
||||||
m_ftp->CheckResult('2');
|
m_ftp->CheckResult('2');
|
||||||
|
|
||||||
m_ftp->m_streaming = FALSE;
|
m_ftp->m_streaming = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -547,7 +547,7 @@ public:
|
|||||||
// read this reply
|
// read this reply
|
||||||
m_ftp->CheckResult('2');
|
m_ftp->CheckResult('2');
|
||||||
|
|
||||||
m_ftp->m_streaming = FALSE;
|
m_ftp->m_streaming = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -613,7 +613,7 @@ wxSocketClient *wxFTP::GetPort()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
client->Notify(FALSE);
|
client->Notify(false);
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
@@ -621,11 +621,11 @@ wxSocketClient *wxFTP::GetPort()
|
|||||||
bool wxFTP::Abort()
|
bool wxFTP::Abort()
|
||||||
{
|
{
|
||||||
if ( !m_streaming )
|
if ( !m_streaming )
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
m_streaming = FALSE;
|
m_streaming = false;
|
||||||
if ( !CheckCommand(wxT("ABOR"), '4') )
|
if ( !CheckCommand(wxT("ABOR"), '4') )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
return CheckResult('2');
|
return CheckResult('2');
|
||||||
}
|
}
|
||||||
@@ -650,7 +650,7 @@ wxInputStream *wxFTP::GetInputStream(const wxString& path)
|
|||||||
if ( !CheckCommand(tmp_str, '1') )
|
if ( !CheckCommand(tmp_str, '1') )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
m_streaming = TRUE;
|
m_streaming = true;
|
||||||
|
|
||||||
in_stream = new wxInputFTPStream(this, sock);
|
in_stream = new wxInputFTPStream(this, sock);
|
||||||
|
|
||||||
@@ -678,7 +678,7 @@ wxOutputStream *wxFTP::GetOutputStream(const wxString& path)
|
|||||||
if ( !CheckCommand(tmp_str, '1') )
|
if ( !CheckCommand(tmp_str, '1') )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
m_streaming = TRUE;
|
m_streaming = true;
|
||||||
|
|
||||||
return new wxOutputFTPStream(this, sock);
|
return new wxOutputFTPStream(this, sock);
|
||||||
}
|
}
|
||||||
@@ -693,7 +693,7 @@ bool wxFTP::GetList(wxArrayString& files,
|
|||||||
{
|
{
|
||||||
wxSocketBase *sock = GetPort();
|
wxSocketBase *sock = GetPort();
|
||||||
if (!sock)
|
if (!sock)
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// NLST : List of Filenames (including Directory's !)
|
// NLST : List of Filenames (including Directory's !)
|
||||||
// LIST : depending on BS of FTP-Server
|
// LIST : depending on BS of FTP-Server
|
||||||
@@ -701,14 +701,14 @@ bool wxFTP::GetList(wxArrayString& files,
|
|||||||
// - Windows : like "dir" command
|
// - Windows : like "dir" command
|
||||||
// - others : ?
|
// - others : ?
|
||||||
wxString line(details ? _T("LIST") : _T("NLST"));
|
wxString line(details ? _T("LIST") : _T("NLST"));
|
||||||
if ( !!wildcard )
|
if ( !wildcard.IsEmpty() )
|
||||||
{
|
{
|
||||||
line << _T(' ') << wildcard;
|
line << _T(' ') << wildcard;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CheckCommand(line, '1'))
|
if (!CheckCommand(line, '1'))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
files.Empty();
|
files.Empty();
|
||||||
while ( ReadLine(sock, line) == wxPROTO_NOERR )
|
while ( ReadLine(sock, line) == wxPROTO_NOERR )
|
||||||
@@ -719,9 +719,9 @@ bool wxFTP::GetList(wxArrayString& files,
|
|||||||
|
|
||||||
// the file list should be terminated by "226 Transfer complete""
|
// the file list should be terminated by "226 Transfer complete""
|
||||||
if ( !CheckResult('2') )
|
if ( !CheckResult('2') )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFTP::FileExists(const wxString& fileName)
|
bool wxFTP::FileExists(const wxString& fileName)
|
||||||
@@ -730,10 +730,10 @@ bool wxFTP::FileExists(const wxString& fileName)
|
|||||||
// current dir. It does so by simply doing an NLST (via GetList).
|
// current dir. It does so by simply doing an NLST (via GetList).
|
||||||
// If this succeeds (and the list is not empty) the file exists.
|
// If this succeeds (and the list is not empty) the file exists.
|
||||||
|
|
||||||
bool retval = FALSE;
|
bool retval = false;
|
||||||
wxArrayString fileList;
|
wxArrayString fileList;
|
||||||
|
|
||||||
if ( GetList(fileList, fileName, FALSE) )
|
if ( GetList(fileList, fileName, false) )
|
||||||
{
|
{
|
||||||
// Some ftp-servers (Ipswitch WS_FTP Server 1.0.5 does this)
|
// Some ftp-servers (Ipswitch WS_FTP Server 1.0.5 does this)
|
||||||
// displays this behaviour when queried on a non-existing file:
|
// displays this behaviour when queried on a non-existing file:
|
||||||
@@ -787,13 +787,13 @@ int wxFTP::GetFileSize(const wxString& fileName)
|
|||||||
&statuscode, &filesize) == 2 )
|
&statuscode, &filesize) == 2 )
|
||||||
{
|
{
|
||||||
// We've gotten a good reply.
|
// We've gotten a good reply.
|
||||||
ok = TRUE;
|
ok = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Something bad happened.. A "2yz" reply with no size
|
// Something bad happened.. A "2yz" reply with no size
|
||||||
// Fallback
|
// Fallback
|
||||||
ok = FALSE;
|
ok = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -813,7 +813,7 @@ int wxFTP::GetFileSize(const wxString& fileName)
|
|||||||
// We now try to get details for the file with a "LIST"-command
|
// We now try to get details for the file with a "LIST"-command
|
||||||
// and then parse the output from there..
|
// and then parse the output from there..
|
||||||
wxArrayString fileList;
|
wxArrayString fileList;
|
||||||
if ( GetList(fileList, fileName, TRUE) )
|
if ( GetList(fileList, fileName, true) )
|
||||||
{
|
{
|
||||||
if ( !fileList.IsEmpty() )
|
if ( !fileList.IsEmpty() )
|
||||||
{
|
{
|
||||||
@@ -822,7 +822,7 @@ int wxFTP::GetFileSize(const wxString& fileName)
|
|||||||
// substring containing the name we are looking for. We
|
// substring containing the name we are looking for. We
|
||||||
// stop the iteration at the first occurrence of the
|
// stop the iteration at the first occurrence of the
|
||||||
// filename. The search is not case-sensitive.
|
// filename. The search is not case-sensitive.
|
||||||
bool foundIt = FALSE;
|
bool foundIt = false;
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
for ( i = 0; !foundIt && i < fileList.Count(); i++ )
|
for ( i = 0; !foundIt && i < fileList.Count(); i++ )
|
||||||
|
Reference in New Issue
Block a user