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();
|
||||||
|
|
||||||
|
@@ -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
|
||||||
|
@@ -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,9 +316,9 @@ 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?
|
||||||
@@ -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:
|
||||||
|
@@ -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;}
|
||||||
|
|
||||||
|
@@ -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; }
|
||||||
|
@@ -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;
|
||||||
|
@@ -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,7 +681,7 @@ 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__
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1024,11 +1024,11 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, wxString& targe
|
|||||||
|
|
||||||
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
|
// create a ShellLink object
|
||||||
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
||||||
|
@@ -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;
|
||||||
|
@@ -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;
|
||||||
|
@@ -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) )
|
||||||
{
|
{
|
||||||
|
@@ -91,7 +91,7 @@ bool wxInternetFSHandler::CanOpen(const wxString& location)
|
|||||||
return (url.GetError() == wxURL_NOERR);
|
return (url.GetError() == wxURL_NOERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -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() {}
|
||||||
};
|
};
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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