#define EVT_FIND(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( \
- wxEVT_COMMAND_FIND, id, -1, \
+ wxEVT_COMMAND_FIND, id, wxID_ANY, \
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
& fn, \
(wxObject *) NULL \
#define EVT_FIND_NEXT(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( \
- wxEVT_COMMAND_FIND_NEXT, id, -1, \
+ wxEVT_COMMAND_FIND_NEXT, id, wxID_ANY, \
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
& fn, \
(wxObject *) NULL \
#define EVT_FIND_REPLACE(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( \
- wxEVT_COMMAND_FIND_REPLACE, id, -1, \
+ wxEVT_COMMAND_FIND_REPLACE, id, wxID_ANY, \
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
& fn, \
(wxObject *) NULL \
#define EVT_FIND_REPLACE_ALL(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( \
- wxEVT_COMMAND_FIND_REPLACE_ALL, id, -1, \
+ wxEVT_COMMAND_FIND_REPLACE_ALL, id, wxID_ANY, \
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
& fn, \
(wxObject *) NULL \
#define EVT_FIND_CLOSE(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( \
- wxEVT_COMMAND_FIND_CLOSE, id, -1, \
+ wxEVT_COMMAND_FIND_CLOSE, id, wxID_ANY, \
(wxObjectEventFunction)(wxEventFunction)(wxFindDialogEventFunction) \
& fn, \
(wxObject *) NULL \
in the entries it reads: for example, if you have an entry
score_file = $HOME/.score
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
IsExpandingEnvVars function).
*/
virtual bool GetFirstEntry(wxString& str, long& lIndex) const;
virtual bool GetNextEntry (wxString& str, long& lIndex) const;
- virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const;
- virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const;
+ virtual size_t GetNumberOfEntries(bool bRecursive = false) const;
+ virtual size_t GetNumberOfGroups(bool bRecursive = false) const;
virtual bool HasGroup(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 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 DeleteAll();
*m_pCurrentGroup; // the current group
wxMBConv &m_conv;
-
+
#ifdef __UNIX__
int m_umask; // the umask to use for file creation
#endif // __UNIX__
#endif
// wxUSE_CONFIG
-#endif
+#endif
//_FILECONF_H
const wxChar *wildcard = wxFileSelectorDefaultWildcardStr,
int flags = 0,
wxWindow *parent = NULL,
- int x = -1, int y = -1);
+ int x = wxDefaultCoord, int y = wxDefaultCoord);
// An extended version of wxFileSelector
WXDLLEXPORT wxString
const wxChar *wildcard = wxFileSelectorDefaultWildcardStr,
int flags = 0,
wxWindow *parent = NULL,
- int x = -1, int y = -1);
+ int x = wxDefaultCoord, int y = wxDefaultCoord);
// Ask for filename to load
WXDLLEXPORT wxString
#if wxUSE_UNICODE
#if wxUSE_UNICODE_MSLU
#define wxOpen wxMSLU__wopen
-
+
#define wxAccess wxMSLU__waccess
#define wxMkDir wxMSLU__wmkdir
#define wxRmDir wxMSLU__wrmdir
#define wxTell(fd) lseek(fd, 0, SEEK_CUR)
#define wxStructStat struct stat
-
+
#if wxUSE_UNICODE
# define wxNEED_WX_UNISTD_H
#if defined(__MWERKS__) && defined(macintosh)
- #include <sys/stat.h>
+ #include <sys/stat.h>
#endif
#if defined(__DMC__)
typedef unsigned long mode_t;
WXDLLIMPEXP_BASE bool wxIsWild(const wxString& pattern);
// 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)
-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
WXDLLIMPEXP_BASE bool wxConcatFiles(const wxString& file1, const wxString& file2, const wxString& file3);
// Copy file1 to file2
WXDLLIMPEXP_BASE bool wxCopyFile(const wxString& file1, const wxString& file2,
- bool overwrite = TRUE);
+ bool overwrite = true);
// Remove file
WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file);
// this is useful for wxString::IsSameAs(): to compare two file names use
// filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE)
#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
- #define wxARE_FILENAMES_CASE_SENSITIVE FALSE
+ #define wxARE_FILENAMES_CASE_SENSITIVE false
#endif // Unix/Windows
// is the char a path separator?
inline bool wxIsPathSeparator(wxChar c)
{
// 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;
#else
return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX;
wxString FindAbsoluteValidPath(const wxString& filename);
// Given full path and filename, add path to list
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);
private:
// is the filename valid at all?
bool IsOk() const
- {
+ {
// 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;
}
public:
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;
// opens given file and returns pointer to input stream.
// sets the current location. Every call to OpenFile is
// relative to this location.
// 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
// (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;}
/////////////////////////////////////////////////////////////////////////////
// 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
-// Modified by:
+// Modified by:
// Created: 27/07/03
// RCS-ID: $Id$
// Copyright: (c) 2003 Stefan Csomor
// bitwise operators but keeps the type safety and information, the
// enums must be in a sequence , their value determines the bit position
// 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
{
- friend class wxEnumData ;
+ friend class wxEnumData ;
public:
// creates a wxBitset<> object with all flags initialized to 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
wxBitset(unsigned long val) { m_data = val ; }
// assignment
wxBitset &operator =(const wxBitset &rhs)
{
- m_data = rhs.m_data;
- return *this;
+ m_data = rhs.m_data;
+ return *this;
}
// bitwise or operator, sets all bits that are in rhs and leaves
// the rest unchanged
- wxBitset &operator |=(const wxBitset &rhs)
+ wxBitset &operator |=(const wxBitset &rhs)
{
- m_data |= rhs.m_data;
- return *this;
+ m_data |= rhs.m_data;
+ return *this;
}
// bitwsie exclusive-or operator, toggles the value of all bits
// that are set in bits and leaves all others unchanged
wxBitset &operator ^=(const wxBitset &rhs) // difference
{
- m_data ^= rhs.m_data;
- return *this;
+ m_data ^= rhs.m_data;
+ return *this;
}
// bitwise and operator, resets all bits that are not in rhs and leaves
// all others unchanged
wxBitset &operator &=(const wxBitset &rhs) // intersection
{
- m_data &= rhs.m_data;
- return *this;
+ m_data &= rhs.m_data;
+ 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
- wxBitset operator |(const wxBitset &bitset2) const // union
+ wxBitset operator |(const wxBitset &bitset2) const // union
{
- wxBitset<T> s;
- s.m_data = m_data | bitset2.m_data;
- return s;
+ wxBitset<T> s;
+ s.m_data = m_data | bitset2.m_data;
+ 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
wxBitset operator ^(const wxBitset &bitset2) const // difference
{
- wxBitset<T> s;
- s.m_data = m_data ^ bitset2.m_data;
- return s;
+ wxBitset<T> s;
+ s.m_data = m_data ^ bitset2.m_data;
+ 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
wxBitset operator &(const wxBitset &bitset2) const // intersection
{
- wxBitset<T> s;
- s.m_data = m_data & bitset2.m_data;
- return s;
+ wxBitset<T> s;
+ s.m_data = m_data & bitset2.m_data;
+ return s;
}
// sets appropriate the bit to true
wxBitset& set(const T el) //Add element
{
- m_data |= 1 << el;
- return *this;
+ m_data |= 1 << el;
+ return *this;
}
-
+
// clears the appropriate flag to false
wxBitset& reset(const T el) //remove element
{
- m_data &= ~(1 << el);
- return *this;
+ m_data &= ~(1 << el);
+ return *this;
}
// clear all flags
wxBitset& reset()
{
- m_data = 0;
- return *this;
+ m_data = 0;
+ return *this;
}
// true if this flag is set
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
bool none() const
{
- return m_data == 0;
+ return m_data == 0;
}
// true if any flag is set
bool any() const
{
- return m_data != 0;
+ return m_data != 0;
}
// true if both have the same flags
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
bool operator !=(const wxBitset &rhs) const
{
- return !operator==(rhs);
+ return !operator==(rhs);
}
bool operator[] (const T el) const { return test(el) ; }
private :
- unsigned long m_data;
+ unsigned long m_data;
};
#define WX_DEFINE_FLAGS( flags ) \
int family, // see wxFontFamily enum
int style, // see wxFontStyle 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
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ...
wxString GetWeightString() const;
// Unofficial API, don't use
- virtual void SetNoAntiAliasing( bool WXUNUSED(no) = TRUE ) { }
- virtual bool GetNoAntiAliasing() const { return FALSE; }
+ virtual void SetNoAntiAliasing( bool WXUNUSED(no) = true ) { }
+ virtual bool GetNoAntiAliasing() const { return false; }
// the default encoding is used for creating all fonts with default
// encoding parameter
{ InitFontData(data); return Create(parent); }
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)
{ if ( data ) m_fontData = *data; }
wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding
wxFONTENCODING_MACROMAN, // the standard mac encodings
- wxFONTENCODING_MACJAPANESE,
- wxFONTENCODING_MACCHINESETRAD,
- wxFONTENCODING_MACKOREAN,
- wxFONTENCODING_MACARABIC,
- wxFONTENCODING_MACHEBREW,
- wxFONTENCODING_MACGREEK,
- wxFONTENCODING_MACCYRILLIC,
- wxFONTENCODING_MACDEVANAGARI,
- wxFONTENCODING_MACGURMUKHI,
- wxFONTENCODING_MACGUJARATI,
- wxFONTENCODING_MACORIYA,
- wxFONTENCODING_MACBENGALI,
- wxFONTENCODING_MACTAMIL,
- wxFONTENCODING_MACTELUGU,
- wxFONTENCODING_MACKANNADA,
- wxFONTENCODING_MACMALAJALAM,
- wxFONTENCODING_MACSINHALESE,
- wxFONTENCODING_MACBURMESE,
- wxFONTENCODING_MACKHMER,
- wxFONTENCODING_MACTHAI,
- wxFONTENCODING_MACLAOTIAN,
- wxFONTENCODING_MACGEORGIAN,
- wxFONTENCODING_MACARMENIAN,
- wxFONTENCODING_MACCHINESESIMP,
- wxFONTENCODING_MACTIBETAN,
- wxFONTENCODING_MACMONGOLIAN,
- wxFONTENCODING_MACETHIOPIC,
- wxFONTENCODING_MACCENTRALEUR,
- wxFONTENCODING_MACVIATNAMESE,
- wxFONTENCODING_MACARABICEXT,
- wxFONTENCODING_MACSYMBOL,
- wxFONTENCODING_MACDINGBATS,
- wxFONTENCODING_MACTURKISH,
- wxFONTENCODING_MACCROATIAN,
- wxFONTENCODING_MACICELANDIC,
- wxFONTENCODING_MACROMANIAN,
- wxFONTENCODING_MACCELTIC,
- wxFONTENCODING_MACGAELIC,
- wxFONTENCODING_MACKEYBOARD,
+ wxFONTENCODING_MACJAPANESE,
+ wxFONTENCODING_MACCHINESETRAD,
+ wxFONTENCODING_MACKOREAN,
+ wxFONTENCODING_MACARABIC,
+ wxFONTENCODING_MACHEBREW,
+ wxFONTENCODING_MACGREEK,
+ wxFONTENCODING_MACCYRILLIC,
+ wxFONTENCODING_MACDEVANAGARI,
+ wxFONTENCODING_MACGURMUKHI,
+ wxFONTENCODING_MACGUJARATI,
+ wxFONTENCODING_MACORIYA,
+ wxFONTENCODING_MACBENGALI,
+ wxFONTENCODING_MACTAMIL,
+ wxFONTENCODING_MACTELUGU,
+ wxFONTENCODING_MACKANNADA,
+ wxFONTENCODING_MACMALAJALAM,
+ wxFONTENCODING_MACSINHALESE,
+ wxFONTENCODING_MACBURMESE,
+ wxFONTENCODING_MACKHMER,
+ wxFONTENCODING_MACTHAI,
+ wxFONTENCODING_MACLAOTIAN,
+ wxFONTENCODING_MACGEORGIAN,
+ wxFONTENCODING_MACARMENIAN,
+ wxFONTENCODING_MACCHINESESIMP,
+ wxFONTENCODING_MACTIBETAN,
+ wxFONTENCODING_MACMONGOLIAN,
+ wxFONTENCODING_MACETHIOPIC,
+ wxFONTENCODING_MACCENTRALEUR,
+ wxFONTENCODING_MACVIATNAMESE,
+ wxFONTENCODING_MACARABICEXT,
+ wxFONTENCODING_MACSYMBOL,
+ wxFONTENCODING_MACDINGBATS,
+ wxFONTENCODING_MACTURKISH,
+ wxFONTENCODING_MACCROATIAN,
+ wxFONTENCODING_MACICELANDIC,
+ wxFONTENCODING_MACROMANIAN,
+ wxFONTENCODING_MACCELTIC,
+ wxFONTENCODING_MACGAELIC,
+ wxFONTENCODING_MACKEYBOARD,
wxFONTENCODING_MAX, // highest enumerated encoding value
wxFONTENCODING_MACMIN = wxFONTENCODING_MACROMAN ,
wxFONTENCODING_MACMAX = wxFONTENCODING_MACKEYBOARD ,
-
+
// aliases for endian-dependent UTF encodings
#ifdef WORDS_BIGENDIAN
wxFONTENCODING_UTF16 = wxFONTENCODING_UTF16BE, // native UTF-16
inline bool HasElements() const;
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);
// return false if we were never initialized with a valid XLFD
// ----------------------------------------------------------------------------
// 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)
extern bool wxGetNativeFontEncoding(wxFontEncoding encoding,
wxNativeEncodingInfo *info);
// 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);
// ----------------------------------------------------------------------------
virtual wxMenuBar *GetMenuBar() const { return m_frameMenuBar; }
#endif // wxUSE_MENUS
- // process menu command: returns TRUE if processed
+ // process menu command: returns true if processed
bool ProcessCommand(int winid);
// status bar functions
#if wxUSE_TOOLBAR
// create main toolbar bycalling OnCreateToolBar()
virtual wxToolBar* CreateToolBar(long style = -1,
- wxWindowID winid = -1,
+ wxWindowID winid = wxID_ANY,
const wxString& name = wxToolBarNameStr);
// return a new toolbar
virtual wxToolBar *OnCreateToolBar(long style,
#ifndef wxTopLevelWindowNative
virtual bool ShowFullScreen(bool WXUNUSED(show),
long WXUNUSED(style) = wxFULLSCREEN_ALL)
- { return FALSE; }
+ { return false; }
virtual bool IsFullScreen() const
- { return FALSE; }
+ { return false; }
#endif // no wxTopLevelWindowNative
- // show help text (typically in the statusbar); show is FALSE
- // if you are hiding the help, TRUE otherwise
+ // show help text (typically in the statusbar); show is false
+ // if you are hiding the help, true otherwise
virtual void DoGiveHelp(const wxString& text, bool show);
#if WXWIN_COMPATIBILITY_2_2
virtual void PositionStatusBar() { }
// 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);
wxStatusBar *m_frameStatusBar;
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__)
// 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
// units (as created by e.g. event.cpp compiled for
// libwx_base and event.cpp compiled for libwx_gui_core).
m_FindReplaceData->m_Flags = event.GetFlags();
m_FindReplaceData->m_FindWhat = event.GetFindString();
- if ( HasFlag(wxFR_REPLACEDIALOG) &&
- (event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE ||
+ if ( HasFlag(wxFR_REPLACEDIALOG) &&
+ (event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE ||
event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL) )
{
m_FindReplaceData->m_ReplaceWith = event.GetReplaceString();
{
wxLogSysError(_("can't open file '%s'"), filename);
- return FALSE;
+ return false;
}
m_name = filename;
- return TRUE;
+ return true;
}
bool wxFFile::Close()
{
wxLogSysError(_("can't close file '%s'"), m_name.c_str());
- return FALSE;
+ return false;
}
Detach();
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
bool wxFFile::ReadAll(wxString *str)
{
- wxCHECK_MSG( str, FALSE, wxT("invalid parameter") );
- wxCHECK_MSG( IsOpened(), FALSE, wxT("can't read from closed file") );
+ wxCHECK_MSG( str, false, wxT("invalid parameter") );
+ wxCHECK_MSG( IsOpened(), false, wxT("can't read from closed file") );
clearerr(m_fp);
{
wxLogSysError(_("Read error on file '%s'"), m_name.c_str());
- return FALSE;
+ return false;
}
//else: just EOF
*str += buf;
}
- return TRUE;
+ return true;
}
size_t wxFFile::Read(void *pBuf, size_t nCount)
{
wxLogSysError(_("failed to flush the file '%s'"), m_name.c_str());
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
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;
switch ( mode )
{
wxLogSysError(_("Seek error on file '%s'"), m_name.c_str());
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
size_t wxFFile::Tell() const
#ifdef __WXWINCE__
// FIXME: use CreateFile with 0 access to query the file
- return TRUE;
+ return true;
#else
return wxAccess(name, how) == 0;
#endif
wxFile::wxFile(const wxChar *szFileName, OpenMode mode)
{
m_fd = fd_invalid;
- m_error = FALSE;
+ m_error = false;
Open(szFileName, mode);
}
if ( fd == -1 )
{
wxLogSysError(_("can't create file '%s'"), szFileName);
- return FALSE;
+ return false;
}
else
{
Attach(fd);
- return TRUE;
+ return true;
}
}
if ( fd == -1 )
{
wxLogSysError(_("can't open file '%s'"), szFileName);
- return FALSE;
+ return false;
}
else {
Attach(fd);
- return TRUE;
+ return true;
}
}
{
wxLogSysError(_("can't close file descriptor %d"), m_fd);
m_fd = fd_invalid;
- return FALSE;
+ return false;
}
else
m_fd = fd_invalid;
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
#endif
if ( iRc == -1 ) {
wxLogSysError(_("can't write to file descriptor %d"), m_fd);
- m_error = TRUE;
+ m_error = true;
return 0;
}
else
if ( wxFsync(m_fd) == -1 )
{
wxLogSysError(_("can't flush file descriptor %d"), m_fd);
- return FALSE;
+ return false;
}
#else // no fsync
// just do nothing
#endif // fsync
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
DWORD off0 = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_CURRENT);
DWORD off1 = SetFilePointer((HANDLE) m_fd, 0, 0, FILE_END);
if (off0 == off1)
- return TRUE;
+ return true;
else
{
SetFilePointer((HANDLE) m_fd, off0, 0, FILE_BEGIN);
- return FALSE;
+ return false;
}
#else
int iRc;
break;
case 0:
- return FALSE;
+ return false;
case -1:
wxLogSysError(_("can't determine if the end of file is reached on descriptor %d"), m_fd);
wxFAIL_MSG(_("invalid eof() return value."));
}
- return TRUE;
+ return true;
#endif
}
if ( m_strTemp.empty() )
{
// CreateTempFileName() failed
- return FALSE;
+ return false;
}
#ifdef __UNIX__
// the temp file should have the same permissions as the original one
mode_t mode;
-
+
wxStructStat st;
if ( stat( (const char*) m_strName.fn_str(), &st) == 0 )
{
}
#endif // Unix
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
if ( wxFile::Exists(m_strName) && wxRemove(m_strName) != 0 ) {
wxLogSysError(_("can't remove file '%s'"), m_strName.c_str());
- return FALSE;
+ return false;
}
if ( !wxRenameFile(m_strTemp, m_strName) ) {
wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str());
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
void wxTempFile::Discard()
GetLine() const { return m_pLine; }
// modify entry attributes
- void SetValue(const wxString& strValue, bool bUser = TRUE);
+ void SetValue(const wxString& strValue, bool bUser = true);
void SetDirty();
void SetLine(wxFileConfigLineList *pLine);
ArrayEntries m_aEntries; // entries in this group
ArrayGroups m_aSubgroups; // subgroups
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
wxFileConfigEntry *m_pLastEntry; // last entry/subgroup of this group in the
wxFileConfigGroup *m_pLastGroup; // local file (we insert new ones after it)
wxFileConfigGroup *FindSubgroup(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 DeleteEntry(const wxChar *szName);
strDir.Printf(wxT("%c:\\OS2\\"), 'A'+drive-1);
}
#elif defined(__WXSTUBS__)
- wxASSERT_MSG( FALSE, wxT("TODO") ) ;
+ wxASSERT_MSG( false, wxT("TODO") ) ;
#elif defined(__DOS__)
// There's no such thing as global cfg dir in MS-DOS, let's return
// current directory (FIXME_MGL?)
if ( fileGlobal.Open(m_conv/*ignored in ANSI build*/) )
{
- Parse(fileGlobal, FALSE /* global */);
+ Parse(fileGlobal, false /* global */);
SetRootPath();
}
else
wxTextFile fileLocal(m_strLocalFile);
if ( fileLocal.Open(m_conv/*ignored in ANSI build*/) )
{
- Parse(fileLocal, TRUE /* local */);
+ Parse(fileLocal, true /* local */);
SetRootPath();
}
else
memText.AddLine(strTrans);
// Finally we can parse it all.
- Parse(memText, TRUE /* local */);
+ Parse(memText, true /* local */);
SetRootPath();
}
}
// check that there is nothing except comments left on this line
- bool bCont = TRUE;
+ bool bCont = true;
while ( *++pEnd != wxT('\0') && bCont ) {
switch ( *pEnd ) {
case wxT('#'):
case wxT(';'):
- bCont = FALSE;
+ bCont = false;
break;
case wxT(' '):
default:
wxLogWarning(_("file '%s', line %d: '%s' ignored after group header."),
buffer.GetName(), n + 1, pEnd);
- bCont = FALSE;
+ bCont = false;
}
}
}
if ( !(GetStyle() & wxCONFIG_USE_NO_ESCAPE_CHARACTERS) )
value = FilterInValue(value);
- pEntry->SetValue(value, FALSE);
+ pEntry->SetValue(value, false);
}
}
}
{
if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) {
str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name();
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const
{
if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) {
str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name();
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
size_t wxFileConfig::GetNumberOfEntries(bool bRecursive) const
size_t nSubgroups = m_pCurrentGroup->Groups().Count();
for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
- n += GetNumberOfEntries(TRUE);
+ n += GetNumberOfEntries(true);
CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
}
}
size_t nSubgroups = m_pCurrentGroup->Groups().Count();
for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
- n += GetNumberOfGroups(TRUE);
+ n += GetNumberOfGroups(true);
CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
}
}
wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name());
if (pEntry == NULL) {
- return FALSE;
+ return false;
}
*pStr = pEntry->Value();
- return TRUE;
+ return true;
}
bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const
{
wxString str;
if ( !Read(key, &str) )
- return FALSE;
+ return false;
// extra spaces shouldn't prevent us from reading numeric values
str.Trim();
{
wxLogError( _("Config entry name cannot start with '%c'."),
wxCONFIG_IMMUTABLE_PREFIX);
- return FALSE;
+ return false;
}
wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(strName);
pEntry->SetValue(szValue);
}
- return TRUE;
+ return true;
}
bool wxFileConfig::DoWriteLong(const wxString& key, long lValue)
bool wxFileConfig::Flush(bool /* bCurrentOnly */)
{
if ( LineListIsEmpty() || !m_pRootGroup->IsDirty() || !m_strLocalFile )
- return TRUE;
+ return true;
#ifdef __UNIX__
// set the umask if needed
if ( !file.IsOpened() )
{
wxLogError(_("can't open user configuration file."));
- return FALSE;
+ return false;
}
// write all strings to file
if ( !file.Write(line, m_conv) )
{
wxLogError(_("can't write user configuration file."));
- return FALSE;
+ return false;
}
}
{
FSRef fsRef ;
FSCatalogInfo catInfo;
- FileInfo *finfo ;
-
- if ( wxMacPathToFSRef( m_strLocalFile , &fsRef ) == noErr )
- {
- if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
- {
- finfo = (FileInfo*)&catInfo.finderInfo;
- finfo->fileType = 'TEXT' ;
- finfo->fileCreator = 'ttxt' ;
- FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ;
- }
- }
+ FileInfo *finfo ;
+
+ if ( wxMacPathToFSRef( m_strLocalFile , &fsRef ) == noErr )
+ {
+ if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
+ {
+ finfo = (FileInfo*)&catInfo.finderInfo;
+ finfo->fileType = 'TEXT' ;
+ finfo->fileCreator = 'ttxt' ;
+ FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ;
+ }
+ }
}
#endif // __WXMAC__
// check that the entry exists
wxFileConfigEntry *oldEntry = m_pCurrentGroup->FindEntry(oldName);
if ( !oldEntry )
- return FALSE;
+ return false;
// check that the new entry doesn't already exist
if ( m_pCurrentGroup->FindEntry(newName) )
- return FALSE;
+ return false;
// delete the old entry, create the new one
wxString value = oldEntry->Value();
if ( !m_pCurrentGroup->DeleteEntry(oldName) )
- return FALSE;
+ return false;
wxFileConfigEntry *newEntry = m_pCurrentGroup->AddEntry(newName);
newEntry->SetValue(value);
- return TRUE;
+ return true;
}
bool wxFileConfig::RenameGroup(const wxString& oldName,
// check that the group exists
wxFileConfigGroup *group = m_pCurrentGroup->FindSubgroup(oldName);
if ( !group )
- return FALSE;
+ return false;
// check that the new group doesn't already exist
if ( m_pCurrentGroup->FindSubgroup(newName) )
- return FALSE;
+ return false;
group->Rename(newName);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
wxConfigPathChanger path(this, key);
if ( !m_pCurrentGroup->DeleteEntry(path.Name()) )
- return FALSE;
+ return false;
if ( bGroupIfEmptyAlso && m_pCurrentGroup->IsEmpty() ) {
if ( m_pCurrentGroup != m_pRootGroup ) {
//else: never delete the root group
}
- return TRUE;
+ return true;
}
bool wxFileConfig::DeleteGroup(const wxString& key)
if ( wxFile::Exists(m_strLocalFile) && wxRemove(m_strLocalFile) == -1 )
{
wxLogSysError(_("can't delete user configuration file '%s'"), m_strLocalFile.c_str());
- return FALSE;
+ return false;
}
m_strLocalFile = m_strGlobalFile = wxT("");
Init();
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
m_pConfig = pConfig;
m_pParent = pParent;
- m_bDirty = FALSE;
+ m_bDirty = false;
m_pLine = NULL;
m_pLastEntry = NULL;
{
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
// other data structures.
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"),
_T("Deleting group '%s' from '%s'"),
m_aSubgroups.Remove(pGroup);
delete pGroup;
- return TRUE;
+ return true;
}
bool wxFileConfigGroup::DeleteEntry(const wxChar *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();
if ( pLine != NULL ) {
m_aEntries.Remove(pEntry);
delete pEntry;
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void wxFileConfigGroup::SetDirty()
{
- m_bDirty = TRUE;
+ m_bDirty = true;
if ( Parent() != NULL ) // propagate upwards
Parent()->SetDirty();
}
m_pLine = NULL;
m_bDirty =
- m_bHasValue = FALSE;
+ m_bHasValue = false;
m_bImmutable = strName[0] == wxCONFIG_IMMUTABLE_PREFIX;
if ( m_bImmutable )
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'
void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser)
{
if ( m_bHasValue && strValue == m_strValue )
return;
- m_bHasValue = TRUE;
+ m_bHasValue = true;
m_strValue = strValue;
if ( bUser )
void wxFileConfigEntry::SetDirty()
{
- m_bDirty = TRUE;
+ m_bDirty = true;
Group()->SetDirty();
}
//
// NB: note that wxCONFIG_IMMUTABLE_PREFIX and wxCONFIG_PATH_SEPARATOR
// should *not* be quoted
- if (
+ if (
#if !wxUSE_UNICODE
((unsigned char)c < 127) &&
#endif // ANSI
trimchars[3] = 0;
#ifdef __WXMSW__
- const wxChar SEP = wxT('\\');
+ const wxChar SEP = wxT('\\');
#else
- const wxChar SEP = wxT('/');
+ const wxChar SEP = wxT('/');
#endif
buf[0] = wxT('\0');
if (name == NULL || *name == wxT('\0'))
#define kDefaultPathStyle kCFURLHFSPathStyle
#endif
-wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent )
+wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent )
{
- CFURLRef fullURLRef;
+ CFURLRef fullURLRef;
fullURLRef = CFURLCreateFromFSRef(NULL, fsRef);
if ( additionalPathComponent )
{
additionalPathComponent,false);
CFRelease( parentURLRef ) ;
}
- CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, kDefaultPathStyle);
- CFRelease( fullURLRef ) ;
- return wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding());
+ CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, kDefaultPathStyle);
+ CFRelease( fullURLRef ) ;
+ return wxMacCFStringHolder(cfString).AsString(wxLocale::GetSystemEncoding());
}
-OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef )
+OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef )
{
OSStatus err = noErr ;
- CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, wxMacCFStringHolder(path ,wxLocale::GetSystemEncoding() ) , kDefaultPathStyle, false);
- if ( NULL != url )
- {
- if ( CFURLGetFSRef(url, fsRef) == false )
- err = fnfErr ;
+ CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, wxMacCFStringHolder(path ,wxLocale::GetSystemEncoding() ) , kDefaultPathStyle, false);
+ if ( NULL != url )
+ {
+ if ( CFURLGetFSRef(url, fsRef) == false )
+ err = fnfErr ;
CFRelease( url ) ;
}
else
return err ;
}
-wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname )
+wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname )
{
CFStringRef cfname = CFStringCreateWithCharacters( kCFAllocatorDefault,
uniname->unicode,
if ( getcwd( lbuf , sizeof( lbuf ) ) )
{
wxString res( lbuf , *wxConvCurrent ) ;
- wxStrcpy( buf , res ) ;
+ wxStrcpy( buf , res ) ;
ok = true;
}
else
APIRET rc;
ULONG ulDriveNum = 0;
ULONG ulDriveMap = 0;
- rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
+ rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
ok = rc == 0;
- if (ok)
- {
- sz -= 3;
- rc = ::DosQueryCurrentDir( 0 // current drive
+ if (ok)
+ {
+ sz -= 3;
+ rc = ::DosQueryCurrentDir( 0 // current drive
,cbuf + 3
,(PULONG)&sz
);
#elif defined(__UNIX__) || defined(__WXMAC__) || defined(__DOS__)
return (chdir(wxFNSTRINGCAST d.fn_str()) == 0);
#elif defined(__WINDOWS__)
-
+
#ifdef __WIN32__
#ifdef __WXWINCE__
// No equivalent in WinCE
if (isDriveSpec)
{
wxChar firstChar = d[0];
-
+
// To upper case
if (firstChar > 90)
firstChar = firstChar - 32;
-
+
// To a drive number
unsigned int driveNo = firstChar - 64;
if (driveNo > 0)
}
}
bool success = (chdir(WXSTRINGCAST d) == 0);
-
+
return success;
#endif
-
+
#endif
}
{
wxLogLastError(_T("FileTimeToLocalFileTime"));
}
-
+
SYSTEMTIME st;
if ( !::FileTimeToSystemTime(&ftLocal, &st) )
{
wxLogLastError(_T("FileTimeToSystemTime"));
}
-
+
dateTime.Set(st.wDay, wxDateTime::Month(st.wMonth - 1), st.wYear,
st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
return dateTime.GetTicks();
else // mkstemp() succeeded
{
path = wxConvFile.cMB2WX( (const char*) buf );
-
+
// avoid leaking the fd
if ( fileTemp )
{
size_t count = dirs.GetCount();
for ( size_t i = 0; i < count; i++ )
{
- if ( i > 0 ||
+ if ( i > 0 ||
#if defined(__WXMAC__) && !defined(__DARWIN__)
- // relative pathnames are exactely the other way round under mac...
- !filename.IsAbsolute()
+ // relative pathnames are exactely the other way round under mac...
+ !filename.IsAbsolute()
#else
- filename.IsAbsolute()
+ filename.IsAbsolute()
#endif
)
currPath += wxFILE_SEP_PATH;
m_dirs.Add(dir);
}
-
+
#if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE
if ( (flags & wxPATH_NORM_SHORTCUT) )
{
{
wxString path, file, ext;
wxSplitPath(shortcutPath, & path, & file, & ext);
-
- HRESULT hres;
- IShellLink* psl;
- bool success = FALSE;
+
+ HRESULT hres;
+ IShellLink* psl;
+ bool success = false;
// Assume it's not a shortcut if it doesn't end with lnk
if (ext.Lower() != wxT("lnk"))
- 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,
- MAX_PATH);
-
- hres = ppf->Load(wsz, 0);
- if (SUCCEEDED(hres))
- {
+ 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,
+ MAX_PATH);
+
+ hres = ppf->Load(wsz, 0);
+ if (SUCCEEDED(hres))
+ {
wxChar buf[2048];
- psl->GetPath(buf, 2048, NULL, SLGP_UNCPRIORITY);
- targetFilename = wxString(buf);
+ psl->GetPath(buf, 2048, NULL, SLGP_UNCPRIORITY);
+ targetFilename = wxString(buf);
success = (shortcutPath != targetFilename);
- psl->GetArguments(buf, 2048);
+ psl->GetArguments(buf, 2048);
wxString args(buf);
if (!args.IsEmpty() && arguments)
{
*arguments = args;
- }
- }
- }
- }
- psl->Release();
- return success;
+ }
+ }
+ }
+ }
+ psl->Release();
+ return success;
}
#endif
if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr )
{
- if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
- {
- finfo = (FileInfo*)&catInfo.finderInfo;
- finfo->fileType = type ;
- finfo->fileCreator = creator ;
- FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ;
+ if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
+ {
+ finfo = (FileInfo*)&catInfo.finderInfo;
+ finfo->fileType = type ;
+ finfo->fileCreator = creator ;
+ FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ;
return true ;
- }
+ }
}
return false ;
}
if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr )
{
- if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
- {
- finfo = (FileInfo*)&catInfo.finderInfo;
- *type = finfo->fileType ;
- *creator = finfo->fileCreator ;
+ if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr )
+ {
+ finfo = (FileInfo*)&catInfo.finderInfo;
+ *type = finfo->fileType ;
+ *creator = finfo->fileCreator ;
return true ;
- }
+ }
}
return false ;
}
return mime;
#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");
- 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");
- if ( ext.IsSameAs(wxT("gif"), FALSE) )
+ if ( ext.IsSameAs(wxT("gif"), false) )
return wxT("image/gif");
- if ( ext.IsSameAs(wxT("png"), FALSE) )
+ if ( ext.IsSameAs(wxT("png"), false) )
return wxT("image/png");
- if ( ext.IsSameAs(wxT("bmp"), FALSE) )
+ if ( ext.IsSameAs(wxT("bmp"), false) )
return wxT("image/bmp");
return wxEmptyString;
#endif
{
wxString s = wxEmptyString;
int i, l = location.Length();
- bool fnd;
+ bool fnd = false;
- fnd = FALSE;
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");
for (++i; (i < l) && (location[i] != wxT(':')); i++) s << location[i];
wxString wxFileSystemHandler::GetLeftLocation(const wxString& location) const
{
int i;
- bool fnd;
+ bool fnd = false;
- fnd = FALSE;
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);
}
return wxEmptyString;
int i, l = location.Length();
int l2 = l + 1;
- for (i = l-1;
- (i >= 0) &&
+ for (i = l-1;
+ (i >= 0) &&
((location[i] != wxT(':')) || (i == 1) || (location[i-2] == wxT(':')));
i--)
{
// Returns the native path for a file URL
wxFileName wxFileSystem::URLToFileName(const wxString& url)
{
- wxString path = url;
+ wxString path = url;
- if ( path.Find(wxT("file://")) == 0 )
- {
- path = path.Mid(7);
- }
+ if ( path.Find(wxT("file://")) == 0 )
+ {
+ path = path.Mid(7);
+ }
else if ( path.Find(wxT("file:")) == 0 )
- {
- path = path.Mid(5);
- }
- // Remove preceding double slash on Mac Classic
+ {
+ path = path.Mid(5);
+ }
+ // Remove preceding double slash on Mac Classic
#if defined(__WXMAC__) && !defined(__UNIX__)
else if ( path.Find(wxT("//")) == 0 )
path = path.Mid(2);
#endif
-
+
path.Replace(wxT("%25"), wxT("%"));
path.Replace(wxT("%3A"), wxT(":"));
#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,
// which only exists on msw and corresponds to a unc
- if ( path[0u] == wxT('/') && path [1u] != wxT('/'))
- {
- path = path.Mid(1);
- }
- else if ( (url.Find(wxT("file://")) == 0) &&
+ if ( path[0u] == wxT('/') && path [1u] != wxT('/'))
+ {
+ path = path.Mid(1);
+ }
+ else if ( (url.Find(wxT("file://")) == 0) &&
(path.Find(wxT('/')) != wxNOT_FOUND) &&
(path.Length() > 1) && (path[1u] != wxT(':')) )
- {
- path = wxT("//") + path;
- }
+ {
+ path = wxT("//") + path;
+ }
#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
#ifndef __UNIX__
// unc notation, wxMSW
- if ( url.Find(wxT("\\\\")) == 0 )
+ if ( url.Find(wxT("\\\\")) == 0 )
{
url = wxT("//") + url.Mid(2);
}
wxString fileName = filePath.AfterLast(wxFILE_SEP_PATH);
// 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))
return filePath;
wxString ext = extensionList.BeforeFirst(wxT(';'));
// 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))
return filePath;
else
const wxChar *default_name,
wxWindow *parent)
{
- return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
+ return wxDefaultFileSelector(true, what, extension, default_name, parent);
}
//----------------------------------------------------------------------------
const wxChar *default_name,
wxWindow *parent)
{
- return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
+ return wxDefaultFileSelector(false, what, extension, default_name, parent);
}
#endif // wxUSE_FILEDLG
{
public:
wxFontMapperModule() : wxModule() { }
- virtual bool OnInit() { return TRUE; }
+ virtual bool OnInit() { return true; }
virtual void OnExit() { delete wxFontMapper::Set(NULL); }
DECLARE_DYNAMIC_CLASS(wxFontMapperModule)
{
#if wxUSE_CONFIG && wxUSE_FILECONFIG
m_config = NULL;
- m_configIsDummy = FALSE;
+ m_configIsDummy = false;
#endif // wxUSE_CONFIG
}
if ( !m_config )
{
// 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 )
{
// but will allow us to remember the results of the questions at
// least during this run
m_config = new wxMemoryConfig;
- m_configIsDummy = TRUE;
+ m_configIsDummy = true;
// VS: we can't call wxConfig::Set(m_config) here because that would
// disable automatic wxConfig instance creation if this code was
// called before wxApp::OnInit (this happens in wxGTK -- it sets
}
}
- 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
// to the real one as soon as one becomes available.
delete m_config;
- m_config = wxConfig::Get(FALSE);
- m_configIsDummy = FALSE;
+ m_config = wxConfig::Get(false);
+ m_configIsDummy = false;
// 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
// either doesn't use wxConfig at all or creates wxConfig object in
{
wxConfigBase *config = GetConfig();
if ( !config )
- return FALSE;
+ return false;
*pathOld = config->GetPath();
config->SetPath(path);
- return TRUE;
+ return true;
}
void wxFontMapperBase::RestorePath(const wxString& pathOld)
config->SetPath(FONTMAPPER_CHARSET_ALIAS_PATH);
wxString alias = config->Read(charset);
- if ( !!alias )
+ if ( !alias.IsEmpty() )
{
// yes, we do - use it instead
cs = alias;
cs == wxT("EUC_KR") )
{
encoding = wxFONTENCODING_CP949;
- }
+ }
else if ( cs == wxT("KOI8-R") ||
cs == wxT("KOI8-RU") )
{
const wxChar *p = cs.c_str() + 3;
if ( *p == wxT('-') )
p++;
-
+
// printf( "iso %s\n", (const char*) cs.ToAscii() );
unsigned int value;
if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 )
{
// printf( "value %d\n", (int)value );
-
+
// make it 0 based and check that it is strictly positive in
// the process (no such thing as iso8859-0 encoding)
if ( (value-- > 0) &&
else if ( cs.Left(4) == wxT("8859") )
{
const wxChar *p = cs.c_str();
-
+
unsigned int value;
if ( wxSscanf(p, wxT("8859-%u"), &value) == 1 )
{
// printf( "value %d\n", (int)value );
-
+
// make it 0 based and check that it is strictly positive in
// the process (no such thing as iso8859-0 encoding)
if ( (value-- > 0) &&
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
- return FALSE;
+ return false;
pointSize = (int)l;
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
- return FALSE;
+ return false;
family = (wxFontFamily)l;
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
- return FALSE;
+ return false;
style = (wxFontStyle)l;
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
- return FALSE;
+ return false;
weight = (wxFontWeight)l;
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
- return FALSE;
+ return false;
underlined = l != 0;
faceName = tokenizer.GetNextToken();
#ifndef __WXMAC__
if( !faceName )
- return FALSE;
+ return false;
#endif
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
- return FALSE;
+ return false;
encoding = (wxFontEncoding)l;
- return TRUE;
+ return true;
}
wxString wxNativeFontInfo::ToString() const
family = wxFONTFAMILY_DEFAULT;
style = wxFONTSTYLE_NORMAL;
weight = wxFONTWEIGHT_NORMAL;
- underlined = FALSE;
+ underlined = false;
faceName.clear();
encoding = wxFONTENCODING_DEFAULT;
}
wxString token = tokenizer.GetNextToken();
// normalize it
- token.Trim(TRUE).Trim(FALSE).MakeLower();
+ token.Trim(true).Trim(false).MakeLower();
// look for the known tokens
if ( token == _T("underlined") || token == _("underlined") )
{
- SetUnderlined(TRUE);
+ SetUnderlined(true);
}
else if ( token == _T("light") || token == _("light") )
{
SetPointSize(size);
}
#if wxUSE_FONTMAP
- else if ( (encoding = wxFontMapper::Get()->CharsetToEncoding(token, FALSE))
+ else if ( (encoding = wxFontMapper::Get()->CharsetToEncoding(token, false))
!= wxFONTENCODING_DEFAULT )
{
SetEncoding(encoding);
SetFaceName(face);
}
- return TRUE;
+ return true;
}
#endif // generic or wxMSW or wxOS2
wxString configEntry,
encName = GetEncodingName(encoding);
- if ( !!facename )
+ if ( !facename.IsEmpty() )
{
configEntry = facename + _T("_");
}
}
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
fontinfo = GetConfig()->Read(encName);
}
- if ( !!fontinfo )
+ if ( !fontinfo.IsEmpty() )
{
if ( info->FromString(fontinfo) )
{
void wxFrameBase::UpdateWindowUI(long flags)
{
wxWindowBase::UpdateWindowUI(flags);
-
+
#if wxUSE_TOOLBAR
if (GetToolBar())
GetToolBar()->UpdateWindowUI(flags);
void wxFrameBase::OnInternalIdle()
{
wxTopLevelWindow::OnInternalIdle();
-
+
#if wxUSE_MENUS && wxUSE_IDLEMENUUPDATES
if (wxUpdateUIEvent::CanUpdate(this))
DoMenuUpdates();
public:
wxTemporaryFileInputStream(const wxString& filename) :
wxFileInputStream(filename), m_filename(filename) {}
-
+
~wxTemporaryFileInputStream()
{
// NB: copied from wxFileInputStream dtor, we need to do it before
delete m_file;
m_file_destroy = false;
}
- wxRemoveFile(m_filename);
+ wxRemoveFile(m_filename);
}
protected:
return (url.GetError() == wxURL_NOERR);
}
- return FALSE;
+ return false;
}
s->Read(sout);
}
delete s;
-
+
return new wxFSFile(new wxTemporaryFileInputStream(tmpfile),
right,
content,
virtual bool OnInit()
{
wxFileSystem::AddHandler(new wxInternetFSHandler);
- return TRUE;
+ return true;
}
virtual void OnExit() {}
};
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__)
// 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
// units (as created by e.g. event.cpp compiled for
// libwx_base and event.cpp compiled for libwx_gui_core).
{
#if wxUSE_DATETIME
m_Time = wxDateTime::Now();
-#endif // wxUSE_DATETIME
+#endif // wxUSE_DATETIME
}
};
GetAnchor(location)
#if wxUSE_DATETIME
, obj -> m_Time
-#endif // wxUSE_DATETIME
+#endif // wxUSE_DATETIME
);
}
else return NULL;
wxString s;
s.Printf(_("Memory VFS already contains file '%s'!"), filename.c_str());
wxLogError(s);
- return FALSE;
+ return false;
}
else
- return TRUE;
+ return true;
}
{
m_Archive = NULL;
m_ZipFile = m_Pattern = m_BaseDir = wxEmptyString;
- m_AllowDirs = m_AllowFiles = TRUE;
+ m_AllowDirs = m_AllowFiles = true;
m_DirsFound = NULL;
}
rightPart.Normalize(wxPATH_NORM_DOTS, wxT("/"), wxPATH_UNIX);
right = rightPart.GetFullPath(wxPATH_UNIX);
}
-
+
if (right.GetChar(0) == wxT('/')) right = right.Mid(1);
wxFileName leftFilename = wxFileSystem::URLToFileName(left);
switch (flags)
{
case wxFILE:
- m_AllowDirs = FALSE, m_AllowFiles = TRUE; break;
+ m_AllowDirs = false, m_AllowFiles = true; break;
case wxDIR:
- m_AllowDirs = TRUE, m_AllowFiles = FALSE; break;
+ m_AllowDirs = true, m_AllowFiles = false; break;
default:
- m_AllowDirs = m_AllowFiles = TRUE; break;
+ m_AllowDirs = m_AllowFiles = true; break;
}
m_ZipFile = left;
filename = dir.AfterLast(wxT('/'));
dir = dir.BeforeLast(wxT('/'));
if (!filename.IsEmpty() && m_BaseDir == dir &&
- wxMatchWild(m_Pattern, filename, FALSE))
+ wxMatchWild(m_Pattern, filename, false))
match = m_ZipFile + wxT("#zip:") + dir + wxT("/") + filename;
}
else
filename = namestr.AfterLast(wxT('/'));
dir = namestr.BeforeLast(wxT('/'));
if (m_AllowFiles && !filename.IsEmpty() && m_BaseDir == dir &&
- wxMatchWild(m_Pattern, filename, FALSE))
+ wxMatchWild(m_Pattern, filename, false))
match = m_ZipFile + wxT("#zip:") + namestr;
if (unzGoToNextFile((unzFile)m_Archive) != UNZ_OK)
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxFTP, wxProtocol)
-IMPLEMENT_PROTOCOL(wxFTP, wxT("ftp"), wxT("ftp"), TRUE)
+IMPLEMENT_PROTOCOL(wxFTP, wxT("ftp"), wxT("ftp"), true)
// ============================================================================
// implementation
wxFTP::wxFTP()
{
m_lastError = wxPROTO_NOERR;
- m_streaming = FALSE;
+ m_streaming = false;
m_currentTransfermode = NONE;
m_user = wxT("anonymous");
if ( !wxProtocol::Connect(addr) )
{
m_lastError = wxPROTO_NETERR;
- return FALSE;
+ return false;
}
if ( !m_user )
{
m_lastError = wxPROTO_CONNERR;
- return FALSE;
+ return false;
}
// we should have 220 welcome message
if ( !CheckResult('2') )
{
Close();
- return FALSE;
+ return false;
}
wxString command;
if ( rc == '2' )
{
// 230 return: user accepted without password
- return TRUE;
+ return true;
}
if ( rc != '3' )
{
Close();
- return FALSE;
+ return false;
}
command.Printf(wxT("PASS %s"), m_passwd.c_str());
if ( !CheckCommand(command, '2') )
{
Close();
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
bool wxFTP::Connect(const wxString& host)
if ( m_streaming )
{
m_lastError = wxPROTO_STREAMING;
- return FALSE;
+ return false;
}
if ( IsConnected() )
// ...
// xyz ...
// and the intermeidate lines may start with xyz or not
- bool badReply = FALSE;
- bool firstLine = TRUE;
- bool endOfReply = FALSE;
+ bool badReply = false;
+ bool firstLine = true;
+ bool endOfReply = false;
while ( !endOfReply && !badReply )
{
wxString line;
{
if ( firstLine )
{
- badReply = TRUE;
+ badReply = true;
}
else
{
switch ( chMarker )
{
case _T(' '):
- endOfReply = TRUE;
+ endOfReply = true;
break;
case _T('-'):
- firstLine = FALSE;
+ firstLine = false;
break;
default:
// unexpected
- badReply = TRUE;
+ badReply = true;
}
}
else // subsequent line of multiline reply
{
if ( chMarker == _T(' ') )
{
- endOfReply = TRUE;
+ endOfReply = true;
}
wxLogTrace(FTP_TRACE_MASK, _T("<== %s %s"),
if ( transferMode == m_currentTransfermode )
{
// nothing to do
- return TRUE;
+ return true;
}
wxString mode;
wxLogError(_("Failed to set FTP transfer mode to %s."), (const wxChar*)
(transferMode == ASCII ? _("ASCII") : _("binary")));
- return FALSE;
+ return false;
}
// If we get here the operation has been succesfully completed
// Set the status-member
m_currentTransfermode = transferMode;
- return TRUE;
+ return true;
}
bool wxFTP::DoSimpleCommand(const wxChar *command, const wxString& arg)
{
wxLogDebug(_T("FTP command '%s' failed."), fullcmd.c_str());
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
bool wxFTP::ChDir(const wxString& dir)
str = wxT("RNFR ") + src;
if ( !CheckCommand(str, '3') )
- return FALSE;
+ return false;
str = wxT("RNTO ") + dst;
// wait for "226 transfer completed"
m_ftp->CheckResult('2');
- m_ftp->m_streaming = FALSE;
+ m_ftp->m_streaming = false;
}
else
{
// read this reply
m_ftp->CheckResult('2');
- m_ftp->m_streaming = FALSE;
+ m_ftp->m_streaming = false;
}
else
{
return NULL;
}
- client->Notify(FALSE);
+ client->Notify(false);
return client;
}
bool wxFTP::Abort()
{
if ( !m_streaming )
- return TRUE;
+ return true;
- m_streaming = FALSE;
+ m_streaming = false;
if ( !CheckCommand(wxT("ABOR"), '4') )
- return FALSE;
+ return false;
return CheckResult('2');
}
if ( !CheckCommand(tmp_str, '1') )
return NULL;
- m_streaming = TRUE;
+ m_streaming = true;
in_stream = new wxInputFTPStream(this, sock);
if ( !CheckCommand(tmp_str, '1') )
return NULL;
- m_streaming = TRUE;
+ m_streaming = true;
return new wxOutputFTPStream(this, sock);
}
{
wxSocketBase *sock = GetPort();
if (!sock)
- return FALSE;
+ return false;
// NLST : List of Filenames (including Directory's !)
// LIST : depending on BS of FTP-Server
// - Windows : like "dir" command
// - others : ?
wxString line(details ? _T("LIST") : _T("NLST"));
- if ( !!wildcard )
+ if ( !wildcard.IsEmpty() )
{
line << _T(' ') << wildcard;
}
if (!CheckCommand(line, '1'))
{
- return FALSE;
+ return false;
}
files.Empty();
while ( ReadLine(sock, line) == wxPROTO_NOERR )
// the file list should be terminated by "226 Transfer complete""
if ( !CheckResult('2') )
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
bool wxFTP::FileExists(const wxString& fileName)
// current dir. It does so by simply doing an NLST (via GetList).
// If this succeeds (and the list is not empty) the file exists.
- bool retval = FALSE;
+ bool retval = false;
wxArrayString fileList;
- if ( GetList(fileList, fileName, FALSE) )
+ if ( GetList(fileList, fileName, false) )
{
// Some ftp-servers (Ipswitch WS_FTP Server 1.0.5 does this)
// displays this behaviour when queried on a non-existing file:
&statuscode, &filesize) == 2 )
{
// We've gotten a good reply.
- ok = TRUE;
+ ok = true;
}
else
{
// Something bad happened.. A "2yz" reply with no size
// Fallback
- ok = FALSE;
+ ok = false;
}
}
// We now try to get details for the file with a "LIST"-command
// and then parse the output from there..
wxArrayString fileList;
- if ( GetList(fileList, fileName, TRUE) )
+ if ( GetList(fileList, fileName, true) )
{
if ( !fileList.IsEmpty() )
{
// substring containing the name we are looking for. We
// stop the iteration at the first occurrence of the
// filename. The search is not case-sensitive.
- bool foundIt = FALSE;
+ bool foundIt = false;
size_t i;
for ( i = 0; !foundIt && i < fileList.Count(); i++ )