diff options
Diffstat (limited to 'sal/workben/testfile.cxx')
-rw-r--r-- | sal/workben/testfile.cxx | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/sal/workben/testfile.cxx b/sal/workben/testfile.cxx index 07a1bdf48283..15a0bae48ff3 100644 --- a/sal/workben/testfile.cxx +++ b/sal/workben/testfile.cxx @@ -2,9 +2,9 @@ * * $RCSfile: testfile.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: obr $ $Date: 2001-09-04 06:52:25 $ + * last change: $Author: hr $ $Date: 2003-03-26 16:47:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,7 +64,6 @@ #include <osl/file.hxx> #include <osl/process.h> -#include <osl/thread.h> #include <osl/time.h> #include <rtl/alloc.h> #include <rtl/ustring.hxx> @@ -115,7 +114,7 @@ void printFileName(::rtl::OUString& str) { rtl::OString aString; - aString = rtl::OUStringToOString( str, osl_getThreadTextEncoding() ); + aString = rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ); printf( "%s", aString.getStr() ); @@ -248,7 +247,7 @@ sal_Bool Initialize( void ) while ( (pCount-pBuffer < uBytesRead) && !testLineBreak(pCount,uBytesRead-(pCount-pBuffer), &cLineBrake)) pCount++; - dir[i]=rtl::OUString(pBegin, pCount-pBegin, osl_getThreadTextEncoding() ); + dir[i]=rtl::OUString(pBegin, pCount-pBegin, RTL_TEXTENCODING_ASCII_US); pCount+=cLineBrake; pBegin=pCount; @@ -1678,6 +1677,55 @@ void DirectoryItemTest( void ) printf( "\n" ); + //--------------------------------------------------- + // get DirectoryItem from a file-handle + //-------------------------------------------------- + + pFile=new File( file1 ); + + rc=pFile->open( OpenFlag_Read ); + if ( rc==FileBase::E_None ) + { + printf( "Get DirectoryItem from a File-Handle: "); + printFileName( file1 ); + printf( "\n" ); + + rc=DirectoryItem::get( *pFile , aItem ); + print_error( rtl::OString( "GetDirectoryItem" ), rc ); + + pStatus=new FileStatus( FileStatusMask_All ); + rc=aItem.getFileStatus( *pStatus ); + + if ( rc==FileBase::E_None ) + { + printf( "GetFileStatus: FileURL: "); + printFileName( pStatus->getFileURL() ); + printf( "\n"); + } + + delete pStatus; + + pFile->close(); + } + + delete pFile; + + printf( "\n" ); + + //--------------------------------------------------- + // get DirectoryItem from an empty file-handle + //-------------------------------------------------- + + pFile=new File( file1 ); + + printf( "Get DirectoryItem from an empty File-Handle\n" ); + rc=DirectoryItem::get( *pFile , aItem ); + print_error( rtl::OString( "GetDirectoryItem" ), rc ); + + delete pFile; + + printf( "\n" ); + //-------------------------------------------------- // GetNextItem from a directory //-------------------------------------------------- |