diff options
Diffstat (limited to 'sal/inc')
-rw-r--r-- | sal/inc/cppunittester/protectorfactory.hxx | 22 | ||||
-rw-r--r-- | sal/inc/osl/thread.h | 2 | ||||
-rw-r--r-- | sal/inc/rtl/math.hxx | 8 | ||||
-rw-r--r-- | sal/inc/rtl/strbuf.h | 16 | ||||
-rw-r--r-- | sal/inc/rtl/strbuf.hxx | 40 | ||||
-rw-r--r-- | sal/inc/rtl/string.hxx | 24 | ||||
-rw-r--r-- | sal/inc/rtl/ustrbuf.h | 15 | ||||
-rw-r--r-- | sal/inc/rtl/ustrbuf.hxx | 23 | ||||
-rw-r--r-- | sal/inc/sal/cppunit.h | 12 | ||||
-rw-r--r-- | sal/inc/sal/main.h | 94 | ||||
-rw-r--r-- | sal/inc/sal/types.h | 2 | ||||
-rw-r--r-- | sal/inc/systools/win32/AutoSystoolInit.hxx | 65 | ||||
-rw-r--r-- | sal/inc/systools/win32/StrConvert.h | 135 | ||||
-rw-r--r-- | sal/inc/systools/win32/SyncObjects.hxx | 113 | ||||
-rw-r--r-- | sal/inc/systools/win32/uwinapi.h | 52 |
15 files changed, 238 insertions, 385 deletions
diff --git a/sal/inc/cppunittester/protectorfactory.hxx b/sal/inc/cppunittester/protectorfactory.hxx index c309dbe8a..916f89f74 100644 --- a/sal/inc/cppunittester/protectorfactory.hxx +++ b/sal/inc/cppunittester/protectorfactory.hxx @@ -32,14 +32,20 @@ #include "sal/types.h" -namespace CppUnit { class Protector; } - -namespace cppunittester { - -// The type of CppUnit::Protector factory functions that can be plugged into -// cppunittester: -extern "C" typedef CppUnit::Protector * SAL_CALL ProtectorFactory(); - +#include <cppunit/Protector.h> + +namespace cppunittester +{ + class LibreOfficeProtector : public CppUnit::Protector + { + public: + virtual bool protect(CppUnit::Functor const & functor) = 0; + using CppUnit::Protector::protect; + }; + + // The type of CppUnit::Protector factory functions that can be plugged into + // cppunittester: + extern "C" typedef LibreOfficeProtector * SAL_CALL ProtectorFactory(); } #endif diff --git a/sal/inc/osl/thread.h b/sal/inc/osl/thread.h index 4cd058b28..9e088e6e4 100644 --- a/sal/inc/osl/thread.h +++ b/sal/inc/osl/thread.h @@ -68,7 +68,7 @@ typedef enum typedef sal_uInt32 oslThreadIdentifier; -typedef sal_uInt32 oslThreadKey; +typedef void* oslThreadKey; /** Create the thread, using the function-ptr pWorker as its main (worker) function. This functions receives in diff --git a/sal/inc/rtl/math.hxx b/sal/inc/rtl/math.hxx index f7ef3b5bb..82fab5b87 100644 --- a/sal/inc/rtl/math.hxx +++ b/sal/inc/rtl/math.hxx @@ -142,8 +142,8 @@ inline void doubleToUStringBuffer( rtl::OUStringBuffer& rBuffer, double fValue, */ inline double stringToDouble(rtl::OString const & rString, sal_Char cDecSeparator, sal_Char cGroupSeparator, - rtl_math_ConversionStatus * pStatus, - sal_Int32 * pParsedEnd) + rtl_math_ConversionStatus * pStatus = 0, + sal_Int32 * pParsedEnd = 0) { sal_Char const * pBegin = rString.getStr(); sal_Char const * pEnd; @@ -161,8 +161,8 @@ inline double stringToDouble(rtl::OString const & rString, inline double stringToDouble(rtl::OUString const & rString, sal_Unicode cDecSeparator, sal_Unicode cGroupSeparator, - rtl_math_ConversionStatus * pStatus, - sal_Int32 * pParsedEnd) + rtl_math_ConversionStatus * pStatus = 0, + sal_Int32 * pParsedEnd = 0) { sal_Unicode const * pBegin = rString.getStr(); sal_Unicode const * pEnd; diff --git a/sal/inc/rtl/strbuf.h b/sal/inc/rtl/strbuf.h index 0156e6ed7..9543b9a57 100644 --- a/sal/inc/rtl/strbuf.h +++ b/sal/inc/rtl/strbuf.h @@ -105,7 +105,6 @@ void SAL_CALL rtl_stringbuffer_ensureCapacity( /*inout*/rtl_String ** This, @param offset the offset. @param ch a character array. @param len the number of characters to append. - @return this string buffer. */ void SAL_CALL rtl_stringbuffer_insert( /*inout*/rtl_String ** This, /*inout*/sal_Int32 * capacity, @@ -113,6 +112,21 @@ void SAL_CALL rtl_stringbuffer_insert( /*inout*/rtl_String ** This, const sal_Char * str, sal_Int32 len); +/** + Removes the characters in a substring of this sequence. + + The substring begins at the specified <code>start</code> and + is <code>len</code> characters long. + + start must be >= 0 && <= This->length + + @param start The beginning index, inclusive + @param len The substring length + */ +void SAL_CALL rtl_stringbuffer_remove( /*inout*/rtl_String ** This, + sal_Int32 start, + sal_Int32 len ); + #ifdef __cplusplus } #endif diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx index 21ff60391..3a26c1b74 100644 --- a/sal/inc/rtl/strbuf.hxx +++ b/sal/inc/rtl/strbuf.hxx @@ -54,7 +54,7 @@ namespace rtl is compiled to the equivalent of: <p><blockquote><pre> x = new OStringBuffer().append("a").append(4).append("c") - .toString() + .makeStringAndClear() </pre></blockquote><p> The principal operations on a <code>OStringBuffer</code> are the <code>append</code> and <code>insert</code> methods, which are @@ -135,6 +135,25 @@ public: rtl_stringbuffer_newFromStr_WithLength( &pData, value.getStr(), value.getLength() ); } + /** + Constructs a string buffer so that it represents the same + sequence of characters as the string argument. + + The initial + capacity of the string buffer is <code>16</code> plus length + + @param value a character array. + @param length the number of character which should be copied. + The character array length must be greater or + equal than this value. + */ + OStringBuffer(const sal_Char * value, sal_Int32 length) + : pData(NULL) + , nCapacity( length + 16 ) + { + rtl_stringbuffer_newFromStr_WithLength( &pData, value, length ); + } + /** Assign to this a copy of value. */ OStringBuffer& operator = ( const OStringBuffer& value ) @@ -651,6 +670,25 @@ public: sal_Char sz[RTL_STR_MAX_VALUEOFDOUBLE]; return insert( offset, sz, rtl_str_valueOfDouble( sz, d ) ); } + + /** + Removes the characters in a substring of this sequence. + + The substring begins at the specified <code>start</code> and + is <code>len</code> characters long. + + start must be >= 0 && <= getLength() && <= end + + @param start The beginning index, inclusive + @param len The substring length + @return this string buffer. + */ + OStringBuffer & remove( sal_Int32 start, sal_Int32 len ) + { + rtl_stringbuffer_remove( &pData, start, len ); + return *this; + } + private: /** A pointer to the data structur which contains the data. diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx index 186b515ca..ba66e0958 100644 --- a/sal/inc/rtl/string.hxx +++ b/sal/inc/rtl/string.hxx @@ -341,6 +341,30 @@ public: } /** + Perform a comparison of two strings. + + The result is true if and only if second string + represents the same sequence of characters as the first string. + The ASCII string must be NULL-terminated and must be greater or + equal as length. + This function can't be used for language specific comparison. + + + @param value a character array. + @param length the length of the character array. + @return sal_True if the strings are equal; + sal_False, otherwise. + */ + sal_Bool equalsL( const sal_Char* value, sal_Int32 length ) const SAL_THROW(()) + { + if ( pData->length != length ) + return sal_False; + + return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length, + value, length ) == 0; + } + + /** Perform a ASCII lowercase comparison of two strings. The result is true if and only if second string diff --git a/sal/inc/rtl/ustrbuf.h b/sal/inc/rtl/ustrbuf.h index dfd8019ee..260db4f30 100644 --- a/sal/inc/rtl/ustrbuf.h +++ b/sal/inc/rtl/ustrbuf.h @@ -159,6 +159,21 @@ void SAL_CALL rtl_uStringbuffer_insert_ascii( /*inout*/rtl_uString ** This, const sal_Char * str, sal_Int32 len); +/** + Removes the characters in a substring of this sequence. + + The substring begins at the specified <code>start</code> and + is <code>len</code> characters long. + + start must be >= 0 && <= This->length + + @param start The beginning index, inclusive + @param len The substring length + */ +void SAL_CALL rtl_uStringbuffer_remove( /*inout*/rtl_uString ** This, + sal_Int32 start, + sal_Int32 len ); + #ifdef __cplusplus } #endif diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx index b6160ccc9..756959748 100644 --- a/sal/inc/rtl/ustrbuf.hxx +++ b/sal/inc/rtl/ustrbuf.hxx @@ -53,7 +53,7 @@ namespace rtl is compiled to the equivalent of: <p><blockquote><pre> x = new OUStringBuffer().append("a").append(4).append("c") - .toString() + .makeStringAndClear() </pre></blockquote><p> The principal operations on a <code>OUStringBuffer</code> are the <code>append</code> and <code>insert</code> methods, which are @@ -95,7 +95,7 @@ public: Allocates a new string buffer that contains the same sequence of characters as the string buffer argument. - @param value a <code>OStringBuffer</code>. + @param value a <code>OUStringBuffer</code>. */ OUStringBuffer( const OUStringBuffer & value ) : pData(NULL) @@ -280,7 +280,6 @@ public: */ const OUString toString() const { return OUString(pData->buffer); } - /** The character at the specified index of this string buffer is set to <code>ch</code>. @@ -739,6 +738,24 @@ public: return *this; } + /** + Removes the characters in a substring of this sequence. + + The substring begins at the specified <code>start</code> and + is <code>len</code> characters long. + + start must be >= 0 && <= This->length + + @param start The beginning index, inclusive + @param len The substring length + @return this string buffer. + */ + OUStringBuffer & remove( sal_Int32 start, sal_Int32 len ) + { + rtl_uStringbuffer_remove( &pData, start, len ); + return *this; + } + /** Allows access to the internal data of this OUStringBuffer, for effective manipulation. diff --git a/sal/inc/sal/cppunit.h b/sal/inc/sal/cppunit.h index d0b3e6099..41c465d62 100644 --- a/sal/inc/sal/cppunit.h +++ b/sal/inc/sal/cppunit.h @@ -35,6 +35,18 @@ #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/plugin/TestPlugIn.h> +#include <cppunit/Protector.h> + +namespace cppunittester +{ + class LibreOfficeProtecter : public CppUnit::Protector + { + public: + virtual bool protect(CppUnit::Functor const & functor) = 0; + using CppUnit::Protector::protect; + }; +} + #undef CPPUNIT_PLUGIN_EXPORT #define CPPUNIT_PLUGIN_EXPORT extern "C" SAL_DLLPUBLIC_EXPORT diff --git a/sal/inc/sal/main.h b/sal/inc/sal/main.h index bf7a82821..370cba4db 100644 --- a/sal/inc/sal/main.h +++ b/sal/inc/sal/main.h @@ -41,6 +41,82 @@ extern "C" { void SAL_CALL sal_detail_initialize(int argc, char ** argv); void SAL_CALL sal_detail_deinitialize(); +#ifdef IOS + +#include <premac.h> +#import <UIKit/UIKit.h> +#include <postmac.h> + +#define SAL_MAIN_WITH_ARGS_IMPL \ +int SAL_CALL main(int argc, char ** argv) \ +{ \ + sal_detail_initialize(argc, argv); \ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; \ + int retVal = UIApplicationMain (argc, argv, @"UIApplication", @"salAppDelegate"); \ + [pool release]; \ + sal_detail_deinitialize(); \ + return retVal; \ +} \ + \ +static int sal_main_with_args(int argc, char **argv); \ + \ +static int \ +sal_main(void) \ +{ \ + char *argv[] = { NULL }; \ + return sal_main_with_args(0, argv); \ +} + +#define SAL_MAIN_IMPL \ +int SAL_CALL main(int argc, char ** argv) \ +{ \ + sal_detail_initialize(argc, argv); \ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; \ + int retVal = UIApplicationMain (argc, argv, @"UIApplication", @"salAppDelegate"); \ + [pool release]; \ + sal_detail_deinitialize(); \ + return retVal; \ +} + +#define SAL_MAIN_WITH_GUI_IMPL \ +int SAL_CALL main(int argc, char ** argv) \ +{ \ + sal_detail_initialize(argc, argv); \ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; \ + int retVal = sal_main(); \ + [pool release]; \ + sal_detail_deinitialize(); \ + return retVal; \ +} + +@interface salAppDelegate : NSObject <UIApplicationDelegate> { +} +@property (nonatomic, retain) UIWindow *window; +@end + +static int sal_main(void); + +@implementation salAppDelegate + +@synthesize window=_window; + +- (BOOL)application: (UIApplication *) application didFinishLaunchingWithOptions: (NSDictionary *) launchOptions +{ + UIWindow *uiw = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + uiw.backgroundColor = [UIColor redColor]; + self.window = uiw; + [uiw release]; + + sal_main(); + + [self.window makeKeyAndVisible]; + return YES; +} + +@end + +#else + #define SAL_MAIN_WITH_ARGS_IMPL \ int SAL_CALL main(int argc, char ** argv) \ { \ @@ -61,6 +137,11 @@ int SAL_CALL main(int argc, char ** argv) \ return ret; \ } +#define SAL_MAIN_WITH_GUI_IMPL SAL_MAIN_IMPL + +#endif + + /* Definition macros for CRT entries */ #ifdef SAL_W32 @@ -118,6 +199,19 @@ int WINAPI WinMain( HINSTANCE _hinst, HINSTANCE _dummy, char* _cmdline, int _nsh SAL_WIN_WinMain \ static int SAL_CALL sal_main(void) +/* Use SAL_IMPLEMENT_MAIN_WITH_GUI in programs that actually have a + * VCL GUI. The difference is meaningful only for iOS support, which + * of course is a highly experimental work in progress. So actually, + * don't bother, just let developers who care for iOS take care of it + * when/if necessary. + */ + +#define SAL_IMPLEMENT_MAIN_WITH_GUI() \ + static int SAL_CALL sal_main(void); \ + SAL_MAIN_WITH_GUI_IMPL \ + SAL_WIN_WinMain \ + static int SAL_CALL sal_main(void) + /* "How to use" Examples: diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h index 0b1a8f69c..1266c9ba7 100644 --- a/sal/inc/sal/types.h +++ b/sal/inc/sal/types.h @@ -241,8 +241,6 @@ typedef void * sal_Handle; #if defined(SAL_W32) || defined(SAL_UNX) # define SAL_MAX_ENUM 0x7fffffff -#elif defined(SAL_W16) -# define SAL_MAX_ENUM 0x7fff #endif #if defined(_MSC_VER) || defined(__MINGW32__) diff --git a/sal/inc/systools/win32/AutoSystoolInit.hxx b/sal/inc/systools/win32/AutoSystoolInit.hxx deleted file mode 100644 index cb22bd54c..000000000 --- a/sal/inc/systools/win32/AutoSystoolInit.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _AUTOSYSTOOLINIT_HXX_ -#define _AUTOSYSTOOLINIT_HXX_ - -#ifndef _WINDOWS_ -#include <windows.h> -#endif - -//------------------------------------------------------------------------ -// class used to automatically initialize/deinitialize the systools -//------------------------------------------------------------------------ - -class OAutoSystoolInit -{ - typedef void ( WINAPI *LPFNINIT_T )( ); - typedef void ( WINAPI *LPFNDEINIT_T )( ); - -public: - OAutoSystoolInit( LPFNINIT_T lpfnInit, LPFNDEINIT_T lpfnDeInit ) : - m_lpfnDeInit( lpfnDeInit ) - { - if ( NULL != lpfnInit ) - lpfnInit( ); - } - - ~OAutoSystoolInit( ) - { - if ( NULL != m_lpfnDeInit ) - m_lpfnDeInit( ); - } - -private: - LPFNDEINIT_T m_lpfnDeInit; // address of the deinit function -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/inc/systools/win32/StrConvert.h b/sal/inc/systools/win32/StrConvert.h deleted file mode 100644 index 25ebec06e..000000000 --- a/sal/inc/systools/win32/StrConvert.h +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _STRCONVERT_H_ -#define _STRCONVERT_H_ - -#include <windows.h> - -#ifdef NDEBUG -#define STRCONVERT_H_HAD_NDEBUG -#undef NDEBUG -#endif -#if OSL_DEBUG_LEVEL == 0 -#define NDEBUG -#endif -#include <assert.h> - -#ifdef __cplusplus -extern "C"{ -#endif - -int AllocNecessarySpaceAndCopyWStr2Str( LPCWSTR lpcwstrString, LPSTR* lppStr ); -int AllocSpaceAndCopyWStr2Str( LPCWSTR lpcwstrString, DWORD nWCharsToCopy, LPSTR* lppStr ); -int CalcLenDblNullTerminatedWStr( LPCWSTR lpcwstrString ); -int CalcLenDblNullTerminatedStr( LPCSTR lpcstrString ); -void FreeSpaceStr( LPSTR lpszString ); - -/* WC2MB allocates a sufficient amount of memory on stack and converts - the wide char parameter to multi byte string using the actual code - page. - - @Param: wcStr - a wide char string - mbStr - the corresponding multi byte string - - NOTE: due to the use of _alloca, this must be a macro and no function -*/ - -#define WC2MB( wcStr, mbStr ) \ -if( wcStr ) \ -{ \ - int needed = WideCharToMultiByte( CP_ACP, 0, wcStr, -1, NULL, 0, NULL, NULL ); \ - if( needed > 0 ) \ - { \ - int copied; \ - mbStr = _alloca( needed * sizeof( CHAR ) ); \ - copied = WideCharToMultiByte( CP_ACP, 0, wcStr, -1, mbStr, needed, NULL, NULL ); \ - assert( copied == needed ); \ - } \ -} - - -/* WideCharListGetMultiByteLength - calculates the needed length of a corresponding the multi byte string - list for a wide char string list. - - @Param: cp - the code page to use for convertion. - wcList - a double '\0' terminated wide char string list. -*/ - -int WideCharListGetMultiByteLength( UINT codepage, LPCWSTR wcList ); - -/* WideCharListToMultiByteList - converts a double '\0' terminated list of wide char strings to a - multi byte string list. - - @Param: cp - the code page to use for convertion. - wcList - a double '\0' terminated wide char string list. - mbList - a double '\0' terminated multi byte string list. - dwSize - size of buffer for multi byte string list. -*/ - -int WideCharListToMultiByteList( UINT codepage, LPCWSTR wcList, LPSTR mbList, DWORD dwSize ); - - -/* WCL2MBL allocates a sufficient amount of memory on stack and converts - the wide char list parameter to multi byte string list using the actual - code page. - - @Param: wcList - a wide char string list - mbList - the corresponding multi byte string list - - NOTE: due to the use of _alloca, this must be a macro and no function -*/ - -#define WCL2MBL( wcList, mbList ) \ -if( wcList ) \ -{ \ - int needed = WideCharListGetMultiByteLength( CP_ACP, wcList ); \ - if( needed > 0 ) \ - { \ - int copied; \ - mbList = _alloca( needed * sizeof( CHAR ) ); \ - copied = WideCharListToMultiByteList( CP_ACP, wcList, mbList, needed ); \ - assert( copied == needed ); \ - } \ -} - -#ifdef __cplusplus -} -#endif - -// Restore NDEBUG state -#ifdef STRCONVERT_H_HAD_NDEBUG -#define NDEBUG -#else -#undef NDEBUG -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/inc/systools/win32/SyncObjects.hxx b/sal/inc/systools/win32/SyncObjects.hxx deleted file mode 100644 index 273321581..000000000 --- a/sal/inc/systools/win32/SyncObjects.hxx +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _SYNCOBJECTS_HXX_ -#define _SYNCOBJECTS_HXX_ - -//------------------------------------------------------------------------ -// includes -//------------------------------------------------------------------------ - -#include <windows.h> - -//------------------------------------------------------------------------ -// a simple helper template for automatic locking/unlocking -//------------------------------------------------------------------------ - -template< class LOCK > -class CLockGuard -{ -public: - CLockGuard( LOCK* aLock ) : - m_pLock( aLock ) - { - m_pLock->Lock( ); - } - - ~CLockGuard( ) - { - m_pLock->Unlock( ); - } - -private: - LOCK* m_pLock; -}; - -//------------------------------------------------------------------------ -// a interface base class for different locking sub classes -//------------------------------------------------------------------------ - -class CSyncObject -{ -public: - virtual ~CSyncObject( ) = 0; - - virtual int Lock( ) = 0; - virtual int Unlock( ) = 0; -}; - -//------------------------------------------------------------------------ -// if no synchronization is necessary this class will be used -// declaring the functions as inline safes runtime overhead -//------------------------------------------------------------------------ - -class CNullLock -{ -public: - inline virtual ~CNullLock ( ) {}; - inline virtual int Lock( ) {}; - inline virtual int Unlock() {}; -}; - -//------------------------------------------------------------------------ -// a minimal wrapper for a win32 critical section -//------------------------------------------------------------------------ - -class CCriticalSection : public CSyncObject -{ -public: - CCriticalSection( ); - virtual ~CCriticalSection( ); - - // both functions return always 0 - // because the win32 critsec functions - // don't return any return code - virtual int Lock( ); - virtual int Unlock( ); - -private: - CRITICAL_SECTION m_critSec; -}; - - -typedef CLockGuard< CSyncObject > SyncObjLockGuard_t; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/inc/systools/win32/uwinapi.h b/sal/inc/systools/win32/uwinapi.h index a9e6a9fde..6c7e76304 100644 --- a/sal/inc/systools/win32/uwinapi.h +++ b/sal/inc/systools/win32/uwinapi.h @@ -51,58 +51,6 @@ #endif #endif -/** GetUserDomain - -The GetUserDomain function retrieves the name of the NT domain the user is -logged in. - -Parameters - @param lpBuffer - [out] Pointer to a buffer that receives a null-terminated string - containing the domain name. - @param nBufferSize - [in] Specifies the size, in TCHARs, of the buffer pointed to - by the lpBuffer parameter. - - -Return Values - @return - If the function succeeds, the return value is the number of TCHARs stored - into the buffer pointed to by lpBuffer, not including the terminating - null character. - - If the domain name can't be retrieved, the return value is zero. - - If the buffer pointed to by lpBuffer is not large enough, the return value - is the buffer size, in TCHARs, required to hold the value string and its - terminating null character. - -Remarks - Windows 95/98/Me: If the user is not logged in onto a NT domain server - the name of the workgroup is returned. - -Requirements - Windows NT/2000/XP: Included in Windows NT 4 and later. - Windows 95/98/Me: Included in Windows 95 and later. - Header: Declared in Uwinapi.h; include Uwinapi.h. - Library: Use Uwinapi.lib. - Unicode: Implemented as Unicode and ANSI versions on Windows 95/98/Me/NT/2000/XP. - -See Also -@see -*/ - -EXTERN_C WINBASEAPI DWORD WINAPI GetUserDomainA( LPSTR lpBuffer, DWORD nBuffserSize ); -EXTERN_C WINBASEAPI DWORD WINAPI GetUserDomainW( LPWSTR lpBuffer, DWORD nBuffserSize ); - -#ifdef UNICODE -#define GetUserDomain GetUserDomainW -#else -#define GetUserDomain GetUserDomainA -#endif - -EXTERN_C WINBASEAPI DWORD WINAPI GetProcessId( HANDLE hProcess ); - #ifdef __cplusplus inline bool IsValidHandle(HANDLE handle) |