summaryrefslogtreecommitdiff
path: root/rdbmaker
diff options
context:
space:
mode:
authorJuergen Schmidt <jsc@openoffice.org>2001-08-17 12:12:57 +0000
committerJuergen Schmidt <jsc@openoffice.org>2001-08-17 12:12:57 +0000
commit13669e1b67edc948ec0638e12397041683bbfd96 (patch)
tree42356dd23dc5385ca5bbd471c1cd3ed944d4d929 /rdbmaker
parent5a16a948e6022190b2159848463ed48275e0e478 (diff)
#91088# insert convert function
Diffstat (limited to 'rdbmaker')
-rw-r--r--rdbmaker/inc/codemaker/global.hxx61
1 files changed, 53 insertions, 8 deletions
diff --git a/rdbmaker/inc/codemaker/global.hxx b/rdbmaker/inc/codemaker/global.hxx
index 8b359b4ef..968da5db0 100644
--- a/rdbmaker/inc/codemaker/global.hxx
+++ b/rdbmaker/inc/codemaker/global.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: global.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jsc $ $Date: 2001-03-13 12:45:14 $
+ * last change: $Author: jsc $ $Date: 2001-08-17 13:08:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,11 +66,14 @@
#include <vector>
#include <set>
-#include <fstream.h>
+#include <stdio.h>
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
+#ifndef _RTL_STRBUF_HXX_
+#include <rtl/strbuf.hxx>
+#endif
struct EqualString
{
@@ -122,25 +125,67 @@ inline const ::rtl::OString inGlobalSet(sal_Char* p)
return inGlobalSet( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(p) ) );
}
+::rtl::OUString convertToFileUrl(const ::rtl::OString& fileName);
+
//*************************************************************************
// FileStream
//*************************************************************************
-class FileStream : public ofstream
+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
{
public:
FileStream();
- FileStream(const ::rtl::OString& name, sal_Int32 nMode = ios::out | ios::trunc);
+ FileStream(const ::rtl::OString& name, FileAccessMode nMode = FAM_READWRITE);
virtual ~FileStream();
sal_Bool isValid();
- void openFile(const ::rtl::OString& name, sal_Int32 nMode = ios::out | ios::trunc);
- void closeFile();
+ void open(const ::rtl::OString& name, FileAccessMode nMode = FAM_READWRITE);
+ 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;
+ }
+
protected:
- ::rtl::OString m_name;
+ const sal_Char* checkAccessMode(FileAccessMode mode);
+
+ FILE* m_pFile;
+ ::rtl::OString m_name;
};
#endif // _CODEMAKER_GLOBAL_HXX_