Bump version to 6.4-15
[LibreOffice.git] / include / codemaker / global.hxx
blobd453a0e0b59ccd508341ebe58bbf2f6af4c5f8c4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CODEMAKER_GLOBAL_HXX
21 #define INCLUDED_CODEMAKER_GLOBAL_HXX
23 #include <list>
24 #include <vector>
25 #include <set>
27 #include <stdio.h>
29 #include <osl/file.hxx>
30 #include <rtl/ustring.hxx>
31 #include <rtl/strbuf.hxx>
33 typedef ::std::list< ::rtl::OString > StringList;
34 typedef ::std::vector< ::rtl::OString > StringVector;
35 typedef ::std::set< ::rtl::OString > StringSet;
38 // FileStream
40 class FileStream final
42 public:
43 FileStream();
44 ~FileStream();
46 bool isValid() const;
48 void createTempFile(const ::rtl::OString& sPath);
49 void close();
51 const ::rtl::OString& getName() const { return m_name; }
53 bool write(void const * buffer, sal_uInt64 size);
55 // friend functions
56 friend FileStream &operator<<(FileStream& o, sal_uInt32 i);
57 friend FileStream &operator<<(FileStream& o, char const * s);
58 friend FileStream &operator<<(FileStream& o, ::rtl::OString const * s);
59 friend FileStream &operator<<(FileStream& o, const ::rtl::OString& s);
60 friend FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer const * s);
61 friend FileStream &operator<<(FileStream& o, const ::rtl::OStringBuffer& s);
62 friend FileStream & operator <<(FileStream & out, rtl::OUString const & s);
64 private:
65 oslFileHandle m_file;
66 ::rtl::OString m_name;
70 // Helper functions
72 ::rtl::OString getTempDir(const ::rtl::OString& sFileName);
74 ::rtl::OString createFileNameFromType(const ::rtl::OString& destination,
75 const ::rtl::OString& type,
76 const ::rtl::OString& postfix);
78 bool fileExists(const ::rtl::OString& fileName);
79 bool makeValidTypeFile(const ::rtl::OString& targetFileName,
80 const ::rtl::OString& tmpFileName,
81 bool bFileCheck);
82 bool removeTypeFile(const ::rtl::OString& fileName);
84 ::rtl::OUString convertToFileUrl(const ::rtl::OString& fileName);
86 class CannotDumpException final {
87 public:
88 CannotDumpException(OUString const & message): message_(message) {}
90 ~CannotDumpException() throw ();
92 const OUString& getMessage() const { return message_; }
94 private:
95 OUString message_;
98 #endif // INCLUDED_CODEMAKER_GLOBAL_HXX
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */