1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #pragma warning (disable : 4800)
33 #ifndef _PATH_HELPER_HXX_
34 #define _PATH_HELPER_HXX_
36 #include "path_helper.h"
37 #include <rtl/ustring.hxx>
38 #include <rtl/allocator.hxx>
43 /*******************************************************************
44 osl_systemPathEnsureSeparator
45 Adds a trailing path separator to the given system path if not
46 already there and if the path is not the root path or a logical
48 ******************************************************************/
50 inline void systemPathEnsureSeparator(/*inout*/ rtl::OUString
& Path
)
52 osl_systemPathEnsureSeparator(&Path
.pData
);
55 /*******************************************************************
56 osl_systemPathRemoveSeparator
57 Removes the last separator from the given system path if any and
58 if the path is not the root path '\'
59 ******************************************************************/
61 inline void systemPathRemoveSeparator(/*inout*/ rtl::OUString
& Path
)
63 osl_systemPathRemoveSeparator(&Path
.pData
);
66 /*******************************************************************
67 osl_systemPathIsLogicalDrivePattern
68 ******************************************************************/
70 inline bool systemPathIsLogicalDrivePattern(/*in*/ const rtl::OUString
& path
)
72 return osl_systemPathIsLogicalDrivePattern(path
.pData
);
75 /*******************************************************************
77 ******************************************************************/
82 sal_uInt32 m_nCharNum
;
85 LongPathBuffer( const LongPathBuffer
& );
86 LongPathBuffer
& operator=( const LongPathBuffer
& );
89 LongPathBuffer( sal_uInt32 nCharNum
)
90 : m_pBuffer( reinterpret_cast<T
*>( rtl_allocateMemory( nCharNum
* sizeof( T
) ) ) )
91 , m_nCharNum( nCharNum
)
93 OSL_ENSURE( m_pBuffer
, "Can not allocate the buffer!" );
99 rtl_freeMemory( m_pBuffer
);
103 sal_uInt32
getBufSizeInSymbols()
115 template< class U
, class T
> U
mingw_reinterpret_cast(LongPathBuffer
<T
>& a
) { return reinterpret_cast<U
>(static_cast<T
*>(a
)); }
117 } // end namespace osl
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */