1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #pragma warning (disable : 4800)
24 #ifndef _PATH_HELPER_HXX_
25 #define _PATH_HELPER_HXX_
27 #include "path_helper.h"
28 #include <rtl/ustring.hxx>
29 #include <rtl/allocator.hxx>
34 /*******************************************************************
35 osl_systemPathEnsureSeparator
36 Adds a trailing path separator to the given system path if not
37 already there and if the path is not the root path or a logical
39 ******************************************************************/
41 inline void systemPathEnsureSeparator(/*inout*/ rtl::OUString
& Path
)
43 osl_systemPathEnsureSeparator(&Path
.pData
);
46 /*******************************************************************
47 osl_systemPathRemoveSeparator
48 Removes the last separator from the given system path if any and
49 if the path is not the root path '\'
50 ******************************************************************/
52 inline void systemPathRemoveSeparator(/*inout*/ rtl::OUString
& Path
)
54 osl_systemPathRemoveSeparator(&Path
.pData
);
57 /*******************************************************************
58 osl_systemPathIsLogicalDrivePattern
59 ******************************************************************/
61 inline bool systemPathIsLogicalDrivePattern(/*in*/ const rtl::OUString
& path
)
63 return osl_systemPathIsLogicalDrivePattern(path
.pData
);
66 /*******************************************************************
68 ******************************************************************/
73 sal_uInt32 m_nCharNum
;
76 LongPathBuffer( const LongPathBuffer
& );
77 LongPathBuffer
& operator=( const LongPathBuffer
& );
80 LongPathBuffer( sal_uInt32 nCharNum
)
81 : m_pBuffer( reinterpret_cast<T
*>( rtl_allocateMemory( nCharNum
* sizeof( T
) ) ) )
82 , m_nCharNum( nCharNum
)
84 OSL_ENSURE( m_pBuffer
, "Can not allocate the buffer!" );
90 rtl_freeMemory( m_pBuffer
);
94 sal_uInt32
getBufSizeInSymbols()
106 template< class U
, class T
> U
mingw_reinterpret_cast(LongPathBuffer
<T
>& a
) { return reinterpret_cast<U
>(static_cast<T
*>(a
)); }
108 } // end namespace osl
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */