Rename wxGetFileType to wxGetFileKind

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31974 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell
2005-02-12 21:53:51 +00:00
parent 9e8e867ff9
commit 0912690b65
16 changed files with 91 additions and 91 deletions

View File

@@ -145,19 +145,19 @@ if the file is not opened.
Flushes the file and returns \true on success.
\membersection{wxFFile::GetFileType}\label{wxffilegetfiletype}
\membersection{wxFFile::GetKind}\label{wxffilegetfilekind}
\constfunc{wxFileTypeEnum}{GetFileType}{\void}
\constfunc{wxFileKind}{GetKind}{\void}
Returns the type of the file. Possible return values are:
\begin{verbatim}
enum wxFileTypeEnum
enum wxFileKind
{
wxFILE_TYPE_UNKNOWN,
wxFILE_TYPE_DISK, // a file supporting seeking to arbitrary offsets
wxFILE_TYPE_TERMINAL, // a tty
wxFILE_TYPE_PIPE // a pipe
wxFILE_KIND_UNKNOWN,
wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets
wxFILE_KIND_TERMINAL, // a tty
wxFILE_KIND_PIPE // a pipe
};
\end{verbatim}

View File

@@ -200,19 +200,19 @@ Note that wxFile::Flush is not implemented on some Windows compilers
due to a missing fsync function, which reduces the usefulness of this function
(it can still be called but it will do nothing on unsupported compilers).
\membersection{wxFile::GetFileType}\label{wxfilegetfiletype}
\membersection{wxFile::GetKind}\label{wxfilegetfilekind}
\constfunc{wxFileTypeEnum}{GetFileType}{\void}
\constfunc{wxFileKind}{GetKind}{\void}
Returns the type of the file. Possible return values are:
\begin{verbatim}
enum wxFileTypeEnum
enum wxFileKind
{
wxFILE_TYPE_UNKNOWN,
wxFILE_TYPE_DISK, // a file supporting seeking to arbitrary offsets
wxFILE_TYPE_TERMINAL, // a tty
wxFILE_TYPE_PIPE // a pipe
wxFILE_KIND_UNKNOWN,
wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets
wxFILE_KIND_TERMINAL, // a tty
wxFILE_KIND_PIPE // a pipe
};
\end{verbatim}

View File

@@ -108,7 +108,7 @@ the corresponding topic.
\helpref{wxGetElapsedTime}{wxgetelapsedtime}\\
\helpref{wxGetEmailAddress}{wxgetemailaddress}\\
\helpref{wxGetEnv}{wxgetenv}\\
\helpref{wxGetFileType}{wxgetfiletype}\\
\helpref{wxGetFileKind}{wxgetfilekind}\\
\helpref{wxGetFontFromUser}{wxgetfontfromuser}\\
\helpref{wxGetFreeMemory}{wxgetfreememory}\\
\helpref{wxGetFullHostName}{wxgetfullhostname}\\
@@ -1016,21 +1016,21 @@ Mac OS and generic Unix provided the system has {\tt statfs()} function.
This function first appeared in wxWidgets 2.3.2.
\membersection{::wxGetFileType}\label{wxgetfiletype}
\membersection{::wxGetFileKind}\label{wxgetfilekind}
\func{wxFileTypeEnum}{wxGetFileType}{\param{int }{fd}}
\func{wxFileKind}{wxGetFileKind}{\param{int }{fd}}
\func{wxFileTypeEnum}{wxGetFileType}{\param{FILE *}{fp}}
\func{wxFileKind}{wxGetFileKind}{\param{FILE *}{fp}}
Returns the type of an open file. Possible return values are:
\begin{verbatim}
enum wxFileTypeEnum
enum wxFileKind
{
wxFILE_TYPE_UNKNOWN,
wxFILE_TYPE_DISK, // a file supporting seeking to arbitrary offsets
wxFILE_TYPE_TERMINAL, // a tty
wxFILE_TYPE_PIPE // a pipe
wxFILE_KIND_UNKNOWN,
wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets
wxFILE_KIND_TERMINAL, // a tty
wxFILE_KIND_PIPE // a pipe
};
\end{verbatim}

View File

@@ -97,7 +97,7 @@ public:
// get the file name
const wxString& GetName() const { return m_name; }
// type such as disk or pipe
wxFileTypeEnum GetFileType() const { return wxGetFileType(m_fp); }
wxFileKind GetKind() const { return wxGetFileKind(m_fp); }
// dtor closes the file if opened
~wxFFile() { Close(); }

View File

@@ -126,7 +126,7 @@ public:
// has an error occured?
bool Error() const { return m_error; }
// type such as disk or pipe
wxFileTypeEnum GetFileType() const { return wxGetFileType(m_fd); }
wxFileKind GetKind() const { return wxGetFileKind(m_fd); }
// dtor closes the file if opened
~wxFile() { Close(); }

View File

@@ -122,12 +122,12 @@ enum wxSeekMode
wxFromEnd
};
enum wxFileTypeEnum
enum wxFileKind
{
wxFILE_TYPE_UNKNOWN,
wxFILE_TYPE_DISK, // a file supporting seeking to arbitrary offsets
wxFILE_TYPE_TERMINAL, // a tty
wxFILE_TYPE_PIPE // a pipe
wxFILE_KIND_UNKNOWN,
wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets
wxFILE_KIND_TERMINAL, // a tty
wxFILE_KIND_PIPE // a pipe
};
// ----------------------------------------------------------------------------
@@ -464,8 +464,8 @@ WXDLLIMPEXP_BASE bool wxMkdir(const wxString& dir, int perm = 0777);
WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0);
// Return the type of an open file
WXDLLIMPEXP_BASE wxFileTypeEnum wxGetFileType(int fd);
inline wxFileTypeEnum wxGetFileType(FILE *fp) { return wxGetFileType(fileno(fp)); }
WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(int fd);
inline wxFileKind wxGetFileKind (FILE *fp) { return wxGetFileKind(fileno(fp)); }
// compatibility defines, don't use in new code
#define wxDirExists wxPathExists

View File

@@ -41,7 +41,7 @@ public:
wxFileOffset GetLength() const;
bool Ok() const { return m_file->IsOpened(); }
bool IsSeekable() const { return m_file->GetFileType() == wxFILE_TYPE_DISK; }
bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; }
protected:
wxFileInputStream();
@@ -70,7 +70,7 @@ public:
wxFileOffset GetLength() const;
bool Ok() const { return m_file->IsOpened(); }
bool IsSeekable() const { return m_file->GetFileType() == wxFILE_TYPE_DISK; }
bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; }
protected:
wxFileOutputStream();
@@ -111,7 +111,7 @@ public:
wxFileOffset GetLength() const;
bool Ok() const { return m_file->IsOpened(); }
bool IsSeekable() const { return m_file->GetFileType() == wxFILE_TYPE_DISK; }
bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; }
protected:
wxFFileInputStream();
@@ -140,7 +140,7 @@ public:
wxFileOffset GetLength() const;
bool Ok() const { return m_file->IsOpened(); }
bool IsSeekable() const { return m_file->GetFileType() == wxFILE_TYPE_DISK; }
bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; }
protected:
wxFFileOutputStream();

View File

@@ -1858,43 +1858,43 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
// Return the type of an open file
//
wxFileTypeEnum wxGetFileType(int fd)
wxFileKind wxGetFileKind(int fd)
{
if (isatty(fd))
return wxFILE_TYPE_TERMINAL;
return wxFILE_KIND_TERMINAL;
#if defined __WXMSW__
switch (::GetFileType(wxGetOSFHandle(fd)) & ~FILE_TYPE_REMOTE)
{
case FILE_TYPE_DISK:
return wxFILE_TYPE_DISK;
return wxFILE_KIND_DISK;
case FILE_TYPE_PIPE:
return wxFILE_TYPE_PIPE;
return wxFILE_KIND_PIPE;
}
return wxFILE_TYPE_UNKNOWN;
return wxFILE_KIND_UNKNOWN;
#elif defined __UNIX__
struct stat st;
fstat(fd, &st);
if (S_ISFIFO(st.st_mode))
return wxFILE_TYPE_PIPE;
return wxFILE_KIND_PIPE;
if (!S_ISREG(st.st_mode))
return wxFILE_TYPE_UNKNOWN;
return wxFILE_KIND_UNKNOWN;
#if defined __VMS__
if (st.st_fab_rfm != FAB$C_STMLF)
return wxFILE_TYPE_UNKNOWN;
return wxFILE_KIND_UNKNOWN;
#endif
return wxFILE_TYPE_DISK;
return wxFILE_KIND_DISK;
#else
if (lseek(fd, 0, SEEK_CUR) != -1)
return wxFILE_TYPE_DISK;
return wxFILE_KIND_DISK;
else
return wxFILE_TYPE_UNKNOWN;
return wxFILE_KIND_UNKNOWN;
#endif
}

View File

@@ -49,9 +49,9 @@ TEST_OBJECTS = \
test_arrays.o \
test_datetimetest.o \
test_fileconftest.o \
test_filekind.o \
test_filenametest.o \
test_filesystest.o \
test_filetype.o \
test_fontmaptest.o \
test_formatconvertertest.o \
test_hashes.o \
@@ -255,15 +255,15 @@ test_datetimetest.o: $(srcdir)/datetime/datetimetest.cpp $(TEST_ODEP)
test_fileconftest.o: $(srcdir)/fileconf/fileconftest.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/fileconf/fileconftest.cpp
test_filekind.o: $(srcdir)/filekind/filekind.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/filekind/filekind.cpp
test_filenametest.o: $(srcdir)/filename/filenametest.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/filename/filenametest.cpp
test_filesystest.o: $(srcdir)/filesys/filesystest.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/filesys/filesystest.cpp
test_filetype.o: $(srcdir)/filetype/filetype.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/filetype/filetype.cpp
test_fontmaptest.o: $(srcdir)/fontmap/fontmaptest.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/fontmap/fontmaptest.cpp

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tests/filetype/filetype.cpp
// Purpose: Test wxGetFileType and wxStreamBase::IsSeekable
// Purpose: Test wxGetFileKind and wxStreamBase::IsSeekable
// Author: Mike Wetherell
// RCS-ID: $Id$
// Copyright: (c) 2005 Mike Wetherell
@@ -35,9 +35,9 @@
///////////////////////////////////////////////////////////////////////////////
// The test case
class FileTypeTestCase : public CppUnit::TestCase
class FileKindTestCase : public CppUnit::TestCase
{
CPPUNIT_TEST_SUITE(FileTypeTestCase);
CPPUNIT_TEST_SUITE(FileKindTestCase);
CPPUNIT_TEST(File);
#if defined __UNIX__ || defined _MSC_VER || defined __MINGW32__
CPPUNIT_TEST(Pipe);
@@ -63,11 +63,11 @@ class FileTypeTestCase : public CppUnit::TestCase
// test a wxFFile and wxFFileInput/OutputStreams of a known type
//
void FileTypeTestCase::TestFILE(wxFFile& file, bool expected)
void FileKindTestCase::TestFILE(wxFFile& file, bool expected)
{
CPPUNIT_ASSERT(file.IsOpened());
CPPUNIT_ASSERT((wxGetFileType(file.fp()) == wxFILE_TYPE_DISK) == expected);
CPPUNIT_ASSERT((file.GetFileType() == wxFILE_TYPE_DISK) == expected);
CPPUNIT_ASSERT((wxGetFileKind(file.fp()) == wxFILE_KIND_DISK) == expected);
CPPUNIT_ASSERT((file.GetKind() == wxFILE_KIND_DISK) == expected);
wxFFileInputStream inStream(file);
CPPUNIT_ASSERT(inStream.IsSeekable() == expected);
@@ -78,11 +78,11 @@ void FileTypeTestCase::TestFILE(wxFFile& file, bool expected)
// test a wxFile and wxFileInput/OutputStreams of a known type
//
void FileTypeTestCase::TestFd(wxFile& file, bool expected)
void FileKindTestCase::TestFd(wxFile& file, bool expected)
{
CPPUNIT_ASSERT(file.IsOpened());
CPPUNIT_ASSERT((wxGetFileType(file.fd()) == wxFILE_TYPE_DISK) == expected);
CPPUNIT_ASSERT((file.GetFileType() == wxFILE_TYPE_DISK) == expected);
CPPUNIT_ASSERT((wxGetFileKind(file.fd()) == wxFILE_KIND_DISK) == expected);
CPPUNIT_ASSERT((file.GetKind() == wxFILE_KIND_DISK) == expected);
wxFileInputStream inStream(file);
CPPUNIT_ASSERT(inStream.IsSeekable() == expected);
@@ -99,7 +99,7 @@ struct TempFile
// test with an ordinary file
//
void FileTypeTestCase::File()
void FileKindTestCase::File()
{
TempFile tmp; // put first
wxFile file;
@@ -114,7 +114,7 @@ void FileTypeTestCase::File()
// test with a pipe
//
#if defined __UNIX__ || defined _MSC_VER || defined __MINGW32__
void FileTypeTestCase::Pipe()
void FileKindTestCase::Pipe()
{
int afd[2];
#ifdef __UNIX__
@@ -136,7 +136,7 @@ void FileTypeTestCase::Pipe()
// test with a socket
//
#if defined __UNIX__
void FileTypeTestCase::Socket()
void FileKindTestCase::Socket()
{
int s = socket(PF_INET, SOCK_STREAM, 0);
@@ -152,7 +152,7 @@ void FileTypeTestCase::Socket()
// Socket streams should be non-seekable
//
#if wxUSE_SOCKETS
void FileTypeTestCase::SocketStream()
void FileKindTestCase::SocketStream()
{
wxSocketClient client;
wxSocketInputStream inStream(client);
@@ -169,7 +169,7 @@ void FileTypeTestCase::SocketStream()
// Memory streams should be seekable
//
void FileTypeTestCase::MemoryStream()
void FileKindTestCase::MemoryStream()
{
char buf[20];
wxMemoryInputStream inStream(buf, sizeof(buf));
@@ -185,18 +185,18 @@ void FileTypeTestCase::MemoryStream()
// Stdin will usually be a terminal, if so then test it
//
void FileTypeTestCase::Stdin()
void FileKindTestCase::Stdin()
{
if (isatty(0))
CPPUNIT_ASSERT(wxGetFileType(0) == wxFILE_TYPE_TERMINAL);
CPPUNIT_ASSERT(wxGetFileKind(0) == wxFILE_KIND_TERMINAL);
if (isatty(fileno(stdin)))
CPPUNIT_ASSERT(wxGetFileType(stdin) == wxFILE_TYPE_TERMINAL);
CPPUNIT_ASSERT(wxGetFileKind(stdin) == wxFILE_KIND_TERMINAL);
}
// register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION(FileTypeTestCase);
CPPUNIT_TEST_SUITE_REGISTRATION(FileKindTestCase);
// also include in it's own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(FileTypeTestCase, "FileTypeTestCase");
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(FileKindTestCase, "FileKindTestCase");
#endif // wxUSE_STREAMS

View File

@@ -40,9 +40,9 @@ TEST_OBJECTS = \
$(OBJS)\test_arrays.obj \
$(OBJS)\test_datetimetest.obj \
$(OBJS)\test_fileconftest.obj \
$(OBJS)\test_filekind.obj \
$(OBJS)\test_filenametest.obj \
$(OBJS)\test_filesystest.obj \
$(OBJS)\test_filetype.obj \
$(OBJS)\test_fontmaptest.obj \
$(OBJS)\test_formatconvertertest.obj \
$(OBJS)\test_hashes.obj \
@@ -267,15 +267,15 @@ $(OBJS)\test_datetimetest.obj: .\datetime\datetimetest.cpp
$(OBJS)\test_fileconftest.obj: .\fileconf\fileconftest.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_filekind.obj: .\filekind\filekind.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_filenametest.obj: .\filename\filenametest.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_filesystest.obj: .\filesys\filesystest.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_filetype.obj: .\filetype\filetype.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_fontmaptest.obj: .\fontmap\fontmaptest.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $**

View File

@@ -31,9 +31,9 @@ TEST_OBJECTS = \
$(OBJS)\test_arrays.o \
$(OBJS)\test_datetimetest.o \
$(OBJS)\test_fileconftest.o \
$(OBJS)\test_filekind.o \
$(OBJS)\test_filenametest.o \
$(OBJS)\test_filesystest.o \
$(OBJS)\test_filetype.o \
$(OBJS)\test_fontmaptest.o \
$(OBJS)\test_formatconvertertest.o \
$(OBJS)\test_hashes.o \
@@ -256,15 +256,15 @@ $(OBJS)\test_datetimetest.o: ./datetime/datetimetest.cpp
$(OBJS)\test_fileconftest.o: ./fileconf/fileconftest.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_filekind.o: ./filekind/filekind.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_filenametest.o: ./filename/filenametest.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_filesystest.o: ./filesys/filesystest.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_filetype.o: ./filetype/filetype.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_fontmaptest.o: ./fontmap/fontmaptest.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $<

View File

@@ -33,9 +33,9 @@ TEST_OBJECTS = \
$(OBJS)\test_arrays.obj \
$(OBJS)\test_datetimetest.obj \
$(OBJS)\test_fileconftest.obj \
$(OBJS)\test_filekind.obj \
$(OBJS)\test_filenametest.obj \
$(OBJS)\test_filesystest.obj \
$(OBJS)\test_filetype.obj \
$(OBJS)\test_fontmaptest.obj \
$(OBJS)\test_formatconvertertest.obj \
$(OBJS)\test_hashes.obj \
@@ -368,15 +368,15 @@ $(OBJS)\test_datetimetest.obj: .\datetime\datetimetest.cpp
$(OBJS)\test_fileconftest.obj: .\fileconf\fileconftest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_filekind.obj: .\filekind\filekind.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_filenametest.obj: .\filename\filenametest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_filesystest.obj: .\filesys\filesystest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_filetype.obj: .\filetype\filetype.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_fontmaptest.obj: .\fontmap\fontmaptest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $**

View File

@@ -211,9 +211,9 @@ TEST_OBJECTS = &
$(OBJS)\test_arrays.obj &
$(OBJS)\test_datetimetest.obj &
$(OBJS)\test_fileconftest.obj &
$(OBJS)\test_filekind.obj &
$(OBJS)\test_filenametest.obj &
$(OBJS)\test_filesystest.obj &
$(OBJS)\test_filetype.obj &
$(OBJS)\test_fontmaptest.obj &
$(OBJS)\test_formatconvertertest.obj &
$(OBJS)\test_hashes.obj &
@@ -316,15 +316,15 @@ $(OBJS)\test_datetimetest.obj : .AUTODEPEND .\datetime\datetimetest.cpp
$(OBJS)\test_fileconftest.obj : .AUTODEPEND .\fileconf\fileconftest.cpp
$(CXX) -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_filekind.obj : .AUTODEPEND .\filekind\filekind.cpp
$(CXX) -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_filenametest.obj : .AUTODEPEND .\filename\filenametest.cpp
$(CXX) -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_filesystest.obj : .AUTODEPEND .\filesys\filesystest.cpp
$(CXX) -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_filetype.obj : .AUTODEPEND .\filetype\filetype.cpp
$(CXX) -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_fontmaptest.obj : .AUTODEPEND .\fontmap\fontmaptest.cpp
$(CXX) -zq -fo=$^@ $(TEST_CXXFLAGS) $<

View File

@@ -29,9 +29,9 @@
arrays/arrays.cpp
datetime/datetimetest.cpp
fileconf/fileconftest.cpp
filekind/filekind.cpp
filename/filenametest.cpp
filesys/filesystest.cpp
filetype/filetype.cpp
fontmap/fontmaptest.cpp
formatconverter/formatconvertertest.cpp
hashes/hashes.cpp

View File

@@ -473,6 +473,10 @@ SOURCE=.\fileconf\fileconftest.cpp
# End Source File
# Begin Source File
SOURCE=.\filekind\filekind.cpp
# End Source File
# Begin Source File
SOURCE=.\filename\filenametest.cpp
# End Source File
# Begin Source File
@@ -485,10 +489,6 @@ SOURCE=.\filesys\filesystest.cpp
# End Source File
# Begin Source File
SOURCE=.\filetype\filetype.cpp
# End Source File
# Begin Source File
SOURCE=.\fontmap\fontmaptest.cpp
# End Source File
# Begin Source File