summaryrefslogtreecommitdiff
path: root/sal/osl/w32/path_helper.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'sal/osl/w32/path_helper.hxx')
-rw-r--r--sal/osl/w32/path_helper.hxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/sal/osl/w32/path_helper.hxx b/sal/osl/w32/path_helper.hxx
index 106f2a76f043..64b0ac573da3 100644
--- a/sal/osl/w32/path_helper.hxx
+++ b/sal/osl/w32/path_helper.hxx
@@ -34,6 +34,7 @@
#include "path_helper.h"
#include <rtl/ustring.hxx>
+#include <rtl/allocator.hxx>
namespace osl
{
@@ -70,6 +71,45 @@ inline bool systemPathIsLogicalDrivePattern(/*in*/ const rtl::OUString& path)
return osl_systemPathIsLogicalDrivePattern(path.pData);
}
+/*******************************************************************
+ LongPathBuffer
+ ******************************************************************/
+template< class T >
+class LongPathBuffer
+{
+ T* m_pBuffer;
+ sal_uInt32 m_nCharNum;
+
+ LongPathBuffer();
+ LongPathBuffer( const LongPathBuffer& );
+ LongPathBuffer& operator=( const LongPathBuffer& );
+
+public:
+ LongPathBuffer( sal_uInt32 nCharNum )
+ : m_pBuffer( reinterpret_cast<T*>( rtl_allocateMemory( nCharNum * sizeof( T ) ) ) )
+ , m_nCharNum( nCharNum )
+ {
+ OSL_ENSURE( m_pBuffer, "Can not allocate the buffer!" );
+ }
+
+ ~LongPathBuffer()
+ {
+ if ( m_pBuffer )
+ rtl_freeMemory( m_pBuffer );
+ m_pBuffer = 0;
+ }
+
+ sal_uInt32 getBufSizeInSymbols()
+ {
+ return m_nCharNum;
+ }
+
+ operator T* ()
+ {
+ return m_pBuffer;
+ }
+};
+
} // end namespace osl
#endif