1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: global.hxx,v $
10 * $Revision: 1.7.8.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CODEMAKER_GLOBAL_HXX_
32 #define _CODEMAKER_GLOBAL_HXX_
39 #include <rtl/ustring.hxx>
40 #include <rtl/strbuf.hxx>
44 sal_Bool
operator()(const ::rtl::OString
& str1
, const ::rtl::OString
& str2
) const
46 return (str1
== str2
);
52 size_t operator()(const ::rtl::OString
& str
) const
54 return str
.hashCode();
60 sal_Bool
operator()(const ::rtl::OString
& str1
, const ::rtl::OString
& str2
) const
66 #if defined(_MSC_VER) && _MSC_VER < 1200
67 typedef ::std::new_alloc NewAlloc
;
71 typedef ::std::list
< ::rtl::OString
> StringList
;
72 typedef ::std::vector
< ::rtl::OString
> StringVector
;
73 typedef ::std::set
< ::rtl::OString
, LessString
> StringSet
;
75 ::rtl::OString
makeTempName();
77 const ::rtl::OString
inGlobalSet(const ::rtl::OUString
& r
);
78 inline const ::rtl::OString
inGlobalSet(sal_Char
* p
)
80 return inGlobalSet( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(p
) ) );
83 ::rtl::OUString
convertToFileUrl(const ::rtl::OString
& fileName
);
85 //*************************************************************************
87 //*************************************************************************
93 FAM_READWRITE_EXIST
, // "r+"
94 FAM_READWRITE
, // "w+"
95 FAM_READAPPEND
// "a+"
98 class FileStream
//: public ofstream
102 virtual ~FileStream();
106 void open(const ::rtl::OString
& name
, FileAccessMode nMode
= FAM_READWRITE
);
109 ::rtl::OString
getName() { return m_name
; }
112 friend FileStream
&operator<<(FileStream
& o
, sal_uInt32 i
)
113 { fprintf(o
.m_pFile
, "%lu", sal::static_int_cast
< unsigned long >(i
));
116 friend FileStream
&operator<<(FileStream
& o
, char const * s
)
117 { fprintf(o
.m_pFile
, "%s", s
);
120 friend FileStream
&operator<<(FileStream
& o
, ::rtl::OString
* s
)
121 { fprintf(o
.m_pFile
, "%s", s
->getStr());
124 friend FileStream
&operator<<(FileStream
& o
, const ::rtl::OString
& s
)
125 { fprintf(o
.m_pFile
, "%s", s
.getStr());
128 friend FileStream
&operator<<(FileStream
& o
, ::rtl::OStringBuffer
* s
)
129 { fprintf(o
.m_pFile
, "%s", s
->getStr());
132 friend FileStream
&operator<<(FileStream
& o
, const ::rtl::OStringBuffer
& s
)
133 { fprintf(o
.m_pFile
, "%s", s
.getStr());
138 const sal_Char
* checkAccessMode(FileAccessMode mode
);
141 ::rtl::OString m_name
;
144 #endif // _CODEMAKER_GLOBAL_HXX_