Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / generic / print / psputil.hxx
blob01a2d4f3cb3137be19b60101dfddab9b78c0cbd2
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_VCL_GENERIC_PRINT_PSPUTIL_HXX
21 #define INCLUDED_VCL_GENERIC_PRINT_PSPUTIL_HXX
23 #include "osl/file.hxx"
25 #include "rtl/ustring.hxx"
26 #include "rtl/string.hxx"
27 #include "rtl/tencinfo.h"
28 #include "rtl/textcvt.h"
30 #include <map>
32 namespace psp {
35 * string convenience routines
36 * sizeof(pBuffer) must be at least 2 Bytes, 0x00 <= nValue <= 0xFF,
37 * effective buffer of get*ValueOf() is NOT NULL-terminated
39 sal_Int32 getHexValueOf (sal_Int32 nValue, sal_Char* pBuffer);
40 sal_Int32 getAlignedHexValueOf (sal_Int32 nValue, sal_Char* pBuffer);
41 sal_Int32 getValueOf (sal_Int32 nValue, sal_Char* pBuffer);
42 sal_Int32 appendStr (const sal_Char* pSrc, sal_Char* pDst);
44 bool WritePS (osl::File* pFile, const sal_Char* pString);
45 bool WritePS (osl::File* pFile, const sal_Char* pString, sal_uInt64 nInLength);
46 bool WritePS (osl::File* pFile, const OString &rString);
47 bool WritePS (osl::File* pFile, const OUString &rString);
49 class ConverterFactory
52 public:
53 ConverterFactory();
54 ~ConverterFactory();
55 rtl_UnicodeToTextConverter Get (rtl_TextEncoding nEncoding);
56 sal_Size Convert (const sal_Unicode *pText, int nTextLen,
57 unsigned char *pBuffer, sal_Size nBufferSize,
58 rtl_TextEncoding nEncoding);
59 private:
61 std::map< rtl_TextEncoding, rtl_UnicodeToTextConverter > m_aConverters;
64 ConverterFactory& GetConverterFactory ();
66 } /* namespace psp */
68 #endif // INCLUDED_VCL_GENERIC_PRINT_PSPUTIL_HXX
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */