INTEGRATION: CWS sdk08 (1.5.64); FILE MERGED
2003/10/02 16:02:08 jsc 1.5.64.2: #106565# generate temp files always, rename complete files 2003/09/17 11:47:34 jsc 1.5.64.1: #108849# change identifer names for member constructors
This commit is contained in:
parent
756b88f757
commit
4c3e58db87
1 changed files with 44 additions and 59 deletions
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: global.hxx,v $
|
||||
*
|
||||
* $Revision: 1.5 $
|
||||
* $Revision: 1.6 $
|
||||
*
|
||||
* last change: $Author: jsc $ $Date: 2001-08-17 13:12:57 $
|
||||
* last change: $Author: obo $ $Date: 2003-10-20 13:09:02 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -68,12 +68,9 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef _RTL_USTRING_HXX_
|
||||
#include <rtl/ustring.hxx>
|
||||
#endif
|
||||
#ifndef _RTL_STRBUF_HXX_
|
||||
#include <rtl/strbuf.hxx>
|
||||
#endif
|
||||
#include "osl/file.hxx"
|
||||
#include "rtl/ustring.hxx"
|
||||
#include "rtl/strbuf.hxx"
|
||||
|
||||
struct EqualString
|
||||
{
|
||||
|
@ -108,25 +105,6 @@ typedef ::std::list< ::rtl::OString > StringList;
|
|||
typedef ::std::vector< ::rtl::OString > StringVector;
|
||||
typedef ::std::set< ::rtl::OString, LessString > StringSet;
|
||||
|
||||
::rtl::OString makeTempName(sal_Char* prefix);
|
||||
|
||||
::rtl::OString createFileNameFromType(const ::rtl::OString& destination,
|
||||
const ::rtl::OString type,
|
||||
const ::rtl::OString postfix,
|
||||
sal_Bool bLowerCase=sal_False,
|
||||
const ::rtl::OString prefix="");
|
||||
|
||||
sal_Bool fileExists(const ::rtl::OString& fileName);
|
||||
sal_Bool checkFileContent(const ::rtl::OString& targetFileName, const ::rtl::OString& tmpFileName);
|
||||
|
||||
const ::rtl::OString inGlobalSet(const ::rtl::OUString & r);
|
||||
inline const ::rtl::OString inGlobalSet(sal_Char* p)
|
||||
{
|
||||
return inGlobalSet( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(p) ) );
|
||||
}
|
||||
|
||||
::rtl::OUString convertToFileUrl(const ::rtl::OString& fileName);
|
||||
|
||||
//*************************************************************************
|
||||
// FileStream
|
||||
//*************************************************************************
|
||||
|
@ -134,13 +112,11 @@ enum FileAccessMode
|
|||
{
|
||||
FAM_READ, // "r"
|
||||
FAM_WRITE, // "w"
|
||||
FAM_APPEND, // "a"
|
||||
FAM_READWRITE_EXIST, // "r+"
|
||||
FAM_READWRITE, // "w+"
|
||||
FAM_READAPPEND // "a+"
|
||||
};
|
||||
|
||||
class FileStream //: public ofstream
|
||||
class FileStream
|
||||
{
|
||||
public:
|
||||
FileStream();
|
||||
|
@ -150,43 +126,52 @@ public:
|
|||
sal_Bool isValid();
|
||||
|
||||
void open(const ::rtl::OString& name, FileAccessMode nMode = FAM_READWRITE);
|
||||
void createTempFile(const ::rtl::OString& sPath);
|
||||
void close();
|
||||
|
||||
sal_Int32 getSize();
|
||||
::rtl::OString getName() { return m_name; }
|
||||
|
||||
// friend functions
|
||||
friend FileStream &operator<<(FileStream& o, sal_uInt32 i)
|
||||
{ fprintf(o.m_pFile, "%d", i);
|
||||
return o;
|
||||
}
|
||||
friend FileStream &operator<<(FileStream& o, sal_Char* s)
|
||||
{ fprintf(o.m_pFile, "%s", s);
|
||||
return o;
|
||||
}
|
||||
friend FileStream &operator<<(FileStream& o, ::rtl::OString* s)
|
||||
{ fprintf(o.m_pFile, "%s", s->getStr());
|
||||
return o;
|
||||
}
|
||||
friend FileStream &operator<<(FileStream& o, const ::rtl::OString& s)
|
||||
{ fprintf(o.m_pFile, "%s", s.getStr());
|
||||
return o;
|
||||
}
|
||||
friend FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer* s)
|
||||
{ fprintf(o.m_pFile, "%s", s->getStr());
|
||||
return o;
|
||||
}
|
||||
friend FileStream &operator<<(FileStream& o, const ::rtl::OStringBuffer& s)
|
||||
{ fprintf(o.m_pFile, "%s", s.getStr());
|
||||
return o;
|
||||
}
|
||||
friend FileStream &operator<<(FileStream& o, sal_uInt32 i);
|
||||
friend FileStream &operator<<(FileStream& o, sal_Char* s);
|
||||
friend FileStream &operator<<(FileStream& o, ::rtl::OString* s);
|
||||
friend FileStream &operator<<(FileStream& o, const ::rtl::OString& s);
|
||||
friend FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer* s);
|
||||
friend FileStream &operator<<(FileStream& o, const ::rtl::OStringBuffer& s);
|
||||
|
||||
protected:
|
||||
const sal_Char* checkAccessMode(FileAccessMode mode);
|
||||
private:
|
||||
sal_uInt32 checkAccessMode(FileAccessMode mode);
|
||||
|
||||
FILE* m_pFile;
|
||||
::rtl::OString m_name;
|
||||
oslFileHandle m_file;
|
||||
::rtl::OString m_name;
|
||||
};
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
// Helper functions
|
||||
//*************************************************************************
|
||||
::rtl::OString getTempDir(const ::rtl::OString& sFileName);
|
||||
|
||||
::rtl::OString createFileNameFromType(const ::rtl::OString& destination,
|
||||
const ::rtl::OString type,
|
||||
const ::rtl::OString postfix,
|
||||
sal_Bool bLowerCase=sal_False,
|
||||
const ::rtl::OString prefix="");
|
||||
|
||||
sal_Bool fileExists(const ::rtl::OString& fileName);
|
||||
sal_Bool makeValidTypeFile(const ::rtl::OString& targetFileName,
|
||||
const ::rtl::OString& tmpFileName,
|
||||
sal_Bool bFileCheck);
|
||||
sal_Bool removeTypeFile(const ::rtl::OString& fileName);
|
||||
|
||||
const ::rtl::OString inGlobalSet(const ::rtl::OUString & r);
|
||||
inline const ::rtl::OString inGlobalSet(sal_Char* p)
|
||||
{
|
||||
return inGlobalSet( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(p) ) );
|
||||
}
|
||||
|
||||
::rtl::OUString convertToFileUrl(const ::rtl::OString& fileName);
|
||||
|
||||
|
||||
#endif // _CODEMAKER_GLOBAL_HXX_
|
||||
|
||||
|
|
Loading…
Reference in a new issue