From 9399c662f36c385b0c705eb34e636a9aec450282 Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien
+ +There are a few main goals:
+ +1.The path specifications always have to be absolut. Any usage of relative path +specifications is forbidden. Most operating systems provide a +"Current Directory" per process. This is the reason why relative path +specifications can cause problems in multithreading environments.
+ +2.Proprietary notations of file paths are not supported. Every path notation +must follow the UNC notation. The directory divider is the slash character.
+ +3.The caller cannot get any information whether a file system is case sensitive, +case preserving or not. The operating system implementation itself should +determine if it can map case-insensitive paths. The case correct notation of +a filename or file path is part of the "File Info". This case correct name +can be used as a unique key if neccessary.
+
+4. Obtaining information about files or volumes is controlled by a
+bitmask which specifies which fields are of interest. Due to performance
+issues it is not recommended to obtain information which is not needed.
+But if the operating system provides more information anyway the
+implementation can set more fields on output as were requested. It is in the
+responsibility of the caller to decide if he uses this additional information
+or not. But he should do so to prevent further unnecessary calls if the information
+is already there.
+
+The input bitmask supports a flag osl_FileStatus_Mask_Validate
which
+can be used to force retrieving uncached validated information. Setting this flag
+when calling osl_getFileStatus
in combination with no other flag is
+a synonym for a "FileExists". This should only be done when processing a single file
+(f.e. before opening) and NEVER during enumeration of directory contents on any step
+of information processing. This would change the runtime behaviour from O(n) to
+O(n*n/2) on nearly every file system.
+On Windows NT reading the contents of an directory with 7000 entries and
+getting full information about every file only takes 0.6 seconds. Specifying the
+flag osl_FileStatus_Mask_Validate
for each entry will increase the
+time to 180 seconds (!!!).
+
+*/
+
+
+
+/* Error codes according to errno */
+
+typedef enum {
+ osl_File_E_None,
+ osl_File_E_PERM,
+ osl_File_E_NOENT,
+ osl_File_E_SRCH,
+ osl_File_E_INTR,
+ osl_File_E_IO,
+ osl_File_E_NXIO,
+ osl_File_E_2BIG,
+ osl_File_E_NOEXEC,
+ osl_File_E_BADF,
+ osl_File_E_CHILD,
+ osl_File_E_AGAIN,
+ osl_File_E_NOMEM,
+ osl_File_E_ACCES,
+ osl_File_E_FAULT,
+ osl_File_E_BUSY,
+ osl_File_E_EXIST,
+ osl_File_E_XDEV,
+ osl_File_E_NODEV,
+ osl_File_E_NOTDIR,
+ osl_File_E_ISDIR,
+ osl_File_E_INVAL,
+ osl_File_E_NFILE,
+ osl_File_E_MFILE,
+ osl_File_E_NOTTY,
+ osl_File_E_FBIG,
+ osl_File_E_NOSPC,
+ osl_File_E_SPIPE,
+ osl_File_E_ROFS,
+ osl_File_E_MLINK,
+ osl_File_E_PIPE,
+ osl_File_E_DOM,
+ osl_File_E_RANGE,
+ osl_File_E_DEADLK,
+ osl_File_E_NAMETOOLONG,
+ osl_File_E_NOLCK,
+ osl_File_E_NOSYS,
+ osl_File_E_NOTEMPTY,
+ osl_File_E_LOOP,
+ osl_File_E_ILSEQ,
+ osl_File_E_NOLINK,
+ osl_File_E_MULTIHOP,
+ osl_File_E_USERS,
+ osl_File_E_OVERFLOW,
+ osl_File_E_invalidError, /* unmapped error: always last entry in enum! */
+ osl_File_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslFileError;
+
+typedef void *oslDirectory;
+typedef void *oslDirectoryItem;
+
+/** Opens a directory for enumerating its contents.
+
+ @param strDirenctoryPath [in] Denotes the full qualified path of the directory follwing the UNC
+ notation. The path devider is '/'. Relative path specifications are not allowed.
+ @param pDirectory [out] on success it receives a handle used for subsequent calls by osl_getNextDirectoryItem
+ on error it receives NULL. The handle has to be released by a call to osl_closeDirectory
.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_NOENT the specified path doesn't exist
+ osl_File_E_NOTDIR the specified path is not an directory
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_ACCES permission denied
+ osl_File_E_MFILE too many open files used by the process
+ osl_File_E_NFILE too many open files in the system
+ osl_File_E_NAMETOOLONG File name too long
+ osl_File_E_LOOP Too many symbolic links encountered
+
+ @see osl_getNextDirectoryItem
+ @see osl_closeDirectory
+*/
+
+oslFileError SAL_CALL osl_openDirectory( rtl_uString *strDirectoryPath, oslDirectory *pDirectory);
+
+/** Retrieves the next item(s) of a previously openend directory. All handles have an initial
+ refcount of 1.
+
+ @param Directory [in] is the directory handle received from a previous call to osl_openDirectory
.
+ @param pItem [out] On success it receives a handle that can be used for subsequent calls to osl_getFileStatus
.
+ The handle has to be released by a call to osl_releaseDirectoryItem
.
+ @param uHint [in] With this parameter the caller can tell the implementation that (s)he
+ is going to call this function uHint times afterwards. This enables the implementation to
+ get the information for more than one file and cache it until the next calls.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_NOENT No more entries in this directory
+ + These errorcodes can (eventually) be returned:
+ osl_File_E_BADF oslDirectory parameter is not valid
+ osl_File_E_OVERFLOW Value too large for defined data type
+
+ @see osl_releaseDirectoryItem
+ @see osl_acquireDirectoryItem
+ @see osl_getDirectoryItem
+ @see osl_getFileStatus
+ @see osl_createDirectoryItemFromHandle
+*/
+
+oslFileError SAL_CALL osl_getNextDirectoryItem(
+ oslDirectory Directory,
+ oslDirectoryItem *pItem,
+ sal_uInt32 uHint
+ );
+
+
+/** Releases a directory handle
+
+ @param Directory [in] a handle received by a call to osl_openDirectory
.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_NOMEM not enough memory for allocating structures
+ + These errorcodes can (eventually) be returned:
+ osl_File_E_BADF Invalid oslDirectory parameter
+ osl_File_E_INTR function call was interrupted
+
+ @see osl_openDirectory
+*/
+
+oslFileError SAL_CALL osl_closeDirectory(
+ oslDirectory Directory
+ );
+
+
+/** Retrieves a single directory item handle with an initial refcount of 1.
+
+ @param strFilePath [in] absolute file path following the notation explained in the documentation for
+ osl_openDirectory
. Due to performance issues it is not recommended to use this function
+ while enumerating the contents of a directory. In this case use osl_getNextDirectoryItem
instead.
+ @param pItem [out] on success it receives a handle which can be used for subsequent calls to osl_getFileStatus
.
+ The handle has to be released by a call to osl_releaseDirectoryItem
.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_ACCES permission denied
+ osl_File_E_MFILE too many open files used by the process
+ osl_File_E_NFILE too many open files in the system
+ osl_File_E_NOENT No such file or directory
+ osl_File_E_LOOP Too many symbolic links encountered
+ osl_File_E_NAMETOOLONG File name too long
+ osl_File_E_NOTDIR A component of the path prefix of path is not a directory
+ + These errorcodes can (eventually) be returned:
+ osl_File_E_IO I/O error
+ osl_File_E_MULTIHOP Multihop attempted
+ osl_File_E_NOLINK Link has been severed
+ osl_File_E_FAULT Bad address
+ osl_File_E_INTR function call was interrupted
+
+
+ @see osl_releaseDirectoryItem
+ @see osl_acquireDirectoryItem
+ @see osl_getFileStatus
+ @see osl_getNextDirectoryItem
+ @see osl_createDirectoryItemFromHandle
+*/
+
+oslFileError SAL_CALL osl_getDirectoryItem(
+ rtl_uString *strFilePath,
+ oslDirectoryItem *pItem
+ );
+
+
+/** Increases the refcount of a directory item handle
+
+ @param Item [in] a handle received by a call to osl_getDirectoryItem
, osl_getNextDirectoryItem
or
+ osl_createDirectoryItemFromHandle
.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_getDirectoryItem
+ @see osl_getNextDirectoryItem
+ @see osl_createDirectoryItemFromHandle
+ @see osl_releaseDirectoryItem
+*/
+
+oslFileError SAL_CALL osl_acquireDirectoryItem( oslDirectoryItem Item );
+
+/** Decreases the refcount of a directory item handle and releases the data if the
+ refcount reaches 0.
+
+ @param Item [in] a handle received by a call to osl_getDirectoryItem
, osl_getNextDirectoryItem
or
+ osl_createDirectoryItemFromHandle
.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_getDirectoryItem
+ @see osl_getNextDirectoryItem
+ @see osl_acquireDirectoryItemosl_createDirectoryItemFromHandle
+ @see osl_acquireDirectoryItem
+*/
+
+oslFileError SAL_CALL osl_releaseDirectoryItem( oslDirectoryItem Item );
+
+/* File types */
+
+typedef enum {
+ osl_File_Type_Directory,
+ osl_File_Type_Volume,
+ osl_File_Type_Regular,
+ osl_File_Type_Fifo,
+ osl_File_Type_Socket,
+ osl_File_Type_Link,
+ osl_File_Type_Special,
+ osl_File_Type_Unknown
+} oslFileType;
+
+/* File attributes */
+#define osl_File_Attribute_ReadOnly 0x00000001
+#define osl_File_Attribute_Hidden 0x00000002
+#define osl_File_Attribute_Executable 0x00000010
+#define osl_File_Attribute_GrpWrite 0x00000020
+#define osl_File_Attribute_GrpRead 0x00000040
+#define osl_File_Attribute_GrpExe 0x00000080
+#define osl_File_Attribute_OwnWrite 0x00000100
+#define osl_File_Attribute_OwnRead 0x00000200
+#define osl_File_Attribute_OwnExe 0x00000400
+#define osl_File_Attribute_OthWrite 0x00000800
+#define osl_File_Attribute_OthRead 0x00001000
+#define osl_File_Attribute_OthExe 0x00002000
+
+/* Flags specifying which fields to retreive by osl_getFileStatus */
+
+#define osl_FileStatus_Mask_Type 0x00000001
+#define osl_FileStatus_Mask_Attributes 0x00000002
+#define osl_FileStatus_Mask_CreationTime 0x00000010
+#define osl_FileStatus_Mask_AccessTime 0x00000020
+#define osl_FileStatus_Mask_ModifyTime 0x00000040
+#define osl_FileStatus_Mask_FileSize 0x00000080
+#define osl_FileStatus_Mask_FileName 0x00000100
+#define osl_FileStatus_Mask_FilePath 0x00000200
+#define osl_FileStatus_Mask_NativePath 0x00000400
+#define osl_FileStatus_Mask_All 0x7FFFFFFF
+#define osl_FileStatus_Mask_Validate 0x80000000
+
+
+typedef
+
+/** Structure containing information about files and directories
+
+ @see osl_getFileStatus
+ @see oslFileType
+*/
+
+struct _oslFileStatus {
+/** Must be initialized with the size in bytes of the structure before passing it to any function */
+ sal_uInt32 uStructSize;
+/** Determines which members of the structure contain valid data */
+ sal_uInt32 uValidFields;
+/** The type of the file (file, directory, volume). */
+ oslFileType eType;
+/** File attributes */
+ sal_uInt64 uAttributes;
+/** First creation time in nanoseconds since 1/1/1970. Can be the last modify time depending on
+ platform or file system. */
+ TimeValue aCreationTime;
+/** Last access time in nanoseconds since 1/1/1970. Can be the last modify time depending on
+ platform or file system. */
+ TimeValue aAccessTime;
+/** Last modify time in nanoseconds since 1/1/1970. */
+ TimeValue aModifyTime;
+/** Size in bytes of the file. Zero for directories and volumes. */
+ sal_uInt64 uFileSize;
+/** Case correct name of the file. Should be set to zero before calling osl_getFileStatus
+ and released after usage. */
+ rtl_uString *strFileName;
+/** Full path of the file in UNC notation. Should be set to zero before calling osl_getFileStatus
+ and released after usage. */
+ rtl_uString **pstrFilePath;
+/** Full path of the file in platform depending notation. This is for displaying the path in the UI.
+ Should be set to zero before calling osl_getFileStatus
+ and released after usage. */
+ rtl_uString **pstrNativePath;
+} oslFileStatus;
+
+/** Retrieves information about a single file or directory
+
+ @param Item [in] a handle received by a previous call to osl_getDirectoryItem
,
+ osl_getNextDirectoryItem
or osl_createDirectoryItemFromHandle
.
+ @param pStatus [in/out] points to a structure which receives the information of the file or directory
+ represented by the handle Item
. The member uStructSize
has to be initialized to
+ sizeof(oslFileStatus)
before calling this function.
+ @param uFieldMask [in] specifies which fields of the structure pointed to by pStatus
+ are of interest to the caller.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_LOOP Too many symbolic links encountered
+ osl_File_E_ACCES Permission denied
+ osl_File_E_NOENT No such file or directory
+ osl_File_E_NAMETOOLONG file name too long
+ + These errorcodes can (eventually) be returned:
+ osl_File_E_BADF Invalid oslDirectoryItem parameter
+ osl_File_E_FAULT Bad address
+ osl_File_E_OVERFLOW Value too large for defined data type
+ osl_File_E_INTR function call was interrupted
+ osl_File_E_NOLINK Link has been severed
+ osl_File_E_MULTIHOP Components of path require hopping to multiple remote machines and the file system does not allow it
+ osl_File_E_MFILE too many open files used by the process
+ osl_File_E_NFILE too many open files in the system
+ osl_File_E_NOSPC No space left on device
+ osl_File_E_NXIO No such device or address
+ osl_File_E_IO I/O error
+ osl_File_E_NOSYS Function not implemented
+
+ @see osl_getDirectoryItem
+ @see osl_getNextDirectoryItem
+ @see osl_createDirectoryItemFromHandle
+ @see oslFileStatus
+*/
+
+oslFileError SAL_CALL osl_getFileStatus( oslDirectoryItem Item, oslFileStatus *pStatus, sal_uInt32 uFieldMask );
+
+
+typedef void *oslVolumeDeviceHandle;
+
+
+oslFileError SAL_CALL osl_unmountVolumeDevice( oslVolumeDeviceHandle Handle );
+
+oslFileError SAL_CALL osl_automountVolumeDevice( oslVolumeDeviceHandle Handle );
+
+oslFileError SAL_CALL osl_releaseVolumeDeviceHandle( oslVolumeDeviceHandle Handle );
+
+oslFileError SAL_CALL osl_acquireVolumeDeviceHandle( oslVolumeDeviceHandle Handle );
+
+/** Gets the normalized absolute file system path where a device is mounted to.
+
+ @param Handle [in] Device handle of the volume retrieved with osl_getVolumeInformation
.
+ @param pstrPath [out] Receives the path where the device is mounted to.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_ACCES permission denied
+ osl_File_E_NXIO No such device or address
+ osl_File_E_NODEV No such device
+ osl_File_E_NOENT No such file or directory
+
+ These errorcodes can (eventually) be returned:
+ osl_File_E_FAULT Bad address
+ osl_FilE_E_INTR function call was interrupted
+ osl_File_E_IO I/O error
+ osl_File_E_MULTIHOP Multihop attempted
+ osl_File_E_NOLINK Link has been severed
+ osl_File_E_EOVERFLOW Value too large for defined data type
+
+ @see osl_getVolumeInformation
+ @see osl_automountVolumeDevice
+ @see osl_unmountVolumeDevice
+*/
+
+oslFileError SAL_CALL osl_getVolumeDeviceMountPath( oslVolumeDeviceHandle Handle, rtl_uString **pstrPath );
+
+/* Volume attributes */
+
+#define osl_Volume_Attribute_Removeable 0x00000001L
+#define osl_Volume_Attribute_Remote 0x00000002L
+
+/* Flags specifying which fields to retreive by osl_getVolumeInfo */
+
+#define osl_VolumeInfo_Mask_Attributes 0x00000001L
+#define osl_VolumeInfo_Mask_TotalSpace 0x00000002L
+#define osl_VolumeInfo_Mask_UsedSpace 0x00000004L
+#define osl_VolumeInfo_Mask_FreeSpace 0x00000008L
+#define osl_VolumeInfo_Mask_MaxNameLength 0x00000010L
+#define osl_VolumeInfo_Mask_MaxPathLength 0x00000020L
+#define osl_VolumeInfo_Mask_FileSystemName 0x00000040L
+#define osl_VolumeInfo_Mask_DeviceHandle 0x00000080L
+
+typedef
+
+/** Structure containing information about volumes
+
+ @see osl_getVolumeInformation
+ @see oslFileType
+*/
+
+struct _oslVolumeInfo {
+/** Must be initialized with the size in bytes of the structure before passing it to any function */
+ sal_uInt32 uStructSize;
+/** Determines which members of the structure contain valid data */
+ sal_uInt32 uValidFields;
+/** Attributes of the volume (remote and/or removable) */
+ sal_uInt32 uAttributes;
+/** Total availiable space on the volume for the current process/user */
+ sal_uInt64 uTotalSpace;
+/** Used space on the volume for the current process/user */
+ sal_uInt64 uUsedSpace;
+/** Free space on the volume for the current process/user */
+ sal_uInt64 uFreeSpace;
+/** Maximum length of file name of a single item */
+ sal_uInt32 uMaxNameLength;
+/** Maximum length of a full quallified path in UNC notation */
+ sal_uInt32 uMaxPathLength;
+/** Name of the file system type. Should be set to zero before calling osl_getVolumeInformation
+ and released after usage. */
+ rtl_uString **pstrFileSystemName;
+/** Handle of underlying device */
+ oslVolumeDeviceHandle *pDeviceHandle;
+} oslVolumeInfo;
+
+
+/** Retrieves information about a volume. A volume can either be a mount point, a network
+ resource or a drive depending on operating system and file system. Before calling this
+ function osl_getFileStatus
should be called to determine if the type is
+ osl_file_Type_Volume
.
+
+ @param strDirectory [in] Full qualified UNC path to the volume
+ @param pInfo [out] On success it receives information about the volume.
+ @param uFieldMask [in] Specifies which members of the structure should be filled
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_INVAL the format of the parameters was not valid
+ + These errorcodes can (eventually) be returned:
+ osl_File_E_NOTDIR Not a directory
+ osl_File_E_NAMETOOLONG File name too long
+ osl_File_E_NOENT No such file or directory
+ osl_File_E_ACCES permission denied
+ osl_File_E_LOOP Too many symbolic links encountered
+ ols_File_E_FAULT Bad address
+ osl_File_E_IO I/O error
+ osl_File_E_NOSYS Function not implemented
+ osl_File_E_MULTIHOP Multihop attempted
+ osl_File_E_NOLINK Link has been severed
+ osl_File_E_INTR function call was interrupted
+ + @see osl_getFileStatus + @see oslVolumeInfo +*/ + +oslFileError SAL_CALL osl_getVolumeInformation( rtl_uString *strDirectory, oslVolumeInfo *pInfo, sal_uInt32 uFieldMask ); + +typedef void *oslFileHandle; + +/* Open flags */ + +#define osl_File_OpenFlag_Read 0x00000001L +#define osl_File_OpenFlag_Write 0x00000002L +#define osl_File_OpenFlag_Create 0x00000004L + +/** Opens a file. + + @param strPath [in] Full qualified path to the file to open. Only regular files + can be openend. + @param pHandle [out] On success it receives a handle to the open file. + @param uFlags [in] Specifies the open mode. + @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_NAMETOOLONG pathname was too long
+ osl_File_E_NOENT No such file or directory
+ osl_File_E_ACCES permission denied
+ + These errorcodes can (eventually) be returned:
+ osl_File_E_NOTDIR Not a directory
+ osl_File_E_NXIO No such device or address
+ osl_File_E_NODEV No such device
+ osl_File_E_ROFS Read-only file system
+ osl_File_E_TXTBSY Text file busy
+ osl_File_E_FAULT Bad address
+ osl_File_E_LOOP Too many symbolic links encountered
+ osl_File_E_NOSPC No space left on device
+ osl_File_E_ISDIR Is a directory
+ osl_File_E_MFILE too many open files used by the process
+ osl_File_E_NFILE too many open files in the system
+ osl_File_E_DQUOT Quota exceeded
+ osl_File_E_EXIST File exists
+ osl_FilE_E_INTR function call was interrupted
+ osl_File_E_IO I/O error
+ osl_File_E_MULTIHOP Multihop attempted
+ osl_File_E_NOLINK Link has been severed
+ osl_File_E_EOVERFLOW Value too large for defined data type
+
+ @see osl_closeFile
+ @see osl_setFilePos
+ @see osl_getFilePos
+ @see osl_readFile
+ @see osl_writeFile
+ @see osl_setFileSize
+ @see osl_createDirectoryItemFromHandle
+*/
+
+oslFileError SAL_CALL osl_openFile( rtl_uString *strPath, oslFileHandle *pHandle, sal_uInt32 uFlags );
+
+#define osl_Pos_Absolut 1
+#define osl_Pos_Current 2
+#define osl_Pos_End 3
+
+/** Sets the internal position pointer of an open file.
+ @param Handle [in] Handle of an open file received by a previous call to osl_openFile
.
+ @param uHow [in] Distance to move the internal position pointer (from uPos).
+ @param uPos [in] Absolute position from the beginning of the file.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_OVERFLOW The resulting file offset would be a value which cannot
+ be represented correctly for regular files
+ + @see osl_openFile + @see osl_getFilePos +*/ + +oslFileError SAL_CALL osl_setFilePos( oslFileHandle Handle, sal_uInt32 uHow, sal_uInt64 uPos ); + + +/** Retrieves the current position of the internal pointer of an open file. + @param Handle [in] Handle to an open file. + @param pPos [out] On Success it receives the current position of the file pointer. + @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_OVERFLOW The resulting file offset would be a value which cannot
+ be represented correctly for regular files
+ + @see osl_openFile + @see osl_setFilePos + @see osl_readFile + @see osl_writeFile +*/ + +oslFileError SAL_CALL osl_getFilePos( oslFileHandle Handle, sal_uInt64 *pPos ); + + +/** Sets the file size of an open file. The file can be truncated or enlarged by the function. + The position of the file pointer is not affeced by this function. + @param Handle [in] Handle to an open file. + @param uSize [int] New size in bytes. + @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_OVERFLOW The resulting file offset would be a value which cannot
+ be represented correctly for regular files
+
+ @see osl_openFile
+ @see osl_setFilePos
+ @see osl_getFileStatus
+*/
+
+oslFileError SAL_CALL osl_setFileSize( oslFileHandle Handle, sal_uInt64 uSize );
+
+
+/** Reads a number of bytes from a file. The internal file pointer is increased by the number of bytes
+ read.
+ @param Handle [in] Handle to an open file.
+ @param pBuffer [out] Points to a buffer which receives data. The buffer must be large enough
+ to hold uBytesRequested
bytes.
+ @param uBytesRequested [in] Number of bytes which should be retrieved.
+ @param pBytesRead [out] On success the number of bytes which have actually been retrieved.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+
+ These errorcodes can (eventually) be returned:
+ osl_File_E_INTR function call was interrupted
+ osl_File_E_IO I/O error
+ osl_File_E_ISDIR Is a directory
+ osl_File_E_BADF Bad file
+ osl_File_E_FAULT Bad address
+ osl_File_E_AGAIN Operation would block
+ osl_File_E_NOLINK Link has been severed
+ + @see osl_openFile + @see osl_writeFile + @see osl_setFilePos +*/ + +oslFileError SAL_CALL osl_readFile( oslFileHandle Handle, void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64 *pBytesRead ); + + +/** Writes a number of bytes to a file. The internal file pointer is increased by the number of bytes + read. + @param Handle [in] Handle to an open file. + @param pBuffer [int] Points to a buffer which contains the data. + @param uBytesToWrite [in] Number of bytes which should be written. + @param pBytesWritten [out] On success the number of bytes which have actually been written. + + @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_FBIG File too large
+ osl_File_E_DQUOT Quota exceeded
+ + These errorcodes can (eventually) be returned:
+ osl_File_E_AGAIN Operation would block
+ osl_File_E_BADF Bad file
+ osl_File_E_FAULT Bad address
+ osl_File_E_INTR function call was interrupted
+ osl_File_E_IO I/O error
+ osl_File_E_NOLCK No record locks available
+ osl_File_E_NOLINK Link has been severed
+ osl_File_E_NOSPC No space left on device
+ osl_File_E_NXIO No such device or address
+
+ @see osl_openFile
+ @see osl_readFile
+ @see osl_setFilePos
+*/
+
+oslFileError SAL_CALL osl_writeFile( oslFileHandle Handle, const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64 *pBytesWritten );
+
+
+/** Closes an open file.
+ @param Handle [in] Handle to a file previously open by a call to osl_openFile
.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ + These errorcodes can (eventually) be returned:
+ osl_File_E_BADF Bad file
+ osl_File_E_INTR function call was interrupted
+ osl_File_E_NOLINK Link has been severed
+ osl_File_E_NOSPC No space left on device
+ osl_File_E_IO I/O error
+*/
+
+oslFileError SAL_CALL osl_closeFile( oslFileHandle Handle );
+
+
+/** Get a directory item handle from an open file with an initial refcount of 1.
+ @param Handle [in] A Hdnale to an open file.
+ @param pItem [out] On success it receives a handle to a directory item which can be used
+ in subsequent calls to osl_getFileStatus
.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ + @see osl_openFile + @see osl_getFileStatus + @see osl_acquireDirectoryItem + @see osl_releaseDirectoryItem +*/ + +oslFileError SAL_CALL osl_createDirectoryItemFromHandle( oslFileHandle Handle, oslDirectoryItem *pItem ); + + +/** Creates a directory. + @param strPatg [in] Full qualified UNC path of the directory to create. + + @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_EXIST File exists
+ osl_File_E_ACCES Permission denied
+ osl_File_E_NAMETOOLONG File name too long
+ osl_File_E_NOENT No such file or directory
+ osl_File_E_NOTDIR Not a directory
+ osl_File_E_ROFS Read-only file system
+ osl_File_E_NOSPC No space left on device
+ osl_File_E_DQUOT Quota exceeded
+ + These errorcodes can (eventually) be returned:
+ osl_File_E_LOOP Too many symbolic links encountered
+ osl_File_E_FAULT Bad address
+ osl_FileE_IO I/O error
+ osl_File_E_MLINK Too many links
+ osl_File_E_MULTIHOP Multihop attempted
+ osl_File_E_NOLINK Link has been severed
+ + @see osl_removeDirectory +*/ + +oslFileError SAL_CALL osl_createDirectory( rtl_uString* strPath ); + +/** Removes an empty directory. + + @param strPath [in] Full qualified UNC path of the directory. + @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_PERM Operation not permitted
+ osl_File_E_ACCES Permission denied
+ osl_File_E_NOENT No such file or directory
+ osl_File_E_NOTDIR Not a directory
+ osl_File_E_NOTEMPTY Directory not empty
+ + These errorcodes can (eventually) be returned:
+ osl_File_E_FAULT Bad address
+ osl_File_E_NAMETOOLONG File name too long
+ osl_File_E_BUSY Device or resource busy
+ osl_File_E_ROFS Read-only file system
+ osl_File_E_LOOP Too many symbolic links encountered
+ osl_File_E_BUSY Device or resource busy
+ osl_File_E_EXIST File exists
+ osl_File_E_IO I/O error
+ osl_File_E_MULTIHOP Multihop attempted
+ osl_File_E_NOLINK Link has been severed
+ + @see osl_createDirectory +*/ + +oslFileError SAL_CALL osl_removeDirectory( rtl_uString* strPath ); + + +/** Removes (erases) a regular file. + + @param strPath [in] Full qualified UNC path of the directory. + @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_ACCES Permission denied
+ osl_File_E_PERM Operation not permitted
+ osl_File_E_NAMETOOLONG File name too long
+ osl_File_E_NOENT No such file or directory
+ osl_File_E_ISDIR Is a directory
+ osl_File_E_ROFS Read-only file system
+ + These errorcodes can (eventually) be returned:
+ osl_File_E_FAULT Bad address
+ osl_File_E_LOOP Too many symbolic links encountered
+ osl_File_E_IO I/O error
+ osl_File_E_BUSY Device or resource busy
+ osl_File_E_INTR function call was interrupted
+ osl_File_E_LOOP Too many symbolic links encountered
+ osl_File_E_MULTIHOP Multihop attempted
+ osl_File_E_NOLINK Link has been severed
+ osl_File_E_TXTBSY Text file busy
+*/ + +oslFileError SAL_CALL osl_removeFile( rtl_uString* strPath ); + + +/** Copies a file to a new destination. Copies only files not directories. No assumptions should + be made about preserving attributes or file time. + @param strPath [in] Full qualified UNC path of the source file. + @param strDestPath [in] Full qualified UNC path of the destination file. A directory is + NOT a valid destination file ! + @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_ACCES Permission denied
+ osl_File_E_PERM Operation not permitted
+ osl_File_E_NAMETOOLONG File name too long
+ osl_File_E_NOENT No such file or directory
+ osl_File_E_ISDIR Is a directory
+ osl_File_E_ROFS Read-only file system
+ + @see osl_moveFile + @see osl_removeFile + @see osl_createDirectory +*/ + +oslFileError SAL_CALL osl_copyFile( rtl_uString* strPath, rtl_uString *strDestPath ); + + +/** Moves a file or directory to a new destination or renames it. File time and attributes + are preserved. + @param strPath [in] Full qualified UNC path of the source file. + @param strDestPath [in] Full qualified UNC path of the destination file. An existing directory + is NOT a valid destination ! + @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_ACCES Permission denied
+ osl_File_E_PERM Operation not permitted
+ osl_File_E_NAMETOOLONG File name too long
+ osl_File_E_NOENT No such file or directory
+ osl_File_E_ROFS Read-only file system
+ + @see osl_copyFile +*/ + +oslFileError SAL_CALL osl_moveFile( rtl_uString* strPath, rtl_uString *strDestPath ); + + +/** Determines a valid unused canonical name for a requested name. Depending on file system and operation system + the illegal characters are replaced by valid ones. If a file or directory with the requested name + already exists a new name is generated following the common rules on the actual file system and + operating system. + + @param strRequested [in] Requested name of a file or directory. + @param strValid [out] On success receives a name which is unused and valid on the actual operating system and + file system. + + @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_getFileStatus
+*/
+
+oslFileError SAL_CALL osl_getCanonicalName( rtl_uString *strRequested, rtl_uString **strValid);
+
+
+/** Converts a path relative to a given directory into an full qualified UNC path.
+
+ @param strDirBase [in] Base directory to which the relative path is related to.
+ @param strRelative[in] Path of a file or directory relative to the directory path
+ specified by strDirBase
.
+ @param strAbsolute [out] On success it receives the full qualified UNC path of the
+ requested relative path.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_NOMEM not enough memory for allocating structures
+ osl_File_E_NOTDIR Not a directory
+ osl_File_E_ACCES Permission denied
+ osl_File_E_NOENT No such file or directory
+ osl_File_E_NAMETOOLONG File name too long
+ + + These errorcodes can (eventually) be returned:
+ osl_File_E_OVERFLOW Value too large for defined data type
+ osl_File_E_FAULT Bad address
+ osl_File_E_INTR function call was interrupted
+ osl_File_E_LOOP Too many symbolic links encountered
+ osl_File_E_MULTIHOP Multihop attempted
+ osl_File_E_NOLINK Link has been severed
+ + @see osl_getFileStatus +*/ + + +oslFileError SAL_CALL osl_getAbsolutePath( rtl_uString* strDirBase, rtl_uString *strRelative, rtl_uString **strAbsolute ); + + +/** Converts a system dependent path into a full qualified UNC path + + @param strSysPath[in] System dependent path of a file or a directory + @param strPath[out] On success it receives the full qualified UNC path + + @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_getCanonicalName
+
+*/
+
+oslFileError SAL_CALL osl_normalizePath( rtl_uString *strSysPath, rtl_uString **strPath );
+
+
+/** Converts a File URL into a full qualified UNC path
+
+ @param urlPath[in] System dependent path of a file or a directory
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_normalizePath
+
+*/
+
+oslFileError SAL_CALL osl_getNormalizedPathFromFileURL( rtl_uString *urlPath, rtl_uString **strPath );
+
+
+/** Converts a full qualified UNC path into a FileURL
+
+ @param dir[in] System dependent path of a file or a directory
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_normalizePath
+ @see osl_getNormalizedPathFromFileURL
+
+*/
+
+oslFileError SAL_CALL osl_getFileURLFromNormalizedPath( rtl_uString *normPath, rtl_uString **strPath);
+
+
+/** Searches a full qualified UNC-Path/File
+
+ @param filePath[in] System dependent path / Normalized Path / File-URL or file or relative directory
+ @param searchPath[in] Paths, in which a given file has to be searched. These paths are only for the search of a
+ file or a relative path, otherwise it will be ignored. If it is set to NULL or while using the
+ search path the search failed the function searches for a matching file in all system directories and in the directories
+ listed in the PATH environment variable
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_NOTDIR Not a directory
+ osl_File_E_NOENT No such file or directory not found
+ @see osl_normalizePath
+
+*/
+
+/** Converts a full qualified UNC path into a system dependend path
+
+ @param dir[in] Full qualified UNC path
+ @param strPath[out] On success it receives the system dependent path of a file or a directory
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+
+ @see osl_normalizePath
+ @see osl_getNormalizedPathFromFileURL
+
+*/
+
+oslFileError SAL_CALL osl_getSystemPathFromNormalizedPath( rtl_uString *normPath, rtl_uString **strPath);
+
+oslFileError SAL_CALL osl_searchNormalizedPath( rtl_uString *filePath, rtl_uString *searchPath, rtl_uString **strPath );
+
+
+/** Sets file-attributes
+
+ @param filePath[in] Path of the file
+ @param uAttributes[in] Attributes of the file to be set
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ @see osl_getFileStatus
+
+*/
+
+oslFileError SAL_CALL osl_setFileAttributes( rtl_uString *filePath, sal_uInt64 uAttributes );
+
+
+/** Sets file-Time
+
+ @param filePath[in] Path of the file
+ @param aCreationTime[in] creation time of the given file
+ @param aLastAccessTime[in] time of the last access of the given file
+ @param aLastWriteTime[in] time of the last modifying of the given file
+
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:
+ osl_File_E_INVAL the format of the parameters was not valid
+ osl_File_E_INVAL the format of the parameters was not valid
+ E_INVAL the format of the parameters was not valid
+
+
+ These errorcodes can (eventually) be returned:
+ E_OVERFLOW Value too large for defined data type
+ E_FAULT Bad address
+
+ @see getStatus
+ */
+
+ static inline RC getAbsolutePath( const ::rtl::OUString& strDirBase, const ::rtl::OUString& strRelative, ::rtl::OUString& strAbsolute )
+ {
+ return (RC) osl_getAbsolutePath( strDirBase.pData, strRelative.pData, &strAbsolute.pData );
+ }
+
+ /** Converts a system dependent path into a full qualified UNC path
+
+ @param strSysPath[in] System dependent path of a file or a directory
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+ E_INVAL the format of the parameters was not valid
+ E_INVAL the format of the parameters was not valid
+ E_INVAL the format of the parameters was not valid
+ E_INVAL the format of the parameters was not valid
+ E_NOMEM not enough memory for allocating structures
+ E_ISDIR Is a directory
+
+ These errorcodes can (eventually) be returned:
+ E_NOTDIR Not a directory
+
+ @see close
+ @see setPos
+ @see getPos
+ @see read
+ @see write
+ @see setSize
+ */
+
+ #define OpenFlag_Read osl_File_OpenFlag_Read
+ #define OpenFlag_Write osl_File_OpenFlag_Write
+ #define OpenFlag_Create osl_File_OpenFlag_Create
+
+ inline RC open( sal_uInt32 uFlags )
+ {
+ return (RC) osl_openFile( _aPath.pData, &_pData, uFlags );
+ }
+
+ /** Closes an open file.
+
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ These errorcodes can (eventually) be returned:
+ E_BADF Bad file
+ */
+
+ inline RC close()
+ {
+ oslFileError Error = osl_File_E_BADF;
+
+ if( _pData )
+ {
+ Error=osl_closeFile( _pData );
+ _pData = NULL;
+ }
+
+ return (RC) Error;
+ };
+
+
+ /** Sets the internal position pointer of an open file.
+ @param uHow [in] Distance to move the internal position pointer (from uPos).
+ @param uPos [in] Absolute position from the beginning of the file.
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ @see open
+ @see getPos
+ */
+
+ #define Pos_Absolut osl_Pos_Absolut
+ #define Pos_Current osl_Pos_Current
+ #define Pos_End osl_Pos_End
+
+ inline RC setPos( sal_uInt32 uHow, sal_uInt64 uPos )
+ {
+ return (RC) osl_setFilePos( _pData, uHow, uPos );
+ }
+
+ /** Retrieves the current position of the internal pointer of an open file.
+ @param pPos [out] On Success it receives the current position of the file pointer.
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ @see open
+ @see setPos
+ @see read
+ @see write
+ */
+
+ inline RC getPos( sal_uInt64& uPos )
+ {
+ return (RC) osl_getFilePos( _pData, &uPos );
+ }
+
+
+ /** Sets the file size of an open file. The file can be truncated or enlarged by the function.
+ The position of the file pointer is not affeced by this function.
+ @param uSize [int] New size in bytes.
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ @see open
+ @see setPos
+ @see getStatus
+ */
+
+ inline RC setSize( sal_uInt64 uSize )
+ {
+ return (RC) osl_setFileSize( _pData, uSize );
+ }
+
+ /** Reads a number of bytes from a file. The internal file pointer is increased by the number of bytes
+ read.
+ @param pBuffer [out] Points to a buffer which receives data. The buffer must be large enough
+ to hold
+ E_INVAL the format of the parameters was not valid
+ E_INTR function call was interrupted
+
+ @see open
+ @see write
+ @see setPos
+ */
+
+ inline RC read( void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64& rBytesRead )
+ {
+ return (RC) osl_readFile( _pData, pBuffer, uBytesRequested, &rBytesRead );
+ }
+
+ /** Writes a number of bytes to a file. The internal file pointer is increased by the number of bytes
+ read.
+ @param pBuffer [in] Points to a buffer which contains the data.
+ @param uBytesToWrite [in] Number of bytes which should be written.
+ @param rBytesWritten [out] On success the number of bytes which have actually been written.
+
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ These errorcodes can (eventually) be returned:
+ E_AGAIN Operation would block
+
+ @see openFile
+ @see readFile
+ @see setFilePos
+ */
+
+ inline RC write(const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64& rBytesWritten)
+ {
+ return (RC) osl_writeFile( _pData, pBuffer, uBytesToWrite, &rBytesWritten );
+ }
+
+ /** Copies a file to a new destination. Copies only files not directories. No assumptions should
+ be made about preserving attributes or file time.
+ @param strPath [in] Full qualified UNC path of the source file.
+ @param strDestPath [in] Full qualified UNC path of the destination file. A directory is
+ NOT a valid destination file !
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ @see move
+ @see remove
+ */
+ inline static RC copy( const ::rtl::OUString& strPath, const ::rtl::OUString& strDestPath )
+ {
+ return (RC) osl_copyFile( strPath.pData, strDestPath.pData );
+ }
+
+ /** Moves a file or directory to a new destination or renames it. File time and attributes
+ are preserved.
+ @param strPath [in] Full qualified UNC path of the source file.
+ @param strDestPath [in] Full qualified UNC path of the destination file. An existing directory
+ is NOT a valid destination !
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ @see copy
+ */
+
+ inline static RC move( const ::rtl::OUString& strPath, const ::rtl::OUString& strDestPath )
+ {
+ return (RC) osl_moveFile( strPath.pData, strDestPath.pData );
+ }
+
+ /** Removes (erases) a regular file.
+
+ @param strPath [in] Full qualified UNC path of the directory.
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ These errorcodes can (eventually) be returned:
+ E_FAULT Bad address
+ */
+
+ inline static RC remove( const ::rtl::OUString& strPath )
+ {
+ return (RC) osl_removeFile( strPath.pData );
+ }
+
+ /** Sets file-attributes
+
+ @param filePath[in] Path of the file
+ @param uAttributes[in] Attributes of the file to be set
+
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+ E_INVAL the format of the parameters was not valid
+ E_INVAL the format of the parameters was not valid
+
+ These errorcodes can (eventually) be returned:
+ E_IO I/O error
+
+
+ @see getFileStatus
+ @see Directory::getNextItem
+ */
+
+ static inline RC get( const ::rtl::OUString& strPath, DirectoryItem& rItem )
+ {
+ if( rItem._pData)
+ osl_releaseDirectoryItem( rItem._pData );
+
+ return (RC) osl_getDirectoryItem( strPath.pData, &rItem._pData );
+ }
+
+ /** Get a directory item handle from an open file.
+ @param rItem [out] On success it receives a handle to a directory item which can be used
+ in subsequent calls to
+ E_INVAL the format of the parameters was not valid
+
+ @see File
+ @see getStatus
+ */
+
+ static inline RC get( const File& rFile, DirectoryItem& rItem )
+ {
+ if( rItem._pData)
+ osl_releaseDirectoryItem( rItem._pData );
+
+ return (RC) osl_createDirectoryItemFromHandle( rFile._pData, &rItem._pData );
+ }
+
+
+ /** Retrieves information about a single file or directory
+
+ @param rStatus [in/out] reference of FileStatus class object that should be filled.
+
+ @return E_None on success otherwise one of the following errorcodes:
+ E_NOMEM not enough memory for allocating structures
+
+ These errorcodes can (eventually) be returned:
+ E_BADF Invalid oslDirectoryItem parameter
+
+ @see DirectoryItem::get
+ @see Directory::getNextItem
+ */
+
+ inline RC getFileStatus( FileStatus& rStatus )
+ {
+ return (RC) osl_getFileStatus( _pData, &rStatus._aStatus, rStatus._nMask );
+ }
+
+ friend class Directory;
+};
+
+// -----------------------------------------------------------------------------
+
+/** The directory class object provides a enumeration of DirectoryItems.
+
+ @see DirectoryItem
+ @see File
+ */
+
+class Directory: public FileBase
+{
+ oslDirectory _pData;
+ ::rtl::OUString _aPath;
+
+ /** define copy c'tor and assginment operator privat
+ */
+ Directory( Directory& );
+ Directory& operator = ( Directory& );
+
+
+public:
+
+ /** C'tor
+
+ @param strPath [in] The full qualified path of the directory in UNC notation.
+ The path delimiter is '/'. Relative paths are not allowed.
+ */
+
+ Directory( const ::rtl::OUString& strPath ): _pData( 0 ), _aPath( strPath )
+ {
+ };
+
+ /** D'tor
+ */
+
+ ~Directory()
+ {
+ close();
+ }
+
+ /** Opens a directory for enumerating its contents.
+
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ @see getNextItem
+ @see close
+ */
+
+ inline RC open()
+ {
+ return (RC) osl_openDirectory( _aPath.pData, &_pData );
+ }
+
+ /** query if directory item enumeration is valid.
+
+ @return sal_True if enumeration is valid (opened), sal_False otherwise
+
+ @see open
+ @see close
+ */
+
+ inline sal_Bool isOpen() { return _pData != NULL; };
+
+ /** closes a directory item enumeration
+
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ These errorcodes can (eventually) be returned:
+ E_BADF Invalid oslDirectory parameter
+
+ @see open
+ */
+
+ inline RC close()
+ {
+ oslFileError Error = osl_File_E_BADF;
+
+ if( _pData )
+ {
+ Error=osl_closeDirectory( _pData );
+ _pData = NULL;
+ }
+
+ return (RC) Error;
+ }
+
+
+ /** resets the directory item enumeration to the beginning.
+
+ @return the same as open
+ @see open
+ */
+
+ inline RC reset()
+ {
+ close();
+ return open();
+ }
+
+ /** Retrieves the next item of a previously openend directory
+ @param rItem [out] The class that receives the next item's data.
+ @param nHint [in] With this parameter the caller can tell the implementation that one
+ is going to call this function uHint times afterwards. This enables the implementation to
+ get the information for more than one file and cache it until the next calls.
+
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ These errorcodes can (eventually) be returned:
+ E_BADF oslDirectory parameter is not valid
+
+ @see DirectoryItem::get
+ */
+
+ inline RC getNextItem( DirectoryItem& rItem, sal_uInt32 nHint = 0 )
+ {
+ return ( RC) osl_getNextDirectoryItem( _pData, &rItem._pData, nHint );
+ }
+
+ /** Retrieves information about a volume. A volume can either be a mount point, a network
+ resource or a drive depending on operating system and file system. Before calling this
+ function
+ E_NOMEM not enough memory for allocating structures
+
+ These errorcodes can (eventually) be returned:
+ E_NOTDIR Not a directory
+
+ @see getFileStatus
+ @see VolumeInfo
+ */
+
+ inline static RC getVolumeInfo( const ::rtl::OUString& strPath, VolumeInfo& rInfo )
+ {
+ return (RC) osl_getVolumeInformation( strPath.pData, &rInfo._aInfo, rInfo._nMask );
+ }
+
+ /** Creates a directory.
+
+ @param strPath [in] Full qualified UNC path of the directory to create.
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ These errorcodes can (eventually) be returned:
+ E_LOOP Too many symbolic links encountered
+
+ @see remove
+ */
+
+ inline static RC create( const ::rtl::OUString& strPath )
+ {
+ return (RC) osl_createDirectory( strPath.pData );
+ }
+
+ /** Removes an empty directory.
+
+ @param strPath [in] Full qualified UNC path of the empty directory to remove.
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+
+ These errorcodes can (eventually) be returned:
+ E_FAULT Bad address
+
+ @see create
+ */
+
+ inline static RC remove( const ::rtl::OUString& strPath )
+ {
+ return (RC) osl_removeDirectory( strPath.pData );
+ }
+};
+
+#ifdef _USE_NAMESPACE
+}
+#endif
+
+#endif /* __cplusplus */
+#endif /* _OSL_FILE_HXX_ */
+
diff --git a/sal/inc/osl/interlck.h b/sal/inc/osl/interlck.h
new file mode 100644
index 000000000000..ca149802b026
--- /dev/null
+++ b/sal/inc/osl/interlck.h
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $RCSfile: interlck.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_INTERLOCK_H_
+#define _OSL_INTERLOCK_H_
+
+#ifndef _OSL_TYPES_H_
+# include More advanced programs will allow users to use different locales
+ * for different fields, e.g. in a spreadsheet.
+ *
+ * You create a
+ * The second argument to both constructors is a valid ISO Country
+ * Code. These codes are the upper-case two-letter codes
+ * as defined by ISO-3166.
+ * You can find a full list of these codes at a number of sites, such as:
+ *
+ * The second constructor requires a third argument--the Variant.
+ * The Variant codes are vendor and browser-specific.
+ * For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX.
+ * Where there are two variants, separate them with an underscore, and
+ * put the most important one first. For
+ * example, a Traditional Spanish collation might be referenced, with
+ * "ES", "ES", "Traditional_WIN".
+ *
+ *
+ * Because a
+ * The
+ * Once you've created a
+ * The JDK provides a number of classes that perform locale-sensitive
+ * operations. For example, the
+ * Each class that performs locale-sensitive operations allows you
+ * to get all the available objects of that type. You can sift
+ * through these objects by language, country, or variant,
+ * and use the display names to present a menu to the user.
+ * For example, you can create a menu of all the collation objects
+ * suitable for a given language. Such classes must implement these
+ * three class methods:
+ *
+ * The characters of the array argument are inserted into the
+ * contents of this string buffer at the position indicated by
+ *
+ * String buffers are safe for use by multiple threads. The methods
+ * are synchronized where necessary so that all the operations on any
+ * particular instance behave as if they occur in some serial order.
+ *
+ * String buffers are used by the compiler to implement the binary
+ * string concatenation operator
+ * is compiled to the equivalent of:
+ *
+ * The principal operations on a
+ * For example, if
+ * Every string buffer has a capacity. As long as the length of the
+ * character sequence contained in the string buffer does not exceed
+ * the capacity, it is not necessary to allocate a new internal
+ * buffer array. If the internal buffer overflows, it is
+ * automatically made larger.
+ */
+class OStringBuffer
+{
+public:
+ /**
+ * Constructs a string buffer with no characters in it and an
+ * initial capacity of 16 characters.
+ */
+ OStringBuffer()
+ : pData(NULL)
+ , nCapacity( 16 )
+ {
+ rtl_string_new_WithLength( &pData, nCapacity );
+ }
+
+ /**
+ * Allocates a new string buffer that contains the same sequence of
+ * characters as the string buffer argument.
+ *
+ * @param value a
+ * If the
+ * The
+ * The first character of a string buffer is at index
+ *
+ * The index argument must be greater than or equal to
+ *
+ * The offset argument must be greater than or equal to
+ *
+ * The characters of the
+ * The characters of the array argument are appended, in order, to
+ * the contents of this string buffer. The length of this string
+ * buffer increases by the length of the argument.
+ *
+ * @param str the characters to be appended.
+ * @return this string buffer.
+ */
+ OStringBuffer & append( const sal_Char * str )
+ {
+ return append( str, rtl_str_getLength( str ) );
+ }
+
+ /**
+ * Appends the string representation of the
+ * Characters of the character array
+ * The argument is converted to a string as if by the method
+ *
+ * The argument is appended to the contents of this string buffer.
+ * The length of this string buffer increases by
+ * The argument is converted to a string as if by the method
+ *
+ * The argument is converted to a string as if by the method
+ *
+ * The argument is converted to a string as if by the method
+ *
+ * The argument is converted to a string as if by the method
+ *
+ * The characters of the
+ * The offset argument must be greater than or equal to
+ *
+ * The characters of the array argument are inserted into the
+ * contents of this string buffer at the position indicated by
+ *
+ * The characters of the array argument are inserted into the
+ * contents of this string buffer at the position indicated by
+ *
+ * The second argument is converted to a string as if by the method
+ *
+ * The offset argument must be greater than or equal to
+ *
+ * The second argument is inserted into the contents of this string
+ * buffer at the position indicated by
+ * The offset argument must be greater than or equal to
+ *
+ * The second argument is converted to a string as if by the method
+ *
+ * The offset argument must be greater than or equal to
+ *
+ * The second argument is converted to a string as if by the method
+ *
+ * The offset argument must be greater than or equal to
+ *
+ * The second argument is converted to a string as if by the method
+ *
+ * The offset argument must be greater than or equal to
+ *
+ * The second argument is converted to a string as if by the method
+ *
+ * The offset argument must be greater than or equal to
+ *
+ * Two characters are considered the same, ignoring case, if at
+ * least one of the following is true:
+ *
+ * Two sequences of characters are the same, ignoring case, if the
+ * sequences have the same length and corresponding characters are
+ * the same, ignoring case.
+ *
+ * @param first the
+ * If the character
+ * All characters that have codes less than or equal to
+ *
+ * The representation is exactly the one returned by the
+ *
+ * The representation is exactly the one returned by the
+ *
+ * The representation is exactly the one returned by the
+ *
+ * The representation is exactly the one returned by the
+ *
+ *
+ * @return a string that represents the concatenation of the strings.
+ */
+void SAL_CALL rtl_string_newConcat( rtl_String ** newStr, rtl_String * left, rtl_String * right );
+
+/**
+ * Returns a new string resulting from replacing all occurrences of
+ *
+ * If the character
+ *
+ * @param index the index for beginning.
+ * @param count the count of charcters that will replaced
+ * @param newStr the new substring.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_string_newReplaceStrAt( rtl_String ** newStr,
+ rtl_String * str,
+ sal_Int32 index,
+ sal_Int32 count,
+ rtl_String * newSub);
+
+/**
+ * Converts all of the characters in this
+ * All characters that have codes less than or equal to
+ *
+ * Strings are constant; their values cannot be changed after they
+ * are created. OAsciiString buffers support mutable strings.
+ * Because OAsciiString objects are immutable they can be shared. For example:
+ *
+ * is equivalent to:
+ *
+ * Here are some more examples of how strings can be used:
+ *
+ * The class
+ * Two characters are considered the same, ignoring case, if at
+ * least one of the following is true:
+ *
+ * Two sequences of characters are the same, ignoring case, if the
+ * sequences have the same length and corresponding characters are
+ * the same, ignoring case.
+ *
+ * @param anotherString the
+ * If the length of the argument string is
+ * If the character
+ *
+ * @param index the index for beginning.
+ * @param count the count of charcters that will replaced
+ * @param newStr the new substring.
+ * @return the new string. The reference count is 1.
+ */
+ OString replaceAt(sal_Int32 index, sal_Int32 count, const OString& newStr ) const
+ {
+ rtl_String * pNew = 0;
+ rtl_string_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
+ return OString( pNew, (DO_NOT_ACQUIRE *)0 );
+ }
+
+ /**
+ * Converts this
+ * If no character in the string has a different lowercase version,
+ * based on calling the
+ * Otherwise, a new string is allocated, whose length is identical
+ * to this string, and such that each character that has a different
+ * lowercase version is mapped to this lowercase equivalent.
+ *
+ * @return the string, converted to lowercase.
+ * @see java.lang.Character#toLowerCase(char)
+ * @see java.lang.OString#toUpperCase()
+ */
+ OString toLowerCase() const
+ {
+ rtl_String * pNew = 0;
+ rtl_string_newToLowerCase( &pNew, pData );
+ return OString( pNew, (DO_NOT_ACQUIRE *)0 );
+ }
+
+ /**
+ * Converts this string to uppercase.
+ *
+ * If no character in this string has a different uppercase version,
+ * based on calling the
+ * Otherwise, a new string is allocated, whose length is identical
+ * to this string, and such that each character that has a different
+ * uppercase version is mapped to this uppercase equivalent.
+ *
+ * @return the string, converted to uppercase.
+ * @see java.lang.Character#toUpperCase(char)
+ * @see java.lang.OString#toLowerCase()
+ */
+ OString toUpperCase() const
+ {
+ rtl_String * pNew = 0;
+ rtl_string_newToUpperCase( &pNew, pData );
+ return OString( pNew, (DO_NOT_ACQUIRE *)0 );
+ }
+
+ /**
+ * Removes white space from both ends of this string.
+ *
+ * All characters that have codes less than or equal to
+ *
+ * The representation is exactly the one returned by the
+ *
+ * The representation is exactly the one returned by the
+ *
+ * The representation is exactly the one returned by the
+ *
+ * The representation is exactly the one returned by the
+ *
+ * The characters of the array argument are inserted into the
+ * contents of this string buffer at the position indicated by
+ *
+ * The characters of the array argument are inserted into the
+ * contents of this string buffer at the position indicated by
+ *
+ * String buffers are safe for use by multiple threads. The methods
+ * are synchronized where necessary so that all the operations on any
+ * particular instance behave as if they occur in some serial order.
+ *
+ * String buffers are used by the compiler to implement the binary
+ * string concatenation operator
+ * is compiled to the equivalent of:
+ *
+ * The principal operations on a
+ * For example, if
+ * Every string buffer has a capacity. As long as the length of the
+ * character sequence contained in the string buffer does not exceed
+ * the capacity, it is not necessary to allocate a new internal
+ * buffer array. If the internal buffer overflows, it is
+ * automatically made larger.
+ */
+class OUStringBuffer
+{
+public:
+ /**
+ * Constructs a string buffer with no characters in it and an
+ * initial capacity of 16 characters.
+ */
+ OUStringBuffer()
+ : pData(NULL)
+ , nCapacity( 16 )
+ {
+ rtl_uString_new_WithLength( &pData, nCapacity );
+ }
+
+ /**
+ * Allocates a new string buffer that contains the same sequence of
+ * characters as the string buffer argument.
+ *
+ * @param value a
+ * If the
+ * The
+ * The first character of a string buffer is at index
+ *
+ * The index argument must be greater than or equal to
+ *
+ * The offset argument must be greater than or equal to
+ *
+ * The characters of the
+ * The characters of the array argument are appended, in order, to
+ * the contents of this string buffer. The length of this string
+ * buffer increases by the length of the argument.
+ *
+ * @param str the characters to be appended.
+ * @return this string buffer.
+ */
+ OUStringBuffer & append( const sal_Unicode * str )
+ {
+ return append( str, rtl_ustr_getLength( str ) );
+ }
+
+ /**
+ * Appends the string representation of the
+ * Characters of the character array
+ * The characters of the array argument are appended, in order, to
+ * the contents of this string buffer. The length of this string
+ * buffer increases by the length of the argument.
+ *
+ * @param str the 8-Bit ASCII characters to be appended.
+ * @return this string buffer.
+ */
+ OUStringBuffer & appendAscii( const sal_Char * str )
+ {
+ return appendAscii( str, rtl_str_getLength( str ) );
+ }
+
+ /**
+ * Appends a 8-Bit ASCII character string to this string buffer.
+ * Since this method is optimized for performance. the ASCII
+ * character values are not converted in any way. The caller
+ * has to make sure that all ASCII characters are in the
+ * allowed range between 0 and 127. The ASCII string must be
+ * NULL-terminated.
+ *
+ * Characters of the character array
+ * The argument is converted to a string as if by the method
+ *
+ * The argument is appended to the contents of this string buffer.
+ * The length of this string buffer increases by
+ * The argument is converted to a string as if by the method
+ *
+ * The argument is converted to a string as if by the method
+ *
+ * The argument is converted to a string as if by the method
+ *
+ * The argument is converted to a string as if by the method
+ *
+ * The characters of the
+ * The offset argument must be greater than or equal to
+ *
+ * The characters of the array argument are inserted into the
+ * contents of this string buffer at the position indicated by
+ *
+ * The characters of the array argument are inserted into the
+ * contents of this string buffer at the position indicated by
+ *
+ * The second argument is converted to a string as if by the method
+ *
+ * The offset argument must be greater than or equal to
+ *
+ * The second argument is inserted into the contents of this string
+ * buffer at the position indicated by
+ * The offset argument must be greater than or equal to
+ *
+ * The second argument is converted to a string as if by the method
+ *
+ * The offset argument must be greater than or equal to
+ *
+ * The second argument is converted to a string as if by the method
+ *
+ * The offset argument must be greater than or equal to
+ *
+ * The second argument is converted to a string as if by the method
+ *
+ * The offset argument must be greater than or equal to
+ *
+ * The second argument is converted to a string as if by the method
+ *
+ * The offset argument must be greater than or equal to
+ *
+ * Two characters are considered the same, ignoring case, if at
+ * least one of the following is true:
+ *
+ * Two sequences of characters are the same, ignoring case, if the
+ * sequences have the same length and corresponding characters are
+ * the same, ignoring case.
+ *
+ * @param first the
+ * If the character
+ * All characters that have codes less than or equal to
+ *
+ * The representation is exactly the one returned by the
+ *
+ * The representation is exactly the one returned by the
+ *
+ * The representation is exactly the one returned by the
+ *
+ * The representation is exactly the one returned by the
+ *
+ *
+ * @param str a string representing a number
+ * @return the int32 represented by the string
+ * 0 if the string represents no number.
+ */
+sal_Int32 SAL_CALL rtl_ustr_toInt32( sal_Unicode * str, sal_Int16 radix );
+
+/**
+ * Returns the int64 value represented
+ *
+ * @param str a string representing a number
+ * @return the int64 represented by the string
+ * 0 if the string represents no number.
+ */
+sal_Int64 SAL_CALL rtl_ustr_toInt64( sal_Unicode * str, sal_Int16 radix );
+
+ /**
+ * Returns the float value represented
+ *
+ * @param str a string representing a number
+ * @return the float represented by the string
+ * 0.0 if the string represents no number.
+ */
+float SAL_CALL rtl_ustr_toFloat( sal_Unicode * str );
+
+/**
+ * Returns the double value represented
+ *
+ * @param str a string representing a number
+ * @return the double represented by the string
+ * 0.0 if the string represents no number.
+ */
+double SAL_CALL rtl_ustr_toDouble( sal_Unicode * str );
+
+/**
+ * A string with this reference count is static und must not deleted.
+ * It is also not allowed to modifiy the reference count.
+ */
+#define RTL_STATIC_STRING_REF ((sal_Int32)0x80000000)
+
+#ifdef SAL_W32
+# pragma pack(push, 4)
+#elif defined(SAL_OS2)
+# pragma pack(1)
+#endif
+
+struct _rtl_Locale;
+
+/**
+ * The implementation structure of a string.
+ */
+typedef struct _rtl_uString
+{
+ sal_Int32 refCount;
+ sal_Int32 length;
+ sal_Unicode buffer[1];
+} rtl_uString;
+
+#ifdef SAL_W32
+# pragma pack(pop)
+#elif defined(SAL_OS2)
+# pragma pack()
+#endif
+
+/**
+ * Increment the reference count of the string.
+ */
+void SAL_CALL rtl_uString_acquire( rtl_uString * value );
+
+/**
+ * Decrement the reference count of the string. If the count goes to zero than the string is
+ * deleted.
+ */
+void SAL_CALL rtl_uString_release( rtl_uString * value );
+
+/**
+ * Allocates a new
+ *
+ * @return a string that represents the concatenation of the strings.
+ */
+void SAL_CALL rtl_uString_newConcat( rtl_uString ** newStr, rtl_uString * left, rtl_uString * right );
+
+/**
+ * Returns a new string resulting from replacing all occurrences of
+ *
+ * If the character
+ *
+ * @param index the index for beginning.
+ * @param count the count of charcters that will replaced
+ * @param newStr the new substring.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_uString_newReplaceStrAt( rtl_uString ** newStr,
+ rtl_uString * str,
+ sal_Int32 index,
+ sal_Int32 count,
+ rtl_uString * newSub);
+
+/**
+ * Converts all of the characters in this
+ * All characters that have codes less than or equal to
+ *
+ osl_File_E_NOENT No such file or directory not found
+ @see osl_getFileStatus
+
+*/
+
+oslFileError SAL_CALL osl_setFileTime( rtl_uString *filePath, TimeValue *aCreationTime,
+ TimeValue *aLastAccessTime,
+ TimeValue *aLastWriteTime);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_FILE_H_ */
+
+
diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx
new file mode 100644
index 000000000000..b852debb57e8
--- /dev/null
+++ b/sal/inc/osl/file.hxx
@@ -0,0 +1,1408 @@
+/*************************************************************************
+ *
+ * $RCSfile: file.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _OSL_FILE_HXX_
+#define _OSL_FILE_HXX_
+
+#ifdef __cplusplus
+
+#ifndef _RTL_MEMORY_H_
+# include
+
+ @see osl_getFileStatus
+ */
+
+ static inline RC getCanonicalName( const ::rtl::OUString& strRequested, ::rtl::OUString& strValid )
+ {
+ return (RC) osl_getCanonicalName( strRequested.pData, &strValid.pData );
+ }
+
+ /** Converts a path relative to a given directory into an full qualified UNC path.
+
+ @param strDirBase [in] Base directory to which the relative path is related to.
+ @param strRelative[in] Path of a file or directory relative to the directory path
+ specified by strDirBase
.
+ @param strAbsolute [out] On success it receives the full qualified UNC path of the
+ requested relative path.
+
+ @return E_None on success otherwise one of the following errorcodes:
+ E_NOMEM not enough memory for allocating structures
+ E_NOTDIR Not a directory
+ E_ACCES Permission denied
+ E_NOENT No such file or directory
+ E_NAMETOOLONG File name too long
+ E_INTR function call was interrupted
+ E_LOOP Too many symbolic links encountered
+ E_MULTIHOP Multihop attempted
+ E_NOLINK Link has been severed
+
+ @see getCanonicalName
+ */
+
+ static inline RC normalizePath( const ::rtl::OUString& strSysPath, ::rtl::OUString& strPath )
+ {
+ return (RC) osl_normalizePath( strSysPath.pData, &strPath.pData );
+ }
+
+ /** Converts a File URL into a full qualified UNC path
+
+ @param urlPath[in] System dependent path of a file or a directory
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return E_None on success otherwise one of the following errorcodes:
+
+ @see normalizePath
+ */
+
+ static inline RC getNormalizedPathFromFileURL( const ::rtl::OUString& strPath, ::rtl::OUString& normPath )
+ {
+ return (RC) osl_getNormalizedPathFromFileURL( strPath.pData, &normPath.pData );
+ }
+
+ /** Converts a full qualified UNC path into a FileURL
+
+ @param dir[in] System dependent path of a file or a directory
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return E_None on success otherwise one of the following errorcodes:
+
+ @see normalizePath
+ @see getNormalizedPathFromFileURL
+ */
+
+ static inline RC getFileURLFromNormalizedPath( const ::rtl::OUString& normPath, ::rtl::OUString& strPath )
+ {
+ return (RC) osl_getFileURLFromNormalizedPath( normPath.pData, &strPath.pData );
+ }
+
+ /** Converts a full qualified UNC path into a system depended path
+
+ @param dir[in] Full qualified UNC path
+ @param strPath[out] On success it receives the System dependent path of a file or a directory
+
+ @return E_None on success otherwise one of the following errorcodes:
+
+ @see normalizePath
+ @see getNormalizedPathFromFileURL
+ */
+
+ static inline RC getSystemPathFromNormalizedPath( const ::rtl::OUString& normPath, ::rtl::OUString& strPath )
+ {
+ return (RC)osl_getSystemPathFromNormalizedPath( normPath.pData, &strPath.pData );
+ }
+
+ /** Searches a full qualified UNC-Path/File
+
+ @param filePath[in] System dependent path / Normalized Path / File-URL or file or relative directory
+ @param searchPath[in] Paths, in which a given file has to be searched. These paths are only for the search of a
+ file or a relative path, otherwise it will be ignored. If it is set to NULL or while using the
+ search path the search failed the function searches for a matching file in all system directories and in the directories
+ listed in the PATH environment variable
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return E_None on success otherwise one of the following errorcodes:
+ E_NOTDIR Not a directory
+ E_NOENT No such file or directory not found
+ @see normalizePath
+ */
+
+ static inline RC searchNormalizedPath( const ::rtl::OUString& filePath, const ::rtl::OUString& searchPath, ::rtl::OUString& strPath )
+ {
+ return (RC) osl_searchNormalizedPath( filePath.pData, searchPath.pData, &strPath.pData );
+ }
+};
+
+// -----------------------------------------------------------------------------
+
+/** The VolumeDevice class
+
+ @see VolumeInfo
+*/
+
+class VolumeDevice : public FileBase
+{
+ oslVolumeDeviceHandle _aHandle;
+
+public:
+ VolumeDevice() : _aHandle( NULL )
+ {
+ }
+
+ VolumeDevice( const VolumeDevice & rDevice )
+ {
+ _aHandle = rDevice._aHandle;
+ if ( _aHandle )
+ osl_acquireVolumeDeviceHandle( _aHandle );
+ }
+
+ ~VolumeDevice()
+ {
+ if ( _aHandle )
+ osl_releaseVolumeDeviceHandle( _aHandle );
+ }
+
+
+ inline VolumeDevice & operator =( const VolumeDevice & rDevice )
+ {
+ oslVolumeDeviceHandle newHandle = rDevice._aHandle;
+
+ if ( newHandle )
+ osl_acquireVolumeDeviceHandle( _aHandle );
+
+ if ( _aHandle )
+ osl_releaseVolumeDeviceHandle( _aHandle );
+
+ _aHandle = newHandle;
+
+ return *this;
+ }
+
+ inline RC automount()
+ {
+ return (RC)osl_automountVolumeDevice( _aHandle );
+ }
+
+ inline RC unmount()
+ {
+ return (RC)osl_unmountVolumeDevice( _aHandle );
+ }
+
+ inline rtl::OUString getMountPath()
+ {
+ rtl::OUString aPath;
+ osl_getVolumeDeviceMountPath( _aHandle, &aPath.pData );
+ return aPath;
+ }
+
+ friend class VolumeInfo;
+};
+
+// -----------------------------------------------------------------------------
+
+/** The file class object provides access to file contents and attributes
+
+ @see Directory
+ @see DirectoryItem
+ */
+
+class File: public FileBase
+{
+ oslFileHandle _pData;
+ ::rtl::OUString _aPath;
+
+ /** define copy c'tor and assginment operator privat
+ */
+
+ File( File& );
+ File& operator = ( File& );
+
+public:
+
+ /** C'tor
+
+ @param strPath [in] The full qualified path of the file in UNC notation.
+ The path delimiter is '/'. Relative paths are not allowed.
+ */
+
+ File( const ::rtl::OUString& strPath ): _pData( 0 ), _aPath( strPath ) {};
+
+ /** D'tor
+ */
+
+ inline ~File()
+ {
+ close();
+ }
+
+ /** Opens a file.
+ @param uFlags [in] Specifies the open mode.
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+ E_NAMETOOLONG pathname was too long
+ E_NOENT No such file or directory
+ E_ACCES permission denied
+ E_NXIO No such device or address
+ E_NODEV No such device
+ E_ROFS Read-only file system
+ E_TXTBSY Text file busy
+ E_ISDIR Is a directory
+ E_FAULT Bad address
+ E_LOOP Too many symbolic links encountered
+ E_NOSPC No space left on device
+ E_MFILE too many open files used by the process
+ E_NFILE too many open files in the system
+ E_DQUOT Quota exceeded
+ E_EXIST File exists
+ E_INTR function call was interrupted
+ E_IO I/O error
+ E_MULTIHOP Multihop attempted
+ E_NOLINK Link has been severed
+ E_EOVERFLOW Value too large for defined data type
+ E_INTR function call was interrupted
+ E_NOLINK Link has been severed
+ E_NOSPC No space left on device
+ E_IO I/O error
+ E_OVERFLOW The resulting file offset would be a value which cannot
+ be represented correctly for regular files
+ E_OVERFLOW The resulting file offset would be a value which cannot
+ be represented correctly for regular files
+ E_OVERFLOW The resulting file offset would be a value which cannot
+ be represented correctly for regular filesuBytesRequested
bytes.
+ @param uBytesRequested [in] Number of bytes which should be retrieved.
+ @param rBytesRead [out] On success the number of bytes which have actually been retrieved.
+ @return E_None on success otherwise one of the following errorcodes:
+
+ These errorcodes can (eventually) be returned:
+ E_IO I/O error
+ E_ISDIR Is a directory
+ E_BADF Bad file
+ E_FAULT Bad address
+ E_AGAIN Operation would block
+ E_NOLINK Link has been severed
+ E_FBIG File too large
+ E_DQUOT Quota exceeded
+ E_BADF Bad file
+ E_FAULT Bad address
+ E_INTR function call was interrupted
+ E_IO I/O error
+ E_NOLCK No record locks available
+ E_NOLINK Link has been severed
+ E_NOSPC No space left on device
+ E_NXIO No such device or address
+ E_NOMEM not enough memory for allocating structures
+ E_ACCES Permission denied
+ E_PERM Operation not permitted
+ E_NAMETOOLONG File name too long
+ E_NOENT No such file or directory
+ E_ISDIR Is a directory
+ E_ROFS Read-only file system
+ E_NOMEM not enough memory for allocating structures
+ E_ACCES Permission denied
+ E_PERM Operation not permitted
+ E_NAMETOOLONG File name too long
+ E_NOENT No such file or directory
+ E_ROFS Read-only file system
+ E_NOMEM not enough memory for allocating structures
+ E_ACCES Permission denied
+ E_PERM Operation not permitted
+ E_NAMETOOLONG File name too long
+ E_NOENT No such file or directory
+ E_ISDIR Is a directory
+ E_ROFS Read-only file system
+ E_LOOP Too many symbolic links encountered
+ E_IO I/O error
+ E_BUSY Device or resource busy
+ E_INTR function call was interrupted
+ E_LOOP Too many symbolic links encountered
+ E_MULTIHOP Multihop attempted
+ E_NOLINK Link has been severed
+ E_TXTBSY Text file busy
+ @see getStatus
+ */
+
+ inline static RC setAttributes( const ::rtl::OUString& strPath, sal_uInt64 uAttributes )
+ {
+ return (RC) osl_setFileAttributes( strPath.pData, uAttributes );
+ }
+
+ /** Sets file-Time
+
+ @param filePath[in] Path of the file
+ @param aCreationTime[in] creation time of the given file
+ @param aLastAccessTime[in] time of the last access of the given file
+ @param aLastWriteTime[in] time of the last modifying of the given file
+
+
+ @return E_None on success otherwise one of the following errorcodes:
+ E_NOENT No such file or directory not found
+ @see getStatus
+ */
+
+ inline static RC setTime( const ::rtl::OUString& strPath, TimeValue& rCreationTime,
+ TimeValue& rLastAccessTime,
+ TimeValue& rLastWriteTime )
+ {
+ return (RC) osl_setFileTime( strPath.pData, &rCreationTime,
+ &rLastAccessTime,
+ &rLastWriteTime );
+ }
+
+ friend class DirectoryItem;
+};
+
+// -----------------------------------------------------------------------------
+
+/** The directory item class object provides access to file status information.
+
+ @see FileStatus
+ */
+
+class DirectoryItem: public FileBase
+{
+ oslDirectoryItem _pData;
+
+
+public:
+
+ /** default c'tor
+ */
+
+ DirectoryItem(): _pData( NULL )
+ {
+ }
+
+ /** Copy C'tor
+ */
+
+ DirectoryItem( DirectoryItem& rItem ): _pData( rItem._pData)
+ {
+ osl_acquireDirectoryItem( _pData );
+ }
+
+
+ /** D'tor
+ */
+
+ ~DirectoryItem()
+ {
+ if( _pData )
+ osl_releaseDirectoryItem( _pData );
+ }
+
+ /** assignment operator
+ */
+
+ DirectoryItem& operator = ( DirectoryItem& rItem )
+ {
+ if( _pData )
+ osl_releaseDirectoryItem( _pData );
+
+ _pData = rItem._pData;
+ osl_acquireDirectoryItem( _pData );
+ return *this;
+ };
+
+ /** @return sal_True if object is valid directory item,
+ sal_False otherwise.
+ */
+
+ inline sal_Bool is()
+ {
+ return _pData != NULL;
+ }
+
+ /** fills a single directory item object
+
+ @param strFilePath [in] absolute file path following the notation explained in the documentation for
+ osl_openDirectory
. Due to performance issues it is not recommended to use this function
+ while enumerating the contents of a directory. In this case use osl_getNextDirectoryItem
instead.
+ @param rItem [out] on success it receives a valid directory item object.
+
+ @return E_None on success otherwise one of the following errorcodes:
+ E_NOMEM not enough memory for allocating structures
+ E_ACCES permission denied
+ E_MFILE too many open files used by the process
+ E_NFILE too many open files in the system
+ E_NOENT No such file or directory
+ E_LOOP Too many symbolic links encountered
+ E_NAMETOOLONG File name too long
+ E_NOTDIR A component of the path prefix of path is not a directory
+ E_MULTIHOP Multihop attempted
+ E_NOLINK Link has been severed
+ E_FAULT Bad address
+ E_INTR function call was interruptedgetStatus
.
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+ E_LOOP Too many symbolic links encountered
+ E_ACCES Permission denied
+ E_NOENT No such file or directory
+ E_NAMETOOLONG file name too long
+ E_FAULT Bad address
+ E_OVERFLOW Value too large for defined data type
+ E_INTR function call was interrupted
+ E_NOLINK Link has been severed
+ E_MULTIHOP Components of path require hopping to multiple remote machines and the file system does not allow it
+ E_MFILE too many open files used by the process
+ E_NFILE too many open files in the system
+ E_NOSPC No space left on device
+ E_NXIO No such device or address
+ E_IO I/O error
+ E_NOSYS Function not implemented
+ E_NOENT the specified path doesn't exist
+ E_NOTDIR the specified path is not an directory
+ E_NOMEM not enough memory for allocating structures
+ E_ACCES permission denied
+ E_MFILE too many open files used by the process
+ E_NFILE too many open files in the system
+ E_NAMETOOLONG File name too long
+ E_LOOP Too many symbolic links encountered
+ E_NOMEM not enough memory for allocating structures
+ E_INTR function call was interrupted
+ E_NOMEM not enough memory for allocating structures
+ E_NOENT No more entries in this directory
+ E_OVERFLOW Value too large for defined data typeFile::getStatus
should be called to determine if the type is
+ Type_Volume
.
+
+ @param strDirectory [in] Full qualified UNC path to the volume
+ @param rInfo [out] On success it receives information about the volume.
+ @return E_None on success otherwise one of the following errorcodes:
+ E_INVAL the format of the parameters was not valid
+ E_NAMETOOLONG File name too long
+ E_NOENT No such file or directory
+ E_ACCES permission denied
+ E_LOOP Too many symbolic links encountered
+ E_FAULT Bad address
+ E_IO I/O error
+ E_NOSYS Function not implemented
+ E_MULTIHOP Multihop attempted
+ E_NOLINK Link has been severed
+ E_INTR function call was interrupted
+ E_NOMEM not enough memory for allocating structures
+ E_EXIST File exists
+ E_ACCES Permission denied
+ E_NAMETOOLONG File name too long
+ E_NOENT No such file or directory
+ E_NOTDIR Not a directory
+ E_ROFS Read-only file system
+ E_NOSPC No space left on device
+ E_DQUOT Quota exceeded
+ E_FAULT Bad address
+ E_IO I/O error
+ E_MLINK Too many links
+ E_MULTIHOP Multihop attempted
+ E_NOLINK Link has been severed
+ E_NOMEM not enough memory for allocating structures
+ E_PERM Operation not permitted
+ E_ACCES Permission denied
+ E_NOENT No such file or directory
+ E_NOTDIR Not a directory
+ E_NOTEMPTY Directory not empty
+ E_NAMETOOLONG File name too long
+ E_BUSY Device or resource busy
+ E_ROFS Read-only file system
+ E_LOOP Too many symbolic links encountered
+ E_BUSY Device or resource busy
+ E_EXIST File exists
+ E_IO I/O error
+ E_MULTIHOP Multihop attempted
+ E_NOLINK Link has been severed
+ @param strModuleName denotes the name of the module to be loaded.
+ @return 0 if the module could not be loaded, otherwise a handle to the module.
+*/
+oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMode);
+
+/** Release the Module
+*/
+void SAL_CALL osl_unloadModule(oslModule Module);
+
+/** lookup the specified symbolname.
+ @returns address of the symbol or 0 if lookup failed,
+*/
+void* SAL_CALL osl_getSymbol(oslModule Module, rtl_uString *strSymbolName);
+
+/** ascii interface for internal use.
+ @returns address of the symbol or 0 if lookup failed,
+*/
+void* SAL_CALL osl_getSymbolA(oslModule Module, const char *pszSymbolName);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_MODULE_H_ */
+
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.8 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.7 2000/05/17 14:30:14 mfe
+* comments upgraded
+*
+* Revision 1.6 2000/03/31 15:55:56 rs
+* UNICODE-Changes
+*
+* Revision 1.5 2000/03/16 16:43:52 obr
+* Unicode API changes
+*
+* Revision 1.4 2000/01/06 11:46:32 mfe
+* #71540# : for incompatible z'en
+*
+* Revision 1.3 2000/01/04 14:07:19 mfe
+* osl_loadModule takes 2nd parameter
+*
+* Revision 1.2 1999/10/27 15:02:07 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:19 jsc
+* verschoben aus osl
+*
+* Revision 1.6 1999/08/05 11:14:35 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.5 1999/01/20 18:53:40 jsc
+* #61011# Typumstellung
+*
+* Revision 1.4 1998/02/16 19:34:51 rh
+* Cleanup of ports, integration of Size_t, features for process
+*
+* Revision 1.3 1997/07/31 15:28:38 ts
+* *** empty log message ***
+*
+* Revision 1.2 1997/07/17 11:02:27 rh
+* Header adapted and profile added
+*
+* Revision 1.1 1997/07/03 10:04:31 rh
+* Module handling added
+*
+*************************************************************************/
+
diff --git a/sal/inc/osl/mutex.h b/sal/inc/osl/mutex.h
new file mode 100644
index 000000000000..4958a2f4b033
--- /dev/null
+++ b/sal/inc/osl/mutex.h
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * $RCSfile: mutex.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_MUTEX_H_
+#define _OSL_MUTEX_H_
+
+#ifndef _OSL_TYPES_H_
+# include
+
+namespace osl {
+
+ typedef oslProfileOption ProfileOption;
+
+ const int Profile_DEFAULT = osl_Profile_DEFAULT;
+ const int Profile_SYSTEM = osl_Profile_SYSTEM; /* use system depended functinality */
+ const int Profile_READLOCK = osl_Profile_READLOCK; /* lock file for reading */
+ const int Profile_WRITELOCK = osl_Profile_WRITELOCK; /* lock file for writing */
+
+ class Profile {
+ oslProfile profile;
+
+ public:
+ /** Open or create a configuration profile.
+ @return 0 if the profile could not be created, otherwise a handle to the profile.
+ */
+ Profile(const rtl::OUString strProfileName, oslProfileOption Options = Profile_DEFAULT )
+ {
+ profile = osl_openProfile(strProfileName.pData, Options);
+ if( ! profile )
+ throw std::exception();
+ }
+
+
+ /** Close the opened profile an flush all data to the disk.
+ @param Profile handle to a opened profile.
+ */
+ ~Profile()
+ {
+ sal_Bool err = osl_closeProfile(profile);
+ }
+
+
+ sal_Bool flush()
+ {
+ return osl_flushProfile(profile);
+ }
+
+ rtl::OString readString( const rtl::OString& rSection, const rtl::OString& rEntry,
+ const rtl::OString& rDefault)
+ {
+ sal_Char aBuf[1024];
+ return osl_readProfileString( profile,
+ rSection,
+ rEntry,
+ aBuf,
+ sizeof( aBuf ),
+ rDefault ) ? rtl::OString( aBuf ) : rtl::OString();
+
+ }
+
+ sal_Bool readBool( const rtl::OString& rSection, const rtl::OString& rEntry, sal_Bool bDefault )
+ {
+ return osl_readProfileBool( profile, rSection, rEntry, bDefault );
+ }
+
+ sal_uInt32 readIdent(const rtl::OString& rSection, const rtl::OString& rEntry,
+ sal_uInt32 nFirstId, const std::list< rtl::OString >& rStrings,
+ sal_uInt32 nDefault)
+ {
+ int nItems = rStrings.size();
+ const sal_Char** pStrings = new const sal_Char*[ nItems+1 ];
+ std::list< rtl::OString >::const_iterator it = rStrings.begin();
+ nItems = 0;
+ while( it != rStrings.end() )
+ {
+ pStrings[ nItems++ ] = *it;
+ ++it;
+ }
+ pStrings[ nItems ] = NULL;
+ sal_uInt32 nRet = osl_readProfileIdent(profile, rSection, rEntry, nFirstId, pStrings, nDefault);
+ delete pStrings;
+ return nRet;
+ }
+
+ sal_Bool writeString(const rtl::OString& rSection, const rtl::OString& rEntry,
+ const rtl::OString& rString)
+ {
+ return osl_writeProfileString(profile, rSection, rEntry, rString);
+ }
+
+ sal_Bool writeBool(const rtl::OString& rSection, const rtl::OString& rEntry, sal_Bool Value)
+ {
+ return osl_writeProfileBool(profile, rSection, rEntry, Value);
+ }
+
+ sal_Bool writeIdent(const rtl::OString& rSection, const rtl::OString& rEntry,
+ sal_uInt32 nFirstId, const std::list< rtl::OString >& rStrings,
+ sal_uInt32 nValue)
+ {
+ int nItems = rStrings.size();
+ const sal_Char** pStrings = new const sal_Char*[ nItems+1 ];
+ std::list< rtl::OString >::const_iterator it = rStrings.begin();
+ nItems = 0;
+ while( it != rStrings.end() )
+ {
+ pStrings[ nItems++ ] = *it;
+ ++it;
+ }
+ pStrings[ nItems ] = NULL;
+ sal_Bool bRet =
+ osl_writeProfileIdent(profile, rSection, rEntry, nFirstId, pStrings, nValue );
+ delete pStrings;
+ return bRet;
+ }
+
+ /** Acquire the mutex, block if already acquired by another thread.
+ @param Profile handle to a opened profile.
+ @return False if section or entry could not be found.
+ */
+ sal_Bool removeEntry(const rtl::OString& rSection, const rtl::OString& rEntry)
+ {
+ return osl_removeProfileEntry(profile, rSection, rEntry);
+ }
+
+ /** Get all entries belonging to the specified section.
+ @param Profile handle to a opened profile.
+ @return Pointer to a array of pointers.
+ */
+ std::list< rtl::OString > getSectionEntries(const rtl::OString& rSection )
+ {
+ std::list< rtl::OString > aEntries;
+
+ // count buffer size necessary
+ int n = osl_getProfileSectionEntries( profile, rSection, NULL, 0 );
+ if( n > 1 )
+ {
+ sal_Char* pBuf = new sal_Char[ n+1 ];
+ osl_getProfileSectionEntries( profile, rSection, pBuf, n+1 );
+ int nLen;
+ for( n = 0; ( nLen = strlen( pBuf+n ) ); n += nLen+1 )
+ aEntries.push_back( rtl::OString( pBuf+n ) );
+ delete pBuf;
+ }
+
+ return aEntries;
+ }
+
+ /** Get all section entries
+ @param Profile handle to a opened profile.
+ @return Pointer to a array of pointers.
+ */
+ std::list< rtl::OString > getSections()
+ {
+ std::list< rtl::OString > aSections;
+
+ // count buffer size necessary
+ int n = osl_getProfileSections( profile, NULL, 0 );
+ if( n > 1 )
+ {
+ sal_Char* pBuf = new sal_Char[ n+1 ];
+ osl_getProfileSections( profile, pBuf, n+1 );
+ int nLen;
+ for( n = 0; ( nLen = strlen( pBuf+n ) ); n += nLen+1 )
+ aSections.push_back( rtl::OString( pBuf+n ) );
+ delete pBuf;
+ }
+
+ return aSections;
+ }
+
+ static rtl::OUString getName(const rtl::OUString& rPath, const rtl::OUString& rName)
+ {
+ rtl::OUString aProfileName;
+ return osl_getProfileName( rPath.pData, rName.pData, &aProfileName.pData ) ? aProfileName : rtl::OUString();
+ }
+
+ };
+}
+
+#endif /* _OSL_PROFILE_HXX_ */
+
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.9 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.8 2000/05/31 08:52:40 obr
+* inline statement fixed
+*
+* Revision 1.7 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.6 2000/03/16 16:43:53 obr
+* Unicode API changes
+*
+* Revision 1.5 2000/03/06 14:15:08 mfe
+* #73273# : added flush() method
+*
+* Revision 1.4 1999/11/09 16:15:25 pl
+* add: correct namespace
+*
+* Revision 1.3 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.2 1999/09/30 11:45:58 pl
+* use OStrings to get rid of buffers
+*
+* Revision 1.1 1999/09/30 08:26:57 kr
+* profile header inline wrapper
+*
+*************************************************************************/
diff --git a/sal/inc/osl/security.h b/sal/inc/osl/security.h
new file mode 100644
index 000000000000..d98683f39a58
--- /dev/null
+++ b/sal/inc/osl/security.h
@@ -0,0 +1,263 @@
+/*************************************************************************
+ *
+ * $RCSfile: security.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_SECURITY_H_
+#define _OSL_SECURITY_H_
+
+#ifndef _RTL_USTRING_H_
+# include
+ @param InitialCount denotes the starting value the semaphore. If you set it to
+ zero, the first acquire() blocks. Otherwise InitialCount acquire()s are
+ immedeatly successfull.
+ @return 0 if the semaphore could not be created, otherwise a handle to the sem.
+*/
+oslSemaphore SAL_CALL osl_createSemaphore(sal_uInt32 initialCount);
+
+/** Release the OS-structures and free semaphore data-structure
+ @return fbbb
+*/
+void SAL_CALL osl_destroySemaphore(oslSemaphore Semaphore);
+
+/** acquire() decreases the count. It will block if it tries to
+ decrease below zero.
+ @return False if the system-call failed.
+*/
+sal_Bool SAL_CALL osl_acquireSemaphore(oslSemaphore Semaphore);
+
+/** tryToAcquire() tries to decreases the count. It will
+ return with False if it would decrease the count below zero.
+ (When acquire() would block.) If it could successfully
+ decrease the count, it will return True.
+*/
+sal_Bool SAL_CALL osl_tryToAcquireSemaphore(oslSemaphore Semaphore);
+
+/** release() increases the count.
+ @return False if the system-call failed.
+*/
+sal_Bool SAL_CALL osl_releaseSemaphore(oslSemaphore Semaphore);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_SEMAPHORE_H_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.4 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.3 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.2 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:20 jsc
+* verschoben aus osl
+*
+* Revision 1.6 1999/08/05 11:14:41 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.5 1999/01/20 18:53:41 jsc
+* #61011# Typumstellung
+*
+* Revision 1.4 1998/02/16 19:34:52 rh
+* Cleanup of ports, integration of Size_t, features for process
+*
+* Revision 1.3 1997/07/31 15:28:40 ts
+* *** empty log message ***
+*
+* Revision 1.2 1997/07/17 11:02:28 rh
+* Header adapted and profile added
+*
+* Revision 1.1 1997/06/19 13:10:10 bho
+* first version of OSL.
+*
+*************************************************************************/
+
diff --git a/sal/inc/osl/semaphor.hxx b/sal/inc/osl/semaphor.hxx
new file mode 100644
index 000000000000..097bc6a81dd9
--- /dev/null
+++ b/sal/inc/osl/semaphor.hxx
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * $RCSfile: semaphor.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_SEMAPHORE_HXX_
+#define _OSL_SEMAPHORE_HXX_
+
+#ifdef __cplusplus
+
+#include
+ @param InitialCount denotes the starting value the semaphore. If you set it to
+ zero, the first acquire() blocks. Otherwise InitialCount acquire()s are
+ immedeatly successfull.
+ @return 0 if the semaphore could not be created, otherwise a handle to the sem.
+ */
+
+ Semaphore(sal_uInt32 initialCount)
+ {
+ semaphore = osl_createSemaphore(initialCount);
+ }
+
+ /** Release the OS-structures and free semaphore data-structure
+ @return fbbb
+ */
+ ~Semaphore()
+ {
+ osl_destroySemaphore(semaphore);
+ }
+
+ /** acquire() decreases the count. It will block if it tries to
+ decrease below zero.
+ @return False if the system-call failed.
+ */
+ sal_Bool acquire()
+ {
+ return osl_acquireSemaphore(semaphore);
+ }
+
+ /** tryToAcquire() tries to decreases the count. It will
+ return with False if it would decrease the count below zero.
+ (When acquire() would block.) If it could successfully
+ decrease the count, it will return True.
+ */
+ sal_Bool tryToAcquire()
+ {
+ return osl_tryToAcquireSemaphore(semaphore);
+ }
+
+ /** release() increases the count.
+ @return False if the system-call failed.
+ */
+ sal_Bool release()
+ {
+ return osl_releaseSemaphore(semaphore);
+ }
+ };
+#ifdef _USE_NAMESPACE
+}
+#endif
+
+#endif /* __cplusplus */
+#endif /* _OSL_SEMAPHORE_HXX_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.4 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.3 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.2 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/09/23 12:09:17 kr
+* inline header wrapper for mutex semaphore guard
+*
+*************************************************************************/
+
diff --git a/sal/inc/osl/signal.h b/sal/inc/osl/signal.h
new file mode 100644
index 000000000000..439dd2feb60a
--- /dev/null
+++ b/sal/inc/osl/signal.h
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * $RCSfile: signal.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_SIGNAL_H_
+#define _OSL_SIGNAL_H_
+
+#ifndef _OSL_TYPES_H_
+# include
+
+
+ @return the number of received bytes.
+*/
+sal_Int32 SAL_CALL osl_receiveSocket(oslSocket Socket,
+ void* pBuffer,
+ sal_uInt32 BytesToRead,
+ oslSocketMsgFlag Flag);
+
+/** Tries to receives BufferSize data from the (usually unconnected)
+ (datagram-)socket, if no error occurs.
+
+ @param Socket [in] A bound socket to be used to listen for a datagram.
+ @param SenderAddr [out] An initialized oslSocketAddress. It will be
+ filled with the address of the datagrams sender. If SenderAddr is 0,
+ it is ignored.
+ @param pBuffer [out] Points to a buffer that will be filled with the received
+ datagram.
+ @param BufferSize [in] The size of pBuffer.
+ @param Flag [in] Modifier for the call. Valid values are:
+
+
+
+ @return the number of received bytes.
+*/
+sal_Int32 SAL_CALL osl_receiveFromSocket(oslSocket Socket,
+ oslSocketAddr SenderAddr,
+ void* pBuffer,
+ sal_uInt32 BufferSize,
+ oslSocketMsgFlag Flag);
+
+/** Tries to send BytesToSend data from the connected socket,
+ if no error occurs.
+
+ @param Socket [in] A connected socket.
+ @param pBuffer [in] Points to a buffer that contains the send-data.
+ @param BytesToSend [in] The number of bytes to send. pBuffer must have at least
+ this size.
+ @param Flag [in] Modifier for the call. Valid values are:
+
+
+
+ @return the number of transfered bytes.
+*/
+sal_Int32 SAL_CALL osl_sendSocket(oslSocket Socket,
+ const void* pBuffer,
+ sal_uInt32 BytesToSend,
+ oslSocketMsgFlag Flag);
+
+/** Tries to send one datagram with BytesToSend data to the given ReceiverAddr
+ via the (implicitly unconnected) datagram-socket.
+ Since we only send one packet, we don't need to concern ourselfes here with
+ incomplete sends due to packet boundaries.
+
+ @param Socket [in] A bound or unbound socket. Socket will be bound
+ after a successful call.
+
+ @param ReceiverAddr [in] An initialized oslSocketAddress that contains
+ the destination address for this send.
+
+ @param pBuffer [in] Points to a buffer that contains the send-data.
+ @param BytesToSend [in] The number of bytes to send. pBuffer must have at least
+ this size.
+ @param Flag [in] Modifier for the call. Valid values are:
+
+
+
+ @return the number of transfered bytes.
+*/
+sal_Int32 SAL_CALL osl_sendToSocket(oslSocket Socket,
+ oslSocketAddr ReceiverAddr,
+ const void* pBuffer,
+ sal_uInt32 BytesToSend,
+ oslSocketMsgFlag Flag);
+
+/** Checks if read operations will block.
+ You can specify a timeout-value in seconds/microseconds that denotes
+ how long the operation will block if the Socket is not ready.
+ @return True if read operations (recv, recvFrom, accept) on the Socket
+ will NOT block; False if it would block or if an error occured.
+
+ @param Socket the Socket to perfom the operation on.
+ @param pTimeout if NULL, the operation will block without a timeout. Otherwise
+ the time define by timeout value.
+*/
+sal_Bool SAL_CALL osl_isReceiveReady(oslSocket Socket, const TimeValue* pTimeout);
+
+/** Checks if send operations will block.
+ You can specify a timeout-value in seconds/microseconds that denotes
+ how long the operation will block if the Socket is not ready.
+ @return True if send operations (send, sendTo) on the Socket
+ will NOT block; False if it would block or if an error occured.
+
+ @param Socket the Socket to perfom the operation on.
+ @param pTimeout if NULL, the operation will block without a timeout. Otherwise
+ the time define by timeout value.
+*/
+sal_Bool SAL_CALL osl_isSendReady(oslSocket Socket, const TimeValue* pTimeout);
+
+/** Checks if a request for out-of-band data will block.
+ You can specify a timeout-value in seconds/microseconds that denotes
+ how long the operation will block if the Socket has no pending OOB data.
+ @return True if OOB-request operations (recv with appropriate flags)
+ on the Socket will NOT block; False if it would block or if an error occured.
+
+ @param Socket the Socket to perfom the operation on.
+ @param pTimeout if NULL, the operation will block without a timeout. Otherwise
+ the time define by timeout value.
+*/
+sal_Bool SAL_CALL osl_isExceptionPending(oslSocket Socket, const TimeValue* pTimeout);
+
+/** Shuts down communication on a connected socket.
+ @param Direction denotes which end of the socket
+ should be closed:
+
+
+ @return True if the socket could be closed down.
+*/
+sal_Bool SAL_CALL osl_shutdownSocket(oslSocket Socket,
+ oslSocketDirection Direction);
+
+/** Retrieves attributes associated with the socket.
+ @param Socket is the socket to query.
+
+ @param Level selects the level for which an option should be queried.
+ Valid values are:
+
+
+
+ @param Option denotes the option to query.
+ Valid values (depending on the Level) are:
+
+
+ If not above mentioned otherwise, the options are only valid for
+ level sol_socket.
+
+ @param pBuffer Pointer to a Buffer with enough room to take the desired
+ attribute-value.
+
+ @param BufferSize contains the length of the Buffer.
+
+ @return -1 if an error occured or else the size of the data copied into
+ pBuffer.
+*/
+sal_Int32 SAL_CALL osl_getSocketOption(oslSocket Socket,
+ oslSocketOptionLevel Level,
+ oslSocketOption Option,
+ void* pBuffer,
+ sal_uInt32 BufferLen);
+
+/** Sets the sockets attributes.
+
+ @param Socket is the socket to modify.
+
+ @param Level selects the level for which an option should be changed.
+ Valid values are:
+
+
+
+ @param Option denotes the option to modify.
+ Valid values (depending on the Level) are:
+
+
+ If not above mentioned otherwise, the options are only valid for
+ level sol_socket.
+
+ @param pBuffer Pointer to a Buffer which contains the attribute-value.
+
+ @param BufferSize contains the length of the Buffer.
+
+ @return True if the option could be changed.
+*/
+sal_Bool SAL_CALL osl_setSocketOption(oslSocket Socket,
+ oslSocketOptionLevel Level,
+ oslSocketOption Option,
+ void* pBuffer,
+ sal_uInt32 BufferLen);
+
+/** Enables/disables non-blocking-mode of the socket.
+ @param Socket Change mode for this socket.
+ @param On True: enable non-blocking mode, False: disable non-blocking mode.
+ @return True if mode could be changed.
+*/
+sal_Bool SAL_CALL osl_enableNonBlockingMode(oslSocket Socket,
+ sal_Bool On);
+
+
+/** Query state of non-blocking-mode of the socket.
+ @param Socket Query mode for this socket.
+ @return True if non-blocking-mode is enabled.
+*/
+sal_Bool SAL_CALL osl_isNonBlockingMode(oslSocket Socket);
+
+
+/** Queries the socket for its type.
+ @return one of:
+
+
+
+*/
+oslSocketType SAL_CALL osl_getSocketType(oslSocket Socket);
+
+/** Delivers a string which describes the last socket error.
+ @param strError The string that receives the error message.
+ than the provided buffer, it will be cut short. Buffer sizes about 128 chars
+ should be large enough.
+*/
+void SAL_CALL osl_getLastSocketErrorDescription(oslSocket Socket, rtl_uString **strError);
+
+/** Delivers a constant decribing the last error for the socket system.
+ @return osl_Socket_E_NONE if no error occured, osl_invalid_SocketError if
+ an unknown (unmapped) error occured, otherwise an enum describing the
+ error.
+*/
+oslSocketError SAL_CALL osl_getLastSocketError(oslSocket Socket);
+
+/** Type for the representation of socket sets.
+*/
+typedef void* oslSocketSet;
+
+/** Creates a set of sockets to be used with osl_demultiplexSocketEvents().
+ @return A oslSocketSet or 0 if creation failed.
+*/
+oslSocketSet SAL_CALL osl_createSocketSet();
+
+/** Destroys a oslSocketSet.
+*/
+void SAL_CALL osl_destroySocketSet(oslSocketSet Set);
+
+/** Clears the set from all previously added sockets.
+ @param Set the set to be cleared.
+*/
+void SAL_CALL osl_clearSocketSet(oslSocketSet Set);
+
+
+/** Adds a socket to the set.
+ @param Set the set were the socket is added.
+ @param Socket the socket to be added.
+*/
+void SAL_CALL osl_addToSocketSet(oslSocketSet Set, oslSocket Socket);
+
+/** Removes a socket from the set.
+ @param Set the set were the socket is removed from.
+ @param Socket the socket to be removed.
+*/
+void SAL_CALL osl_removeFromSocketSet(oslSocketSet Set, oslSocket Socket);
+
+/** Checks if socket is in the set.
+ @param Set the set to be checked.
+ @param Socket check if this socket is in the set.
+ @return True if socket is in the set.
+*/
+sal_Bool SAL_CALL osl_isInSocketSet(oslSocketSet Set, oslSocket Socket);
+
+/** Checks multiple sockets for events.
+ @param IncomingSet Checks the sockets in this set
+ for incoming events (read, accept). If the set is 0,
+ it is just skipped.
+ @param OutgoingSet Checks the sockets in this set
+ for outgoing events (write, connect). If the set is 0,
+ it is just skipped.
+ @param OutOfBandSet Checks the sockets in this set
+ for out-of-band events. If the set is 0, it is just skipped.
+ @param msTimeout Number of milliseconds to wait for events. If
+ msTimeout is -1, the call will block until an event or an error
+ occurs.
+ @return -1 on errors, otherwise the number of sockets with
+ pending events. In case of timeout, the number might be 0.
+*/
+sal_Int32 SAL_CALL osl_demultiplexSocketEvents(oslSocketSet IncomingSet,
+ oslSocketSet OutgoingSet,
+ oslSocketSet OutOfBandSet,
+ const TimeValue* pTimeout);
+
+void SAL_CALL osl_closeSocket(oslSocket Socket);
+
+
+/**@} end section oslSocket
+*/
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_SOCKET_H_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.8 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.7 2000/06/27 15:45:29 mhu
+* Added function osl_createInetBroadcastAddr().
+*
+* Revision 1.6 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.5 2000/03/31 15:56:19 rs
+* UNICODE-Changes
+*
+* Revision 1.4 2000/03/20 08:56:22 obr
+* Unicode API changes
+*
+* Revision 1.3 2000/03/16 16:43:53 obr
+* Unicode API changes
+*
+* Revision 1.2 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:20 jsc
+* verschoben aus osl
+*
+* Revision 1.22 1999/08/05 11:14:43 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.21 1999/07/21 16:13:06 ts
+* #67730# changed channel maneger api
+*
+* Revision 1.20 1999/03/04 09:58:37 rh
+* #62583 compare socketaddr
+*
+* Revision 1.19 1999/01/20 18:53:41 jsc
+* #61011# Typumstellung
+*
+* Revision 1.18 1998/03/13 15:07:32 rh
+* Cleanup of enum chaos and implemntation of pipes
+*
+* Revision 1.17 1998/02/16 19:34:52 rh
+* Cleanup of ports, integration of sal_uInt32, features for process
+*
+* Revision 1.16 1997/12/09 10:55:40 mib
+* AIX
+*
+* Revision 1.15 1997/11/25 10:14:40 fm
+* initial release for S/390
+*
+* Revision 1.14 1997/10/16 16:12:04 rh
+* *** empty log message ***
+*
+* Revision 1.13 1997/10/15 10:26:02 mhu
+* Added function: sal_Bool osl_getLocalHostname (sal_Char *pBuffer, int BufferSize)
+*
+* Revision 1.12 1997/09/15 10:53:54 mhu
+* Added function osl_copyHostAddr(const oslHostAddr Addr).
+*
+* Revision 1.11 1997/09/09 12:03:29 fm
+* *** empty log message ***
+*
+* Revision 1.10 1997/09/08 17:17:53 mhu
+* Added support for domain name resolution (oslHostAddr).
+*
+* Revision 1.9 1997/09/04 09:51:44 rh
+* Blockmode
+*
+* Revision 1.8 1997/08/23 20:36:40 rh
+* return value for name resolving
+*
+* Revision 1.7 1997/08/22 14:47:36 rh
+* TimeValue inserted
+*
+* Revision 1.6 1997/07/31 18:28:54 rh
+* Standard types adapted
+*
+* Revision 1.5 1997/07/31 15:28:40 ts
+* *** empty log message ***
+*
+* Revision 1.4 1997/07/17 11:02:28 rh
+* Header adapted and profile added
+*
+* Revision 1.3 1997/06/25 13:16:31 rh
+* Formatting
+*
+* Revision 1.2 1997/06/25 08:44:40 bho
+* !changed implementation of sems to SYS V, because POSIX Sems are not
+* supported yet by solaris.
+*
+* Revision 1.1 1997/06/19 13:10:11 bho
+* first version of OSL.
+*
+*************************************************************************/
+
diff --git a/sal/inc/osl/thread.h b/sal/inc/osl/thread.h
new file mode 100644
index 000000000000..15fc7e8f4f9b
--- /dev/null
+++ b/sal/inc/osl/thread.h
@@ -0,0 +1,329 @@
+/*************************************************************************
+ *
+ * $RCSfile: thread.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_THREAD_H_
+#define _OSL_THREAD_H_
+
+#ifndef _OSL_TYPES_H_
+# include
+ * sal_False if no address could be found. This may be either because
+ * there is no ethernet card or there is no appropriate algorithm
+ * implemented on the platform. In this case, pEthernetAddr is
+ * unchanged.
+ *
+ ***/
+sal_Bool SAL_CALL osl_getEthernetAddress( sal_uInt8 *pEthernetAddr );
+
+/**
+ @deprecated
+ Set the solar build number. Affect the profile function from osl and
+ the ORealDynamicLoader class from vos.
+ Default is the SUPD from the build process if it was build with the
+ solar environment, otherwise 0.
+ */
+void SAL_CALL osl_setSUPD( sal_Int32 n );
+
+/**
+ @deprecated
+ Return the solar build number
+ */
+sal_Int32 SAL_CALL osl_getSUPD();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.7 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.6 2000/05/26 10:12:13 hro
+* SAL_CALL for osl_getSUPD, osl_getSUPD
+*
+* Revision 1.5 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.4 2000/03/16 16:43:53 obr
+* Unicode API changes
+*
+* Revision 1.3 2000/03/16 14:16:34 mm
+* #74230# setSUPD
+*
+* Revision 1.2 1999/12/06 14:59:18 jbu
+* osl_getEthernetAddress added
+*
+* Revision 1.1 1999/10/25 09:48:05 mfe
+* added getEtherAddr
+*
+*************************************************************************/
diff --git a/sal/inc/rtl/alloc.h b/sal/inc/rtl/alloc.h
new file mode 100644
index 000000000000..67bbaa8706cd
--- /dev/null
+++ b/sal/inc/rtl/alloc.h
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * $RCSfile: alloc.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_ALLOC_H_
+#define _RTL_ALLOC_H_
+
+#ifndef _SAL_TYPES_H_
+# include
+ @param ppSequence sequence
+*/
+void SAL_CALL rtl_byte_sequence_reference2One(
+ sal_Sequence ** ppSequence );
+
+/** Reallocates length of byte sequence.
+
+ @param ppSequence sequence
+ @param nSize new size of sequence
+*/
+void SAL_CALL rtl_byte_sequence_realloc(
+ sal_Sequence ** ppSequence, sal_Int32 nSize );
+
+/** Acquires the byte sequence
+ @param pSequence sequence, that shall be acquired.
+ */
+void SAL_CALL rtl_byte_sequence_acquire( sal_Sequence *pSequence );
+
+/** Releases the byte sequence. If the refcount drops to zero,
+ * the sequence is freed.
+
+ @param pSequence sequence, that shall be released. Invalid after call.
+ */
+void SAL_CALL rtl_byte_sequence_release( sal_Sequence *pSequence );
+
+/** Constructs a bytes sequence with length nLength. All bytes are set to zero.
+ *
+ * @param On entry *ppSequence may be null , otherwise it is released.
+ * After the call, ppSequence contains the newly constructed sequence.
+ *
+ *
+ **/
+void SAL_CALL rtl_byte_sequence_construct( sal_Sequence **ppSequence , sal_Int32 nLength );
+
+/** Constructs a bytes sequence with length nLength. The data is not initialized.
+ *
+ * @param ppSequence contains the newly constructed sequence.
+ * *ppSequence is released on entry if needed.
+ *
+ **/
+void SAL_CALL rtl_byte_sequence_constructNoDefault(
+ sal_Sequence **ppSequence , sal_Int32 nLength );
+
+/** Constructs a byte sequence with length nLength and copies nLength bytes from pData.
+ *
+ * @param ppSequence contains the newly constructed sequence.
+ * *ppSequence is released on entry if needed.
+ **/
+void SAL_CALL rtl_byte_sequence_constructFromArray(
+ sal_Sequence **ppSequence, const sal_Int8 *pData , sal_Int32 nLength );
+
+/** Assigns the byte sequence pSequence to ppSequence.
+ *
+ * @param On entry *ppSequence may be null , otherwise it is released.
+ * ppSequence contains after the call a copy of pSequence.
+ * @param pSequence the source sequence
+ **/
+void SAL_CALL rtl_byte_sequence_assign( sal_Sequence **ppSequence , sal_Sequence *pSequence );
+
+/** Compares two byte sequences.
+ *
+ * @return sal_False, if the data within the sequences are different.
+ * sal_True, if the data within the sequences are identical
+ **/
+sal_Bool SAL_CALL rtl_byte_sequence_equals( sal_Sequence *pSequence1 , sal_Sequence *pSequence2 );
+
+
+/** Returns the data pointer of the sequence.
+ *
+ * @return const pointer to the data of the sequence. If rtl_byte_sequence_reference2One
+ * has been called before, the pointer may be casted to a non const pointer and
+ * the sequence may be modified.
+ **/
+const sal_Int8 *SAL_CALL rtl_byte_sequence_getConstArray( sal_Sequence *pSequence );
+
+/** Returns the length of the sequence
+ *
+ *
+ **/
+sal_Int32 SAL_CALL rtl_byte_sequence_getLength( sal_Sequence *pSequence );
+
+#ifdef __cplusplus
+}
+namespace rtl
+{
+
+enum __ByteSequence_NoDefault
+{
+ /** This enum value can be used to create a bytesequence with uninitalized data.
+
+ */
+ BYTESEQ_NODEFAULT = 0xcafe
+};
+
+enum __ByteSequence_NoAcquire
+{
+ /** This enum value can be used to create a bytesequence from a C-Handle without
+ acquiring the handle.
+
+ */
+ BYTESEQ_NOACQUIRE = 0xcafebabe
+};
+/** C++ class representing a SAL byte sequence.
+ C++ Sequences are reference counted and shared, so the sequence keeps a handle
+ to its data.
+ To keep value semantics, copies are only generated if the sequence is to be modified
+ (new handle).
+
+*/
+class ByteSequence
+{
+ /** sequence handle
+ */
+ sal_Sequence * _pSequence;
+
+public:
+ /** Default constructor:
+ Creates an empty sequence.
+
+ */
+ inline ByteSequence();
+ /** Copy constructor:
+ Creates a copy of given sequence.
+
+ @param rSeq another byte sequence
+ */
+ inline ByteSequence( const ByteSequence & rSeq );
+ /** Copy constructor
+ Creates a copy from the C-Handle.
+ */
+ inline ByteSequence( sal_Sequence *pSequence );
+ /** Constructor:
+ Creates a copy of given bytes.
+
+ @param pElement an array of bytes
+ @param len number of bytes
+ */
+ inline ByteSequence( const sal_Int8 * pElements, sal_Int32 len );
+ /** Constructor:
+ Creates sequence of given length and initializes all bytes to 0.
+
+ @param len initial sequence length
+ */
+ inline ByteSequence( sal_Int32 len );
+ /** Constructor:
+ Creates sequence of given length and does NOT initialize data. Use
+ this ctor for performance optimization only.
+
+ @param len initial sequence length
+ @param dummy parameter
+ */
+ inline ByteSequence( sal_Int32 len , enum __ByteSequence_NoDefault nodefault );
+ /** Constructor:
+ Creates a sequence from a C-Handle without acquiring the handle. Eitherway
+ the handle is release by the destructor. This ctor is useful, when working
+ with a c-interface (it safes a pair of acquire and release call and is thus
+ a performance optimization only ).
+
+ */
+ inline ByteSequence( sal_Sequence *pSequence , enum __ByteSequence_NoAcquire noacquire );
+ /** Destructor:
+ Releases sequence handle. Last handle will free memory.
+
+ */
+ inline ~ByteSequence();
+
+ /** Assignment operator:
+ Acquires given sequence handle and releases previously set handle.
+
+ @param rSeq another byte sequence
+ @return this sequence
+ */
+ inline ByteSequence & SAL_CALL operator = ( const ByteSequence & rSeq );
+
+ /** Gets length of sequence.
+
+ @return length of sequence
+ */
+ inline sal_Int32 SAL_CALL getLength() const
+ { return _pSequence->nElements; }
+
+ /** Gets a pointer to byte array for reading.
+ If the sequence has a length of 0, then the returned pointer is undefined.
+
+ @return pointer to byte array
+ */
+ inline const sal_Int8 * SAL_CALL getConstArray() const
+ { return (const sal_Int8 *)_pSequence->elements; }
+ /** Gets a pointer to elements array for reading and writing.
+ In general if the sequence has a handle acquired by other sequences
+ (reference count > 1), then a new sequence is created copying
+ all bytes to keep value semantics!
+ If the sequence has a length of 0, then the returned pointer is undefined.
+
+ @return pointer to elements array
+ */
+ inline sal_Int8 * SAL_CALL getArray();
+
+ /** Non-const index operator:
+ Obtains a reference to byte indexed at given position.
+ The implementation does not check for array bounds!
+ In general if the sequence has a handle acquired by other sequences
+ (reference count > 1), then a new sequence is created copying
+ all bytes to keep value semantics!
+
+ @param nIndex index
+ @return non-const C++ reference to element
+ */
+ inline sal_Int8 & SAL_CALL operator [] ( sal_Int32 nIndex )
+ { return getArray()[ nIndex ]; }
+ /** Const index operator:
+ Obtains a reference to byte indexed at given position.
+ The implementation does not check for array bounds!
+
+ @param nIndex index
+ @return const C++ reference to byte
+ */
+ inline const sal_Int8 & SAL_CALL operator [] ( sal_Int32 nIndex ) const
+ { return getConstArray()[ nIndex ]; }
+
+ /** Equality operator:
+ Compares two sequences.
+
+ @param rSeq another byte sequence (right side)
+ @return true if both sequences are equal, false otherwise
+ */
+ inline sal_Bool SAL_CALL operator == ( const ByteSequence & rSeq ) const;
+ /** Unequality operator:
+ Compares two sequences.
+
+ @param rSeq another byte sequence (right side)
+ @return false if both sequences are equal, true otherwise
+ */
+ inline sal_Bool SAL_CALL operator != ( const ByteSequence & rSeq ) const
+ { return (! operator == ( rSeq )); }
+
+ /** Reallocates sequence to new length.
+ If the sequence has a handle acquired by other sequences
+ (reference count > 1), then the remaining elements are copied
+ to a new sequence handle to keep value semantics!
+
+ @param nSize new size of sequence
+ */
+ inline void SAL_CALL realloc( sal_Int32 nSize );
+
+ /** Returns the (unacquired) C-Handle of the sequence
+ *
+ **/
+ inline sal_Sequence * SAL_CALL getHandle()
+ { return _pSequence; }
+};
+
+}
+#endif
+#endif
diff --git a/sal/inc/rtl/byteseq.hxx b/sal/inc/rtl/byteseq.hxx
new file mode 100644
index 000000000000..5fe4c0132ddd
--- /dev/null
+++ b/sal/inc/rtl/byteseq.hxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * $RCSfile: byteseq.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _RTL_BYTESEQ_HXX_
+#define _RTL_BYTESEQ_HXX_
+
+#ifndef _OSL_INTERLOCK_H_
+#include
Note that the initial setting will match the host system.
+ */
+rtl_Locale * SAL_CALL rtl_locale_getDefault();
+
+/**
+ * Sets the default.
+ * Normally set once at the beginning of applet or application,
+ * then never reset. setDefault
does not reset the host locale.
+ * @param language lowercase two-letter ISO-639 code.
+ * @param country uppercase two-letter ISO-3166 code.
+ * @param variant vendor and browser specific code. See class description.
+ */
+void SAL_CALL rtl_locale_setDefault( const sal_Unicode * language, const sal_Unicode * country, const sal_Unicode * variant );
+
+/**
+ * Getter for programmatic name of field,
+ * an lowercased two-letter ISO-639 code.
+ * @see #getDisplayLanguage
+ */
+rtl_uString * SAL_CALL rtl_locale_getLanguage( rtl_Locale * This );
+
+/**
+ * Getter for programmatic name of field,
+ * an uppercased two-letter ISO-3166 code.
+ * @see #getDisplayCountry
+ */
+rtl_uString * SAL_CALL rtl_locale_getCountry( rtl_Locale * This );
+
+/**
+ * Getter for programmatic name of field.
+ * @see #getDisplayVariant
+ */
+rtl_uString * SAL_CALL rtl_locale_getVariant( rtl_Locale * This );
+
+/**
+ * Returns the hash code of the locale This.
+ */
+sal_Int32 SAL_CALL rtl_locale_hashCode( rtl_Locale * This );
+
+/**
+ * Returns true if the locals are equal, otherwis false.
+ */
+sal_Int32 SAL_CALL rtl_locale_equals( rtl_Locale * This, rtl_Locale * obj );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTL_LOCALE_H_ */
+
+
diff --git a/sal/inc/rtl/locale.hxx b/sal/inc/rtl/locale.hxx
new file mode 100644
index 000000000000..4ee31db7e71c
--- /dev/null
+++ b/sal/inc/rtl/locale.hxx
@@ -0,0 +1,316 @@
+/*************************************************************************
+ *
+ * $RCSfile: locale.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:14 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_LOCALE_HXX_
+#define _RTL_LOCALE_HXX_
+
+#ifndef _RTL_LOCALE_H_
+#include OLocale
object represents a specific geographical, political,
+ * or cultural region. An operation that requires a OLocale
to perform
+ * its task is called locale-sensitive and uses the OLocale
+ * to tailor information for the user. For example, displaying a number
+ * is a locale-sensitive operation--the number should be formatted
+ * according to the customs/conventions of the user's native country,
+ * region, or culture.
+ *
+ * OLocale
object using one of the two constructors in
+ * this class:
+ *
+ *
+ * The first argument to both constructors is a valid ISO
+ * Language Code. These codes are the lower-case two-letter
+ * codes as defined by ISO-639.
+ * You can find a full list of these codes at a number of sites, such as:
+ *
+ * OLocale(String language, String country)
+ * OLocale(String language, String country, String variant)
+ *
+ *
+ * http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
+ *
+ *
+ * http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
+ *
+ * OLocale
object is just an identifier for a region,
+ * no validity check is performed when you construct a OLocale
.
+ * If you want to see whether particular resources are available for the
+ * OLocale
you construct, you must query those resources. For
+ * example, ask the NumberFormat
for the locales it supports
+ * using its getAvailableLocales
method.
+ *
Note: When you ask for a resource for a particular
+ * locale, you get back the best available match, not necessarily
+ * precisely what you asked for. For more information, look at
+ * ResourceBundle
.
+ *
+ * OLocale
class provides a number of convenient constants
+ * that you can use to create OLocale
objects for commonly used
+ * locales. For example, the following creates a OLocale
object
+ * for the United States:
+ *
+ *
+ *
+ *
+ * OLocale.US
+ *
+ * OLocale
you can query it for information about
+ * itself. Use getCountry
to get the ISO Country Code and
+ * getLanguage
to get the ISO Language Code. You can
+ * use getDisplayCountry
to get the
+ * name of the country suitable for displaying to the user. Similarly,
+ * you can use getDisplayLanguage
to get the name of
+ * the language suitable for displaying to the user. Interestingly,
+ * the getDisplayXXX
methods are themselves locale-sensitive
+ * and have two versions: one that uses the default locale and one
+ * that uses the locale specified as an argument.
+ *
+ * NumberFormat
class formats
+ * numbers, currency, or percentages in a locale-sensitive manner. Classes
+ * such as NumberFormat
have a number of convenience methods
+ * for creating a default object of that type. For example, the
+ * NumberFormat
class provides these three convenience methods
+ * for creating a default NumberFormat
object:
+ *
+ *
+ * These methods have two variants; one with an explicit locale
+ * and one without; the latter using the default locale.
+ *
+ * NumberFormat.getInstance()
+ * NumberFormat.getCurrencyInstance()
+ * NumberFormat.getPercentInstance()
+ *
+ *
+ *
+ * A
+ * NumberFormat.getInstance(myLocale)
+ * NumberFormat.getCurrencyInstance(myLocale)
+ * NumberFormat.getPercentInstance(myLocale)
+ *
+ * OLocale
is the mechanism for identifying the kind of object
+ * (NumberFormat
) that you would like to get. The locale is
+ * just a mechanism for identifying objects,
+ * not a container for the objects themselves.
+ *
+ *
+ *
+ *
+ * @see ResourceBundle
+ * @see java.text.Format
+ * @see java.text.NumberFormat
+ * @see java.text.Collation
+ * @version 1.21 29 Jan 1997
+ * @author Mark Davis
+ */
+class OLocale
+{
+public:
+ OLocale( rtl_Locale * locale )
+ : pData( locale ) {}
+
+ OLocale( const OLocale & obj)
+ : pData(obj.pData) {}
+
+ OLocale & operator = ( const OLocale & obj)
+ {
+ pData = obj.pData;
+ return *this;
+ }
+
+ /**
+ * Construct a locale from language, country, variant.
+ * @param language lowercase two-letter ISO-639 code.
+ * @param country uppercase two-letter ISO-3166 code.
+ * @param variant vendor and browser specific code. See class description.
+ */
+ static OLocale registerLocale( const OUString & language, const OUString & country,
+ const OUString & variant )
+ {
+ return rtl_locale_register( language, country, variant );
+ }
+
+ /**
+ * Construct a locale from language, country.
+ * @param language lowercase two-letter ISO-639 code.
+ * @param country uppercase two-letter ISO-3166 code.
+ */
+ static OLocale registerLocale( const OUString & language, const OUString & country )
+ {
+ return rtl_locale_register( language, country, NULL );
+ }
+
+ /** @deprecated
+ */
+ static OLocale getDefault() { return rtl_locale_getDefault(); }
+
+ /** @deprecated
+ */
+ static void setDefault( const OUString & language, const OUString & country,
+ const OUString & variant )
+ { rtl_locale_setDefault(language, country, variant); }
+
+ /**
+ * Getter for programmatic name of field,
+ * an lowercased two-letter ISO-639 code.
+ */
+ OUString getLanguage() const { return pData->Language; }
+
+ /**
+ * Getter for programmatic name of field,
+ * an uppercased two-letter ISO-3166 code.
+ */
+ OUString getCountry() const { return pData->Country; }
+
+ /**
+ * Getter for programmatic name of field.
+ */
+ OUString getVariant() const { return pData->Variant; }
+
+
+ /**
+ * Returns the hash code of the locale This.
+ */
+ sal_Int32 hashCode() const { return pData->HashCode; }
+
+ sal_Bool operator == (const OLocale & obj ) const
+ {
+ return pData == obj.pData;
+ }
+
+ rtl_Locale * getData() const { return pData; }
+
+private:
+ /**
+ * Must be the first member in this class. OUString access this member with
+ * *(rtl_Locale **)&locale.
+ */
+ rtl_Locale * pData;
+
+ OLocale()
+ : pData(rtl_locale_getDefault()) {}
+/*
+ OLocale( const OLocale & obj)
+ : pData(obj.pData) {}
+
+ OLocale & operator = ( const OLocale & obj)
+ { pData = obj.pData;
+ return *this;
+ }
+*/
+};
+
+#ifdef _USE_NAMESPACE
+}
+#endif
+
+#endif /* __cplusplus */
+#endif /* _RTL_LOCALE_HXX_ */
+
+
diff --git a/sal/inc/rtl/memory.h b/sal/inc/rtl/memory.h
new file mode 100644
index 000000000000..99f822ac754e
--- /dev/null
+++ b/sal/inc/rtl/memory.h
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * $RCSfile: memory.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:14 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _RTL_MEMORY_H_
+#define _RTL_MEMORY_H_
+
+#ifndef _SAL_TYPES_H_
+# include
+ * public static OLocale[] getAvailableLocales()
+ * public static String getDisplayName(OLocale objectLocale,
+ * OLocale displayLocale)
+ * public static final String getDisplayName(OLocale objectLocale)
+ * // getDisplayName will throw MissingResourceException if the locale
+ * // is not one of the available locales.
+ *
+ * String
that contains characters from
+ * the character array argument. The count
argument specifies
+ * the length of the array. The initial capacity of the string buffer is
+ * 16
plus the length of the string argument.
+ *
+ * @param newStr out parameter, contains the new string. The reference count is 1.
+ * @param value the initial value of the string.
+ * @param count the length of value.
+ */
+void SAL_CALL rtl_stringbuffer_newFromStr_WithLength( rtl_String ** newStr,
+ const sal_Char * value,
+ sal_Int32 count);
+
+/**
+ * Allocates a new String
that contains the same sequence of
+ * characters as the string argument. The initial capacity is the larger of:
+ *
+ *
+ *
+ * @param newStr out parameter, contains the new string. The reference count is 1.
+ * @param capacity the initial len of the string buffer.
+ * @param oldStr the initial value of the string.
+ * @return the new capacity of the string buffer
+ */
+sal_Int32 SAL_CALL rtl_stringbuffer_newFromStringBuffer( rtl_String ** newStr,
+ sal_Int32 capacity,
+ rtl_String * olsStr );
+
+/**
+ * Ensures that the capacity of the buffer is at least equal to the
+ * specified minimum.
+ * If the current capacity of this string buffer is less than the
+ * argument, then a new internal buffer is allocated with greater
+ * capacity. The new capacity is the larger of:
+ * bufferLen
argument.
+ * length
of the string argument.
+ *
+ *
+ * If the minimumCapacity
argument.
+ * 2
.
+ * minimumCapacity
argument is nonpositive, this
+ * method takes no action and simply returns.
+ *
+ * @param capacity in: old capicity, out: new capacity.
+ * @param minimumCapacity the minimum desired capacity.
+ */
+void SAL_CALL rtl_stringbuffer_ensureCapacity( /*inout*/rtl_String ** This,
+ /*inout*/sal_Int32* capacity,
+ sal_Int32 minimumCapacity);
+
+
+/**
+ * Inserts the string representation of the char
array
+ * argument into this string buffer.
+ * offset
. The length of this string buffer increases by
+ * the length of the argument.
+ *
+ * @param capacity the capacity of the string buffer
+ * @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,
+ sal_Int32 offset,
+ const sal_Char * str,
+ sal_Int32 len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTL_STRBUF_H_ */
+
+
diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
new file mode 100644
index 000000000000..42b0307e8f15
--- /dev/null
+++ b/sal/inc/rtl/strbuf.hxx
@@ -0,0 +1,682 @@
+/*************************************************************************
+ *
+ * $RCSfile: strbuf.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:14 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_STRBUF_HXX_
+#define _RTL_STRBUF_HXX_
+
+#ifndef _RTL_STRBUF_H_
+#include +
. For example, the code:
+ *
+ * x = "a" + 4 + "c"
+ *
+ * x = new OStringBuffer().append("a").append(4).append("c")
+ * .toString()
+ *
OStringBuffer
are the
+ * append
and insert
methods, which are
+ * overloaded so as to accept data of any type. Each effectively
+ * converts a given datum to a string and then appends or inserts the
+ * characters of that string to the string buffer. The
+ * append
method always adds these characters at the end
+ * of the buffer; the insert
method adds the characters at
+ * a specified point.
+ * z
refers to a string buffer object
+ * whose current contents are "start
", then
+ * the method call z.append("le")
would cause the string
+ * buffer to contain "startle
", whereas
+ * z.insert(4, "le")
would alter the string buffer to
+ * contain "starlet
".
+ * OStringBuffer
.
+ */
+ OStringBuffer( const OStringBuffer & value )
+ : pData(NULL)
+ , nCapacity( value.nCapacity )
+ {
+ rtl_stringbuffer_newFromStringBuffer( &pData, value.nCapacity, value.pData );
+ }
+
+ /**
+ * Constructs a string buffer with no characters in it and an
+ * initial capacity specified by the length
argument.
+ *
+ * @param length the initial capacity.
+ */
+ OStringBuffer(sal_Int32 length)
+ : pData(NULL)
+ , nCapacity( length )
+ {
+ rtl_string_new_WithLength( &pData, length );
+ }
+
+ /**
+ * 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 16
plus the length
+ * of the string argument.
+ *
+ * @param value the initial string value.
+ */
+ OStringBuffer(OString value)
+ : pData(NULL)
+ , nCapacity( value.getLength() + 16 )
+ {
+ rtl_stringbuffer_newFromStr_WithLength( &pData, value.getStr(), value.getLength() );
+ }
+
+ /**
+ * Release the string own string data and notice and acquire the string data of value.
+ */
+ OStringBuffer& operator = ( const OStringBuffer& value )
+ {
+ rtl_string_assign( &pData, value.pData );
+ return *this;
+ }
+
+ /**
+ * Release the string data.
+ */
+ ~OStringBuffer()
+ {
+ rtl_string_release( pData );
+ }
+
+ /**
+ * Fill the string data in the new string and clear the buffer.
+ * This method is more efficient than the contructor of the string. It does
+ * not copy the buffer.
+ *
+ * @return the string previously contained in the buffer.
+ */
+ OString makeStringAndClear()
+ {
+ OString aRet( pData );
+ RTL_STRING_NEW(&pData);
+ nCapacity = 0;
+ return aRet;
+ }
+
+ /**
+ * Returns the length (character count) of this string buffer.
+ *
+ * @return the number of characters in this string buffer.
+ */
+ sal_Int32 getLength()
+ {
+ return pData->length;
+ }
+
+ /**
+ * Returns the current capacity of the String buffer. The capacity
+ * is the amount of storage available for newly inserted
+ * characters. The real buffer size is 2 bytes longer, because
+ * all strings are 0 terminated.
+ *
+ * @return the current capacity of this string buffer.
+ */
+ sal_Int32 getCapacity()
+ {
+ return nCapacity;
+ }
+
+ /**
+ * Ensures that the capacity of the buffer is at least equal to the
+ * specified minimum.
+ * If the current capacity of this string buffer is less than the
+ * argument, then a new internal buffer is allocated with greater
+ * capacity. The new capacity is the larger of:
+ *
+ *
+ * If the minimumCapacity
argument.
+ * 2
.
+ * minimumCapacity
argument is nonpositive, this
+ * method takes no action and simply returns.
+ *
+ * @param minimumCapacity the minimum desired capacity.
+ */
+ void ensureCapacity(sal_Int32 minimumCapacity)
+ {
+ rtl_stringbuffer_ensureCapacity( &pData, &nCapacity, minimumCapacity );
+ }
+
+ /**
+ * Sets the length of this String buffer.
+ * If the newLength
argument is less than the current
+ * length of the string buffer, the string buffer is truncated to
+ * contain exactly the number of characters given by the
+ * newLength
argument.
+ * newLength
argument is greater than or equal
+ * to the current length, sufficient null characters
+ * ('\u0000'
) are appended to the string buffer so that
+ * length becomes the newLength
argument.
+ * newLength
argument must be greater than or equal
+ * to 0
.
+ *
+ * @param newLength the new length of the buffer.
+ */
+ void setLength(sal_Int32 newLength)
+ {
+ if( newLength > nCapacity )
+ rtl_stringbuffer_ensureCapacity(&pData, &nCapacity, newLength);
+ else
+ pData->buffer[newLength] = '\0';
+ pData->length = newLength;
+ }
+
+ /**
+ * Returns the character at a specific index in this string buffer.
+ * 0
, the next at index 1
, and so on, for
+ * array indexing.
+ * 0
, and less than the length of this string buffer.
+ *
+ * @param index the index of the desired character.
+ * @return the character at the specified index of this string buffer.
+ */
+ sal_Char charAt( sal_Int32 index )
+ {
+ return pData->buffer[ index ];
+ }
+
+ /**
+ * Return a null terminated character array.
+ */
+ operator const sal_Char *() const { return pData->buffer; }
+
+ /**
+ * Return a null terminated character array.
+ */
+ const sal_Char* getStr() const { return pData->buffer; }
+
+
+ /**
+ * The character at the specified index of this string buffer is set
+ * to ch
.
+ * 0
, and less than the length of this string buffer.
+ *
+ * @param index the index of the character to modify.
+ * @param ch the new character.
+ */
+ OStringBuffer & setCharAt(sal_Int32 index, sal_Char ch)
+ {
+ pData->buffer[ index ] = ch;
+ return *this;
+ }
+
+ /**
+ * Appends the string to this string buffer.
+ * String
argument are appended, in
+ * order, to the contents of this string buffer, increasing the
+ * length of this string buffer by the length of the argument.
+ *
+ * @param str a string.
+ * @return this string buffer.
+ */
+ OStringBuffer & append(const OString &str)
+ {
+ return append( str.getStr(), str.getLength() );
+ }
+
+ /**
+ * Appends the string representation of the char
array
+ * argument to this string buffer.
+ * char
array
+ * argument to this string buffer.
+ * str
are appended,
+ * in order, to the contents of this string buffer. The length of this
+ * string buffer increases by the value of len
.
+ *
+ * @param str the characters to be appended.
+ * @param len the number of characters to append.
+ * @return this string buffer.
+ */
+ OStringBuffer & append( const sal_Char * str, sal_Int32 len)
+ {
+ // insert behind the last character
+ rtl_stringbuffer_insert( &pData, &nCapacity, getLength(), str, len );
+ return *this;
+ }
+
+ /**
+ * Appends the string representation of the sal_Bool
+ * argument to the string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then appended to this string buffer.
+ *
+ * @param b a sal_Bool
.
+ * @return this string buffer.
+ */
+ OStringBuffer & append(sal_Bool b)
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
+ return append( sz, rtl_str_valueOfBoolean( sz, b ) );
+ }
+
+ /**
+ * Appends the string representation of the char
+ * argument to this string buffer.
+ * 1
.
+ *
+ * @param ch a char
.
+ * @return this string buffer.
+ */
+ OStringBuffer & append(sal_Char c)
+ {
+ return append( &c, 1 );
+ }
+
+ /**
+ * Appends the string representation of the sal_Int32
+ * argument to this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then appended to this string buffer.
+ *
+ * @param i an sal_Int32
.
+ * @return this string buffer.
+ */
+ OStringBuffer & append(sal_Int32 i, sal_Int16 radix = 10 )
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFINT32];
+ return append( sz, rtl_str_valueOfInt32( sz, i, radix ) );
+ }
+
+ /**
+ * Appends the string representation of the long
+ * argument to this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then appended to this string buffer.
+ *
+ * @param l a long
.
+ * @return this string buffer.
+ */
+ OStringBuffer & append(sal_Int64 l, sal_Int16 radix = 10 )
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFINT64];
+ return append( sz, rtl_str_valueOfInt64( sz, l, radix ) );
+ }
+
+ /**
+ * Appends the string representation of the float
+ * argument to this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then appended to this string buffer.
+ *
+ * @param f a float
.
+ * @return this string buffer.
+ */
+ OStringBuffer & append(float f)
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFFLOAT];
+ return append( sz, rtl_str_valueOfFloat( sz, f ) );
+ }
+
+ /**
+ * Appends the string representation of the double
+ * argument to this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then appended to this string buffer.
+ *
+ * @param d a double
.
+ * @return this string buffer.
+ */
+ OStringBuffer & append(double d)
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFDOUBLE];
+ return append( sz, rtl_str_valueOfDouble( sz, d ) );
+ }
+
+ /**
+ * Inserts the string into this string buffer.
+ * String
argument are inserted, in
+ * order, into this string buffer at the indicated offset. The length
+ * of this string buffer is increased by the length of the argument.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param str a string.
+ * @return this string buffer.
+ */
+ OStringBuffer & insert(sal_Int32 offset, const OString & str)
+ {
+ return insert( offset, str.getStr(), str.getLength() );
+ }
+
+ /**
+ * Inserts the string representation of the char
array
+ * argument into this string buffer.
+ * offset
. The length of this string buffer increases by
+ * the length of the argument.
+ *
+ * @param offset the offset.
+ * @param ch a character array.
+ * @return this string buffer.
+ */
+ OStringBuffer & insert( sal_Int32 offset, const sal_Char * str )
+ {
+ return insert( offset, str, rtl_str_getLength( str ) );
+ }
+
+ /**
+ * Inserts the string representation of the char
array
+ * argument into this string buffer.
+ * offset
. The length of this string buffer increases by
+ * the length of the argument.
+ *
+ * @param offset the offset.
+ * @param ch a character array.
+ * @param len the number of characters to append.
+ * @return this string buffer.
+ */
+ OStringBuffer & insert( sal_Int32 offset, const sal_Char * str, sal_Int32 len)
+ {
+ // insert behind the last character
+ rtl_stringbuffer_insert( &pData, &nCapacity, offset, str, len );
+ return *this;
+ }
+
+ /**
+ * Inserts the string representation of the sal_Bool
+ * argument into this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then inserted into this string buffer at the indicated
+ * offset.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param b a sal_Bool
.
+ * @return this string buffer.
+ */
+ OStringBuffer & insert(sal_Int32 offset, sal_Bool b)
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
+ return insert( offset, sz, rtl_str_valueOfBoolean( sz, b ) );
+ }
+
+ /**
+ * Inserts the string representation of the char
+ * argument into this string buffer.
+ * offset
. The length
+ * of this string buffer increases by one.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param ch a char
.
+ * @return this string buffer.
+ */
+ OStringBuffer & insert(sal_Int32 offset, sal_Char c)
+ {
+ return insert( offset, &c, 1 );
+ }
+
+ /**
+ * Inserts the string representation of the second sal_Int32
+ * argument into this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then inserted into this string buffer at the indicated
+ * offset.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param b an sal_Int32
.
+ * @return this string buffer.
+ */
+ OStringBuffer & insert(sal_Int32 offset, sal_Int32 i, sal_Int16 radix = 10 )
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFINT32];
+ return insert( offset, sz, rtl_str_valueOfInt32( sz, i, radix ) );
+ }
+
+ /**
+ * Inserts the string representation of the long
+ * argument into this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then inserted into this string buffer at the indicated
+ * offset.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param b a long
.
+ * @return this string buffer.
+ */
+ OStringBuffer & insert(sal_Int32 offset, sal_Int64 l, sal_Int16 radix = 10 )
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFINT64];
+ return insert( offset, sz, rtl_str_valueOfInt64( sz, l, radix ) );
+ }
+
+ /**
+ * Inserts the string representation of the float
+ * argument into this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then inserted into this string buffer at the indicated
+ * offset.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param b a float
.
+ * @return this string buffer.
+ */
+ OStringBuffer insert(sal_Int32 offset, float f)
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFFLOAT];
+ return insert( offset, sz, rtl_str_valueOfFloat( sz, f ) );
+ }
+
+ /**
+ * Inserts the string representation of the double
+ * argument into this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then inserted into this string buffer at the indicated
+ * offset.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param b a double
.
+ * @return this string buffer.
+ */
+ OStringBuffer & insert(sal_Int32 offset, double d)
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFDOUBLE];
+ return insert( offset, sz, rtl_str_valueOfDouble( sz, d ) );
+ }
+private:
+ /**
+ * A pointer to the data structur which contains the data.
+ */
+ rtl_String * pData;
+
+ /**
+ * The len of the pData->buffer.
+ */
+ sal_Int32 nCapacity;
+};
+
+#ifdef _USE_NAMESPACE
+}
+#endif
+
+#endif /* __cplusplus */
+#endif /* _RTL_STRBUF_HXX_ */
+
+
diff --git a/sal/inc/rtl/string.h b/sal/inc/rtl/string.h
new file mode 100644
index 000000000000..24343c908165
--- /dev/null
+++ b/sal/inc/rtl/string.h
@@ -0,0 +1,588 @@
+/*************************************************************************
+ *
+ * $RCSfile: string.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:14 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_STRING_H_
+#define _RTL_STRING_H_
+
+#ifndef _SAL_TYPES_H_
+#include true
if and only if second string represents
+ * the same sequence of characters as the first string, where case is ignored.
+ *
+ *
+ * ==
+ * operator).
+ * Character.toUppercase
to each
+ * character produces the same result.
+ * Character.toLowercase
to each
+ * character produces the same result.
+ * string
to compared.
+ * @param second the string
to compare first
+ * String
against.
+ * @return true
if the String
s are equal,
+ * ignoring case; false
otherwise.
+ */
+sal_Bool SAL_CALL rtl_str_equalsIgnoreCase_WithLength( const sal_Char * first, sal_Int32 firstLen, const sal_Char * second, sal_Int32 secondLen );
+sal_Bool SAL_CALL rtl_str_equalsIgnoreCase( const sal_Char * first, const sal_Char * second );
+
+/**
+ * Compares two strings lexicographically. Both
+ * strings must be NULL-terminated.
+ * The comparison is based on the ascii value of each character in
+ * the strings.
+ *
+ * @param first the String
to be compared.
+ * @param second the String
to compare first
+ * String
against.
+ * @return the value 0
if the argument string is equal to
+ * this string; a value less than 0
if first string
+ * is lexicographically less than the second string; and a
+ * value greater than 0
if first string is
+ * lexicographically greater than the second string.
+ */
+sal_Int32 SAL_CALL rtl_str_compare_WithLength( const sal_Char * first, sal_Int32 firstLen, const sal_Char * Second, sal_Int32 SecondLen );
+sal_Int32 SAL_CALL rtl_str_compare( const sal_Char * first, const sal_Char * Second );
+
+/**
+ * rtl_str_compareIgnoreCase() and rtl_str_compareIgnoreCase_WithLength()
+ * functions are caseinsensitive versions of rtl_str_compare() and
+ * rtl_str_compare_WithLength() respectively, described above. They assume
+ * the ASCII characterset and ignore differences in case when comparing
+ * lower and upper case characters. rtl_str_compareIgnoreCase_WithLength()
+ * does not compare more than len characters. Both strings have to be NULL
+ * terminated
+ *
+ * @param first the String
to be compared.
+ * @param second the String
to compare first
+ * String
against.
+ * @return the value 0
if the argument string is equal to
+ * this string; a value less than 0
if a all lowercase
+ * version of first string is lexicographically less than a all
+ * lowercase version of the second string; and a
+ * value greater than 0
if first string is
+ * lexicographically greater than the second string, again both
+ * strings all lowercase.
+ */
+sal_Int32 SAL_CALL
+rtl_str_compareIgnoreCase_WithLength(
+ const sal_Char *first, const sal_Char *second, sal_Int32 len );
+sal_Int32 SAL_CALL
+rtl_str_compareIgnoreCase( const sal_Char *first, const sal_Char *second );
+
+/**
+ * Returns a hashcode for the string.
+ *
+ * @param str a NULL-terminated string.
+ * @return a hash code value for str.
+ */
+sal_Int32 SAL_CALL rtl_str_hashCode_WithLength( const sal_Char * str, sal_Int32 len );
+sal_Int32 SAL_CALL rtl_str_hashCode( const sal_Char * str );
+
+/**
+ * Returns the index within the string of the first occurrence of the
+ * specified character.
+ *
+ * @param str a NULL-terminated string.
+ * @param ch a character.
+ * @return the index of the first occurrence of the character in the
+ * character sequence represented by the string, or
+ * -1
if the character does not occur.
+ */
+sal_Int32 SAL_CALL rtl_str_indexOfChar_WithLength( const sal_Char * str, sal_Int32 len, sal_Char ch );
+sal_Int32 SAL_CALL rtl_str_indexOfChar( const sal_Char * str, sal_Char ch );
+
+/**
+ * Returns the index within the string of the last occurrence of the
+ * specified character, searching backward starting at the specified index.
+ *
+ * @param str a NULL-terminated string.
+ * @param ch a character.
+ * @return the index of the last occurrence of the character in the
+ * character sequence represented by the string, or
+ * -1
if the character does not occur.
+ */
+sal_Int32 SAL_CALL rtl_str_lastIndexOfChar_WithLength( const sal_Char * str, sal_Int32 len, sal_Char ch );
+sal_Int32 SAL_CALL rtl_str_lastIndexOfChar( const sal_Char * str, sal_Char ch );
+
+/**
+ * Returns the index within the string of the first occurrence of the
+ * specified substring.
+ *
+ * @param str a NULL-terminated string.
+ * @param subStr a NULL-terminated substring to be searched for.
+ * @return if the string argument occurs as a substring within the
+ * string, then the index of the first character of the first
+ * such substring is returned; if it does not occur as a
+ * substring, -1
is returned.
+ */
+sal_Int32 SAL_CALL rtl_str_indexOfStr_WithLength( const sal_Char * str, sal_Int32 len, const sal_Char * subStr, sal_Int32 subLen );
+sal_Int32 SAL_CALL rtl_str_indexOfStr( const sal_Char * str, const sal_Char * subStr );
+
+/**
+ * Returns the index within this string of the last occurrence of
+ * the specified substring.
+ * The returned index indicates the start of the substring, and it
+ * must be equal to or less than fromIndex
.
+ *
+ * @param str a NULL-terminated string.
+ * @param subStr a NULL-terminated substring to be searched for.
+ * @return If the string argument occurs one or more times as a substring
+ * within the string, then the index of the first character of
+ * the last such substring is returned. If it does not occur as a
+ * substring -1
is returned.
+ */
+sal_Int32 SAL_CALL rtl_str_lastIndexOfStr_WithLength( const sal_Char * str, sal_Int32 len, const sal_Char * subStr, sal_Int32 subLen );
+sal_Int32 SAL_CALL rtl_str_lastIndexOfStr( const sal_Char * ggstr, const sal_Char * subStr );
+
+/**
+ * Replaces all occurrences of oldChar
in the string with
+ * newChar
.
+ * oldChar
does not occur in the
+ * character sequence represented by this object, then the string is
+ *not modified.
+ *
+ * @param str a NULL-terminated string.
+ * @param oldChar the old character.
+ * @param newChar the new character.
+ */
+void SAL_CALL rtl_str_replaceChar_WithLength( sal_Char * str, sal_Int32 len, sal_Char oldChar, sal_Char newChar);
+void SAL_CALL rtl_str_replaceChar( sal_Char * str, sal_Char oldChar, sal_Char newChar);
+
+/**
+ * Converts all of the characters in the string
to lower case.
+ * @param str a NULL-terminated string.
+ */
+void SAL_CALL rtl_str_toAsciiLowerCase_WithLength( sal_Char * str, sal_Int32 len );
+void SAL_CALL rtl_str_toAsciiLowerCase( sal_Char * str );
+
+/**
+ * Converts all of the characters in the string
to upper case.
+ *
+ * @param str a NULL-terminated string.
+ */
+void SAL_CALL rtl_str_toAsciiUpperCase_WithLength(sal_Char * str, sal_Int32 len);
+void SAL_CALL rtl_str_toAsciiUpperCase(sal_Char * str);
+
+/**
+ * Removes white space from both ends of the string.
+ * '\u0020'
(the space character) are considered to be
+ * white space.
+ *
+ * @param str a NULL-terminated string.
+ * @return new length of the string.
+ */
+sal_Int32 SAL_CALL rtl_str_trim_WithLength( sal_Char * str, sal_Int32 len );
+sal_Int32 SAL_CALL rtl_str_trim( sal_Char * str );
+
+/**
+ * Returns the string representation of the sal_Bool
argument.
+ *
+ * @param str a newly allocated string with the length RTL_STR_MAX_VALUEOFBOOLEAN
.
+ * @param b a sal_Bool
.
+ * @return if the argument is true
, a string equal to
+ * "true"
is returned; otherwise, a string equal to
+ * "false"
is returned.
+ */
+#define RTL_STR_MAX_VALUEOFBOOLEAN 6
+sal_Int32 SAL_CALL rtl_str_valueOfBoolean( sal_Char * str, sal_Bool b );
+
+/**
+ * Returns the string representation of the char
argument.
+ *
+ * @param str a newly allocated string with the length RTL_STR_MAX_VALUEOFCHAR
.
+ * @param ch a char
.
+ * @return a newly allocated string of length 1
containing
+ * as its single character the argument ch
.
+ */
+#define RTL_STR_MAX_VALUEOFCHAR 2
+sal_Int32 SAL_CALL rtl_str_valueOfChar( sal_Char * str, sal_Char ch );
+
+/**
+ * Returns the string representation of the int
argument.
+ * Integer.toString
method of one argument.
+ *
+ * @param str a newly allocated string with the length RTL_STR_MAX_VALUEOFINT32
.
+ * @param i an sal_Int32
.
+ * @return a newly allocated string containing a string representation of
+ * the int
argument.
+ * @see java.lang.Integer#toString(int, int)
+ */
+#define RTL_STR_MIN_RADIX 2
+#define RTL_STR_MAX_RADIX 36
+#define RTL_STR_MAX_VALUEOFINT32 33
+sal_Int32 SAL_CALL rtl_str_valueOfInt32(sal_Char * str, sal_Int32 i, sal_Int16 radix );
+
+/**
+ * Returns the string representation of the long
argument.
+ * Long.toString
method of one argument.
+ *
+ * @param str a newly allocated string with the length RTL_STR_MAX_VALUEOFINT64
.
+ * @param l a sal_Int64
.
+ * @return a newly allocated string containing a string representation of
+ * the long
argument.
+ * @see java.lang.Long#toString(long)
+ */
+#define RTL_STR_MAX_VALUEOFINT64 65
+sal_Int32 SAL_CALL rtl_str_valueOfInt64(sal_Char * str, sal_Int64 l, sal_Int16 radix );
+
+/**
+ * Returns the string representation of the float
argument.
+ * Float.toString
method of one argument.
+ *
+ * @param f a float
.
+ * @return a newly allocated string containing a string representation of
+ * the float
argument.
+ * @see java.lang.Float#toString(float)
+ */
+#define RTL_STR_MAX_VALUEOFFLOAT 1 /*???*/
+sal_Int32 SAL_CALL rtl_str_valueOfFloat(sal_Char * str, float f);
+
+/**
+ * Returns the string representation of the double
argument.
+ * Double.toString
method of one argument.
+ *
+ * @param d a double
.
+ * @return a newly allocated string containing a string representation of
+ * the double
argument.
+ * @see java.lang.Double#toString(double)
+ */
+#define RTL_STR_MAX_VALUEOFDOUBLE 1/*???*/
+sal_Int32 SAL_CALL rtl_str_valueOfDouble(sal_Char * str, double d);
+
+
+/*######################################################################*/
+
+
+/**
+ * A string with this reference count is static und must not deleted.
+ * It is also not allowed to modifiy the reference count.
+ */
+#define RTL_STATIC_ASCIISTRING_REF ((sal_Int32)0x80000000)
+
+#ifdef SAL_W32
+# pragma pack(push, 8)
+#elif defined(SAL_OS2)
+# pragma pack(1)
+#endif
+
+/**
+ * The implementation structure of a ascii string.
+ */
+typedef struct _rtl_String
+{
+ sal_Int32 refCount;
+ sal_Int32 length;
+ sal_Char buffer[1];
+} rtl_String;
+
+#ifdef SAL_W32
+# pragma pack(pop)
+#elif defined(SAL_OS2)
+# pragma pack()
+#endif
+
+/**
+ * Increment the reference count of the string.
+ */
+void SAL_CALL rtl_string_acquire( rtl_String * value );
+
+/**
+ * Decrement the reference count of the string. If the count goes to zero than the string is
+ * deleted.
+ */
+void SAL_CALL rtl_string_release( rtl_String * value );
+
+/**
+ * Allocates a new string
containing no characters.
+ * Use the macro RTL_NEWDEFAULTSTRING() which optimize platform dependend
+ * the access to the default string.
+ */
+void SAL_CALL rtl_string_new( rtl_String ** newStr);
+#define RTL_STRING_NEW(newStr) rtl_string_new(newStr)
+
+/**
+ * Allocates a new string
containing nLen characters.
+ * The values of the characters are '\0' defined.
+ */
+void SAL_CALL rtl_string_new_WithLength( rtl_String ** newStr, sal_Int32 nLen );
+
+/**
+ * Allocates a new string that contains the same sequence of
+ * characters as the string argument.
+ *
+ * @param value a string
.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_string_newFromString( rtl_String ** newStr, rtl_String * value);
+
+/**
+ * Allocates a new string
so that it represents the
+ * sequence of characters currently contained in the character array
+ * argument.
+ *
+ * @param value the initial value of the string.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_string_newFromStr( rtl_String ** newStr, const sal_Char * value );
+
+/**
+ * Allocates a new String
that contains characters from
+ * the character array argument.
+ *
+ * @param value array that is the source of characters.
+ * @param len the length of the array.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_string_newFromStr_WithLength(rtl_String ** newStr,
+ const sal_Char * value,
+ sal_Int32 Len);
+
+/**
+ * Assign rightValue to *str. Release *str and aquire rightValue!
+ */
+void SAL_CALL rtl_string_assign( rtl_String ** str, rtl_String * rightValue );
+
+/**
+ * Returns the length of this string.
+ * The length is equal to the number of 16-bit
+ * Unicode characters in the string.
+ *
+ * @return the length of the sequence of characters represented by the
+ * string.
+ */
+sal_Int32 SAL_CALL rtl_string_getLength( rtl_String * str );
+
+/**
+ * Return the pointer to the sal_Char array of the string
.
+ *
+ * @return a null terminated sal_Char *.
+ */
+sal_Char * SAL_CALL rtl_string_getStr( rtl_String * str );
+
+/**
+ * Concatenates the right string to the end of the left string. Left and
+ * right must be NULL-terminated strings.
+ * oldChar
in this string with newChar
.
+ * oldChar
does not occur in the
+ * character sequence represented by the string, then the string is
+ * returned.
+ *
+ * @param oldChar the old character.
+ * @param newChar the new character.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_string_newReplace( rtl_String ** newStr,
+ rtl_String * str,
+ sal_Char oldChar,
+ sal_Char newChar);
+
+/**
+ * Returns a new string resulting from replacing n = count characters
+ * from position index in this string with newStr
.
+ * String
to lower
+ * case using the rules of the given locale.
+ * @param locale use the case transformation rules for this locale
+ * @return the String, converted to lowercase.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_string_newToLowerCase( rtl_String ** newStr, rtl_String * str);
+
+/**
+ * Converts all of the characters in this String
to upper
+ * case using the rules of the given locale.
+ * @param locale use the case transformation rules for this locale
+ * @return the String, converted to uppercase.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_string_newToUpperCase( rtl_String ** newStr, rtl_String * str);
+
+/**
+ * Removes white space from both ends of the string.
+ * '\u0020'
(the space character) are considered to be
+ * white space.
+ *
+ * @return this string, with white space removed from the front and end.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_string_newTrim( rtl_String ** newStr, rtl_String * str );
+
+/**
+ * Returns the number of tokens in this String
seperated
+ * by cTok
.
+ *
+ * @param cTok the character which seperate the tokens
+ * @return the number of tokens.
+ */
+sal_Int32 SAL_CALL rtl_string_getTokenCount( rtl_String * str , sal_Char cTok);
+
+/**
+ * Returns a new string for the token specified by nToken. If nToken < 0 or
+ * nToken > tokenCount then an empty string is returned.
+ *
+ * @param nToken the number of the token to return.
+ * @param cTok the character which seperate the tokens
+ * @param newStr the new string for the token
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_string_getToken( rtl_String ** newStr , rtl_String * str, sal_Int32 nToken, sal_Char cTok);
+
+/* predefined constants used in headers wstring, wstring.hxx, string.hxx */
+#define OSTRING_TO_OUSTRING_CVTFLAGS (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE |\
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |\
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT)
+/* For SOffice 5.2, because we have problems, when the string get a diffrent length */
+#define OUSTRING_TO_OSTRING_CVTFLAGS (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |\
+ RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |\
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |\
+ RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 |\
+ RTL_UNICODETOTEXT_FLAGS_NOCOMPOSITE)
+/* For the future, when we use unicode
+#define OUSTRING_TO_OSTRING_CVTFLAGS (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |\
+ RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |\
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |\
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR |\
+ RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 |\
+ RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE |\
+ RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE)
+*/
+
+/* constAsciiStr must be a "..." or char const aFoo[] = "..." */
+#ifndef RTL_CONSTASCII_STRINGPARAM
+#define RTL_CONSTASCII_STRINGPARAM( constAsciiStr ) constAsciiStr, sizeof( constAsciiStr )-1
+#endif
+#ifndef RTL_CONSTASCII_LENGTH
+#define RTL_CONSTASCII_LENGTH( constAsciiStr ) (sizeof( constAsciiStr )-1)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTL_STRING_H_ */
+
+
diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
new file mode 100644
index 000000000000..53586cc2f311
--- /dev/null
+++ b/sal/inc/rtl/string.hxx
@@ -0,0 +1,827 @@
+/*************************************************************************
+ *
+ * $RCSfile: string.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_STRING_HXX_
+#define _RTL_STRING_HXX_
+
+#ifndef _RTL_STRING_H_
+#include OAsciiString
class represents character strings. All
+ * string literals in Java programs, such as "abc"
, are
+ * implemented as instances of this class.
+ *
+ * OAsciiString str = "abc";
+ *
+ * char data[] = {'a', 'b', 'c'};
+ * OAsciiString str = new OAsciiString(data);
+ *
+ *
+ * System.out.println("abc");
+ * OAsciiString cde = "cde";
+ * System.out.println("abc" + cde);
+ * OAsciiString c = "abc".substring(2,3);
+ * OAsciiString d = cde.substring(1, 2);
+ *
OAsciiString
includes methods for examining
+ * individual characters of the sequence, for comparing strings, for
+ * searching strings, for extracting substrings, and for creating a
+ * copy of a string with all characters translated to uppercase or to
+ * lowercase.
+ */
+class OString
+{
+ class DO_NOT_ACQUIRE;
+ OString( rtl_String * value, DO_NOT_ACQUIRE * )
+ : pData( value )
+ {
+ }
+public:
+ /**
+ * A pointer to the data structur which contains the data.
+ */
+ rtl_String * pData;
+
+ /**
+ * Allocates a new OString
containing no characters.
+ */
+ OString()
+ : pData(NULL)
+ {
+ RTL_STRING_NEW(&pData);
+ }
+
+ /**
+ * Notice and acquire the string data of value.
+ *
+ * @param value a OString
.
+ */
+ OString( const OString & value )
+ : pData( value.pData )
+ {
+ rtl_string_acquire( pData );
+ }
+
+ /**
+ * Notice and acquire the string data of value.
+ *
+ * @param value a rtl_String
.
+ */
+ OString( rtl_String * value )
+ : pData(value)
+ {
+ rtl_string_acquire( pData );
+ }
+
+ /**
+ * Allocates a new OString
so that it represents the
+ * sequence of characters currently contained in the character array
+ * argument.
+ *
+ * @param value the initial value of the string.
+ */
+ OString( const sal_Char * value)
+ : pData(NULL)
+ {
+ rtl_string_newFromStr( &pData, value );
+ }
+
+ /**
+ * Allocates a new OString
that contains characters from
+ * a subarray of the character array argument. The offset
+ * argument is the index of the first character of the subarray and
+ * the count
argument specifies the length of the
+ * subarray.
+ *
+ * @param value array that is the source of characters.
+ * @param offset the initial offset.
+ * @param count the length.
+ * @exception StringIndexOutOfBoundsException if the offset
+ * and count
arguments index characters outside
+ * the bounds of the value
array.
+ */
+ OString( const sal_Char * value, sal_Int32 length )
+ : pData(NULL)
+ {
+ rtl_string_newFromStr_WithLength( &pData, value, length );
+ }
+
+ /**
+ * Allocates a new OString
that contains the first
+ * count
characters of the Unicode character array argument.
+ * The Unicode string is converted to a 8 bit string using the
+ * encoding
argument.
+ *
+ * @param value Unicode character array
+ * @param count the length.
+ * @param encoding TextEncoding used to convert the 8 bit string
+ * @exception StringIndexOutOfBoundsException count
argument
+ * is bigger than the length of the 8 bit character string.
+ */
+ OString( const sal_Unicode * value, sal_Int32 length, rtl_TextEncoding encoding )
+ : pData(NULL)
+ {
+ RTL_STRING_NEW(&pData);
+ if( value )
+ {
+ // for exception
+ //sal_Int32 len = rtl_ustr_getLength(value);
+ //if( len < length )
+ // throw StringIndexOutOfBoundsException;
+
+ if( length )
+ rtl_uString2String( &pData, value, length, encoding, OUSTRING_TO_OSTRING_CVTFLAGS );
+ }
+ }
+
+ OString( const ByteString & value );
+
+ /**
+ * Release the string own string data and notice and acquire the string data of value.
+ */
+ OString& operator = ( const OString& value )
+ {
+ rtl_string_assign( &pData, value.pData );
+ return *this;
+ }
+
+ /**
+ * Release the string own string data and replace the string data with new string data
+ * containing the old string data concatenate with the sting data of value.
+ */
+ OString operator+=( const OString& rStr )
+ {
+ rtl_string_newConcat( &pData, pData, rStr.pData );
+ return *this;
+ }
+
+ /**
+ * Release the string data.
+ */
+ ~OString()
+ {
+ rtl_string_release( pData );
+ }
+
+ /**
+ * Allocates a new string that contains the sequence of characters
+ * currently contained in the string buffer argument.
+ *
+ * @param buffer a StringBuffer
.
+ */
+ //public OString (StringBuffer buffer) {
+
+ /**
+ * Returns the length of this string.
+ * The length is equal to the number of 16-bit
+ * Unicode characters in the string.
+ *
+ * @return the length of the sequence of characters represented by this
+ * object.
+ */
+ sal_Int32 getLength() const { return pData->length; }
+
+ /**
+ * Returns the character at the specified index. An index ranges
+ * from 0
to length() - 1
.
+ *
+ * @param index the index of the character.
+ * @return the character at the specified index of this string.
+ * The first character is at index 0
.
+ * @exception StringIndexOutOfBoundsException if the index is out of
+ * range.
+ */
+ //sal_Char operator [] ( sal_Int32 nIndex ) const
+ // { return pData->buffer[nIndex]; }
+
+ /**
+ * Return a null terminated character array.
+ */
+ operator const sal_Char *() const { return pData->buffer; }
+
+ /**
+ * Return a null terminated unicode character array.
+ */
+ const sal_Char* getStr() const { return pData->buffer; }
+
+ /**
+ * Compares this string to the specified object.
+ * The result is true
if and only if the argument is not
+ * null
and is a OString
object that represents
+ * the same sequence of characters as this object.
+ *
+ * @param anObject the object to compare this OString
+ * against.
+ * @return true
if the OString
are equal;
+ * false
otherwise.
+ * @see java.lang.OString#compareTo(java.lang.OString)
+ * @see java.lang.OString#equalsIgnoreCase(java.lang.OString)
+ */
+ sal_Bool equals( const OString & rObj ) const
+ {
+ return getLength() == rObj.getLength() && compareTo( rObj ) == 0;
+ }
+
+ /**
+ * Compares this OString to another object.
+ * The result is true
if and only if the argument is not
+ * null
and is a OString
object that represents
+ * the same sequence of characters as this object, where case is ignored.
+ *
+ *
+ * ==
+ * operator).
+ * Character.toUppercase
to each
+ * character produces the same result.
+ * Character.toLowercase
to each
+ * character produces the same result.
+ * OString
to compare this
+ * OString
against.
+ * @return true
if the OString
s are equal,
+ * ignoring case; false
otherwise.
+ * @see java.lang.Character#toLowerCase(char)
+ * @see java.lang.Character#toUpperCase(char)
+ */
+ sal_Bool equalsIgnoreCase( const OString & rObj ) const
+ {
+ return rtl_str_equalsIgnoreCase_WithLength( pData->buffer, pData->length,
+ rObj.pData->buffer, rObj.pData->length );
+ }
+
+ /**
+ * Compares two strings lexicographically.
+ * The comparison is based on the Unicode value of each character in
+ * the strings.
+ *
+ * @param anotherString the OString
to be compared.
+ * @return the value 0
if the argument string is equal to
+ * this string; a value less than 0
if this string
+ * is lexicographically less than the string argument; and a
+ * value greater than 0
if this string is
+ * lexicographically greater than the string argument.
+ */
+ sal_Int32 compareTo( const OString & rObj ) const
+ {
+ return rtl_str_compare_WithLength( pData->buffer, pData->length,
+ rObj.pData->buffer, rObj.pData->length );
+ }
+
+ /**
+ * Compares two strings lexicographically using only the number of
+ * characters given in the length parameter.
+ * The comparison is based on the Unicode value of each character in
+ * the strings.
+ *
+ * @param anotherString the OString
to be compared.
+ * @param length the number of characters that are compared.
+ * @return 'This string' and 'argument string' here means the substring
+ * defined by the length parameter.
+ * the value 0
if the argument string is equal to
+ * this string; a value less than 0
if this string
+ * is lexicographically less than the string argument; and a
+ * value greater than 0
if this string is
+ * lexicographically greater than the string argument.
+ */
+ sal_Int32 compareTo( const OString & rObj, sal_Int32 length ) const
+ {
+ return rtl_str_compare_WithLength( pData->buffer, length,
+ rObj.pData->buffer, rObj.pData->length );
+ }
+
+ friend sal_Bool operator == ( const OString& rStr1, const OString& rStr2 )
+ { return rStr1.getLength() == rStr2.getLength() && rStr1.compareTo( rStr2 ) == 0; }
+ friend sal_Bool operator == ( const OString& rStr1, const sal_Char * pStr2 )
+ { return rStr1.compareTo( pStr2 ) == 0; }
+ friend sal_Bool operator == ( const sal_Char * pStr1, const OString& rStr2 )
+ { return OString( pStr1 ).compareTo( rStr2 ) == 0; }
+
+ friend sal_Bool operator != ( const OString& rStr1, const OString& rStr2 )
+ { return !(operator == ( rStr1, rStr2 )); }
+ friend sal_Bool operator != ( const OString& rStr1, const sal_Char * pStr2 )
+ { return !(operator == ( rStr1, pStr2 )); }
+ friend sal_Bool operator != ( const sal_Char * pStr1, const OString& rStr2 )
+ { return !(operator == ( pStr1, rStr2 )); }
+
+ friend sal_Bool operator < ( const OString& rStr1, const OString& rStr2 )
+ { return rStr1.compareTo( rStr2 ) < 0; }
+ friend sal_Bool operator > ( const OString& rStr1, const OString& rStr2 )
+ { return rStr1.compareTo( rStr2 ) > 0; }
+ friend sal_Bool operator <= ( const OString& rStr1, const OString& rStr2 )
+ { return rStr1.compareTo( rStr2 ) <= 0; }
+ friend sal_Bool operator >= ( const OString& rStr1, const OString& rStr2 )
+ { return rStr1.compareTo( rStr2 ) >= 0; }
+
+ /**
+ * Returns a hashcode for this string.
+ *
+ * @return a hash code value for this object.
+ */
+ sal_Int32 hashCode() const
+ {
+ return rtl_str_hashCode_WithLength( pData->buffer, pData->length );
+ }
+
+ /**
+ * Returns the index within this string of the first occurrence of the
+ * specified character, starting the search at the specified index.
+ *
+ * @param ch a character.
+ * @param fromIndex the index to start the search from.
+ * @return the index of the first occurrence of the character in the
+ * character sequence represented by this object that is greater
+ * than or equal to fromIndex
, or -1
+ * if the character does not occur.
+ */
+ sal_Int32 indexOf( sal_Char ch, sal_Int32 fromIndex = 0 ) const
+ {
+ sal_Int32 ret = rtl_str_indexOfChar_WithLength( pData->buffer + fromIndex, pData->length - fromIndex, ch );
+ return (ret < 0 ? ret : ret + fromIndex);
+ }
+
+ /**
+ * Returns the index within this string of the first occurence of
+ * the specified substring.
+ * The returned index indicates the start of the substring, and it
+ * must be equal to or less than fromIndex
.
+ *
+ * @param str the substring to search for.
+ * @param fromIndex the index to start the search from.
+ * @return If the string argument occurs one or more times as a substring
+ * within this object at a starting index no greater than
+ * fromIndex
, then the index of the first character of
+ * the last such substring is returned. If it does not occur as a
+ * substring starting at fromIndex
or earlier,
+ * -1
is returned.
+ */
+ sal_Int32 indexOf( const OString & str, int fromIndex = 0) const
+ {
+ sal_Int32 ret = rtl_str_indexOfStr_WithLength( pData->buffer + fromIndex, pData->length - fromIndex,
+ str.pData->buffer, str.pData->length );
+ return (ret < 0 ? ret : ret + fromIndex);
+ }
+
+ /**
+ * Returns the index within this string of the last occurrence of the
+ * specified character, searching backward starting at the end.
+ *
+ * @param ch a character.
+ * @param fromIndex the index to start the search from.
+ * @return the index of the last occurrence of the character in the
+ * character sequence represented by this object that is less
+ * than or equal to length -1
, or -1
+ * if the character does not occur before that point.
+ */
+ sal_Int32 lastIndexOf( sal_Char ch, int fromIndex ) const
+ {
+ return rtl_str_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
+ }
+
+ /**
+ * Returns the index within this string of the last occurrence of the
+ * specified character, searching backward starting at the end.
+ *
+ * @param ch a character.
+ * @param fromIndex the index to start the search from.
+ * @return the index of the last occurrence of the character in the
+ * character sequence represented by this object that is less
+ * than or equal to length -1
, or -1
+ * if the character does not occur before that point.
+ */
+ sal_Int32 lastIndexOf( sal_Char ch ) const
+ {
+ return rtl_str_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
+ }
+
+ /**
+ * Returns the index within this string of the last occurrence of
+ * the specified substring.
+ * The returned index indicates the start of the substring, and it
+ * must be equal to or less than fromIndex
.
+ *
+ * @param str the substring to search for.
+ * @param fromIndex the index to start the search from.
+ * @return If the string argument occurs one or more times as a substring
+ * within this object at a starting index no greater than
+ * fromIndex
, then the index of the first character of
+ * the last such substring is returned. If it does not occur as a
+ * substring starting at fromIndex
or earlier,
+ * -1
is returned.
+ */
+ sal_Int32 lastIndexOf( const OString & str, int fromIndex ) const
+ {
+ return rtl_str_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
+ str.pData->buffer, str.pData->length );
+ }
+
+ /**
+ * Returns the index within this string of the last occurrence of
+ * the specified substring.
+ * The returned index indicates the start of the substring, and it
+ * must be equal to or less than fromIndex
.
+ *
+ * @param str the substring to search for.
+ * @param fromIndex the index to start the search from.
+ * @return If the string argument occurs one or more times as a substring
+ * within this object at a starting index no greater than
+ * fromIndex
, then the index of the first character of
+ * the last such substring is returned. If it does not occur as a
+ * substring starting at fromIndex
or earlier,
+ * -1
is returned.
+ */
+ sal_Int32 lastIndexOf( const OString & str ) const
+ {
+ return rtl_str_lastIndexOfStr_WithLength( pData->buffer, pData->length,
+ str.pData->buffer, str.pData->length );
+ }
+
+ /**
+ * Returns a new string that is a substring of this string. The
+ * substring begins at the specified index and extends to the end of
+ * this string.
+ *
+ * @param beginIndex the beginning index, inclusive.
+ * @return the specified substring.
+ * @exception StringIndexOutOfBoundsException if the
+ * beginIndex
is out of range.
+ */
+ OString copy( sal_Int32 beginIndex) const
+ {
+ return copy( beginIndex, getLength() - beginIndex );
+ }
+
+
+ /**
+ * Returns a new string that is a substring of this string. The
+ * substring begins at the specified beginIndex
and
+ * extends to the character at index endIndex - 1
.
+ *
+ * @param beginIndex the beginning index, inclusive.
+ * @param count the number of characters.
+ * @return the specified substring.
+ * @exception StringIndexOutOfBoundsException if the
+ * beginIndex
or the endIndex
is
+ * out of range.
+ */
+ OString copy( sal_Int32 beginIndex, sal_Int32 count ) const
+ {
+ if( beginIndex == 0 && count == getLength() )
+ return *this;
+ else
+ {
+ OString newStr;
+ rtl_string_newFromStr_WithLength( &newStr.pData, pData->buffer + beginIndex, count );
+ return newStr;
+ }
+ }
+
+ /**
+ * Concatenates the specified string to the end of this string.
+ * 0
, then this
+ * object is returned.
+ *
+ * @param str the OString
that is concatenated to the end
+ * of this OString
.
+ * @return a string that represents the concatenation of this object's
+ * characters followed by the string argument's characters.
+ */
+ OString concat( const OString & str ) const
+ {
+ OString newStr;
+ rtl_string_newConcat( &newStr.pData, pData, str.pData );
+ return newStr;
+ }
+
+ friend OString operator+( const OString& rStr1, const OString& rStr2 )
+ {
+ return rStr1.concat( rStr2 );
+ }
+
+ /**
+ * Returns a new string resulting from replacing all occurrences of
+ * oldChar
in this string with newChar
.
+ * oldChar
does not occur in the
+ * character sequence represented by this object, then this string is
+ * returned.
+ *
+ * @param oldChar the old character.
+ * @param newChar the new character.
+ * @return a string derived from this string by replacing every
+ * occurrence of oldChar
with newChar
.
+ */
+ OString replace( sal_Char oldChar, sal_Char newChar ) const
+ {
+ rtl_String * pNew = 0;
+ rtl_string_newReplace( &pNew, pData, oldChar, newChar );
+ return OString( pNew, (DO_NOT_ACQUIRE *)0 );
+ }
+
+ /**
+ * Returns a new string resulting from replacing n = count characters
+ * from position index in this string with newStr
.
+ * OString
to lowercase.
+ * toLowerCase
method defined by
+ * Character
, then the original string is returned.
+ * toUpperCase
method defined by
+ * Character
, then the original string is returned.
+ * '\u0020'
(the space character) are considered to be
+ * white space.
+ *
+ * @return this string, with white space removed from the front and end.
+ */
+ OString trim() const
+ {
+ rtl_String * pNew = 0;
+ rtl_string_newTrim( &pNew, pData );
+ return OString( pNew, (DO_NOT_ACQUIRE *)0 );
+ }
+
+ /**
+ * Returns the string representation of the sal_Bool
argument.
+ *
+ * @param b a sal_Bool
.
+ * @return if the argument is true
, a string equal to
+ * "true"
is returned; otherwise, a string equal to
+ * "false"
is returned.
+ */
+ static OString valueOf(sal_Bool b)
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
+ rtl_String * pNew = 0;
+ rtl_string_newFromStr_WithLength( &pNew, sz, rtl_str_valueOfBoolean( sz, b ) );
+ return OString( pNew, (DO_NOT_ACQUIRE *)0 );
+ }
+
+ /**
+ * Returns the string representation of the char
* argument.
+ *
+ * @param c a char
.
+ * @return a newly allocated string of length 1
containing
+ * as its single character the argument c
.
+ */
+ static OString valueOf(sal_Char c)
+ {
+ return OString( &c, 1 );
+ }
+
+ /**
+ * Returns the string representation of the int
argument.
+ * Integer.toString
method of one argument.
+ *
+ * @param i an int
.
+ * @return a newly allocated string containing a string representation of
+ * the int
argument.
+ * @see java.lang.Integer#toString(int, int)
+ */
+ static OString valueOf(sal_Int32 i, sal_Int16 radix = 10 )
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFINT32];
+ rtl_String * pNew = 0;
+ rtl_string_newFromStr_WithLength( &pNew, sz, rtl_str_valueOfInt32( sz, i, radix ) );
+ return OString( pNew, (DO_NOT_ACQUIRE *)0 );
+ }
+
+ /**
+ * Returns the string representation of the long
argument.
+ * Long.toString
method of one argument.
+ *
+ * @param l a long
.
+ * @return a newly allocated string containing a string representation of
+ * the long
argument.
+ * @see java.lang.Long#toString(long)
+ */
+ static OString valueOf(sal_Int64 l, sal_Int16 radix = 10 )
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFINT64];
+ rtl_String * pNew = 0;
+ rtl_string_newFromStr_WithLength( &pNew, sz, rtl_str_valueOfInt64( sz, l, radix ) );
+ return OString( pNew, (DO_NOT_ACQUIRE *)0 );
+ }
+
+ /**
+ * Returns the string representation of the float
argument.
+ * Float.toString
method of one argument.
+ *
+ * @param f a float
.
+ * @return a newly allocated string containing a string representation of
+ * the float
argument.
+ * @see java.lang.Float#toString(float)
+ */
+ static OString valueOf(float f)
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFFLOAT];
+ rtl_String * pNew = 0;
+ rtl_string_newFromStr_WithLength( &pNew, sz, rtl_str_valueOfFloat( sz, f ) );
+ return OString( pNew, (DO_NOT_ACQUIRE *)0 );
+ }
+
+ /**
+ * Returns the string representation of the double
argument.
+ * Double.toString
method of one argument.
+ *
+ * @param d a double
.
+ * @return a newly allocated string containing a string representation of
+ * the double
argument.
+ * @see java.lang.Double#toString(double)
+ */
+ static OString valueOf(double d)
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFDOUBLE];
+ rtl_String * pNew = 0;
+ rtl_string_newFromStr_WithLength( &pNew, sz, rtl_str_valueOfDouble( sz, d ) );
+ return OString( pNew, (DO_NOT_ACQUIRE *)0 );
+ }
+
+ // UString compatibility deprecated
+ sal_Int32 len() const { return getLength(); }
+
+ sal_Int32 search( sal_Char ch ) const { return indexOf( ch ); }
+
+ sal_Int32 getTokenCount( sal_Char cTok = ';' ) const
+ {
+ return rtl_string_getTokenCount(pData, cTok );
+ }
+
+ OString getToken( sal_Int32 nToken, sal_Char cTok = ';' ) const
+ {
+ OString newStr;
+ rtl_string_getToken( &newStr.pData, pData, nToken, cTok );
+ return newStr;
+ }
+
+ sal_Int32 search( const OString& rStr, sal_Int32 nIndex = 0) const { return indexOf( rStr, nIndex ); }
+ sal_Int32 search( const sal_Char* pchar, sal_Int32 nIndex = 0) const { return indexOf( pchar, nIndex ); }
+};
+
+#ifdef _USE_NAMESPACE
+}
+#endif
+
+#endif /* __cplusplus */
+#endif /* _RTL_STRING_HXX_ */
+
+
+
diff --git a/sal/inc/rtl/tencinfo.h b/sal/inc/rtl/tencinfo.h
new file mode 100644
index 000000000000..d2ebe8680cf8
--- /dev/null
+++ b/sal/inc/rtl/tencinfo.h
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * $RCSfile: tencinfo.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _RTL_TENCINFO_H
+#define _RTL_TENCINFO_H
+
+#ifndef _SAL_TYPES_H
+#include String
that contains characters from
+ * the character array argument. The count
argument specifies
+ * the length of the array. The initial capacity of the string buffer is
+ * 16
plus the length of the string argument.
+ *
+ * @param newStr out parameter, contains the new string. The reference count is 1.
+ * @param value the initial value of the string.
+ * @param count the length of value.
+ */
+void SAL_CALL rtl_uStringbuffer_newFromStr_WithLength( rtl_uString ** newStr,
+ const sal_Unicode * value,
+ sal_Int32 count );
+
+/**
+ * Allocates a new String
that contains the same sequence of
+ * characters as the string argument. The initial capacity is the larger of:
+ *
+ *
+ *
+ * @param newStr out parameter, contains the new string. The reference count is 1.
+ * @param capacity the initial len of the string buffer.
+ * @param oldStr the initial value of the string.
+ * @return the new capacity of the string buffer
+ */
+sal_Int32 SAL_CALL rtl_uStringbuffer_newFromStringBuffer( rtl_uString ** newStr,
+ sal_Int32 capacity,
+ rtl_uString * olsStr );
+
+/**
+ * Ensures that the capacity of the buffer is at least equal to the
+ * specified minimum.
+ * If the current capacity of this string buffer is less than the
+ * argument, then a new internal buffer is allocated with greater
+ * capacity. The new capacity is the larger of:
+ * bufferLen
argument.
+ * length
of the string argument.
+ *
+ *
+ * If the minimumCapacity
argument.
+ * 2
.
+ * minimumCapacity
argument is nonpositive, this
+ * method takes no action and simply returns.
+ *
+ * @param capacity in: old capicity, out: new capacity.
+ * @param minimumCapacity the minimum desired capacity.
+ */
+void SAL_CALL rtl_uStringbuffer_ensureCapacity( /*inout*/rtl_uString ** This,
+ /*inout*/sal_Int32* capacity,
+ sal_Int32 minimumCapacity);
+
+/**
+ * Inserts the string representation of the str
array
+ * argument into this string buffer.
+ * offset
. The length of this string buffer increases by
+ * the length of the argument.
+ *
+ * @param This The string, on that the operation should take place
+ * @param capacity the capacity of the string buffer
+ * @param offset the offset.
+ * @param str a character array.
+ * @param len the number of characters to append.
+ */
+void SAL_CALL rtl_uStringbuffer_insert( /*inout*/rtl_uString ** This,
+ /*inout*/sal_Int32 * capacity,
+ sal_Int32 offset,
+ const sal_Unicode * str,
+ sal_Int32 len);
+
+
+/**
+ * Inserts the 8-Bit ASCII string representation of the str
+ * array argument into this string buffer. Since this function is optimized
+ * for performance, the ASCII character values are not converted in any way.
+ * The caller has to make sure that all ASCII characters are in the allowed
+ * range between 0 and 127.
+ * offset
. The length of this string buffer increases by
+ * the length of the argument.
+ *
+ * @param This The string, on that the operation should take place
+ * @param capacity the capacity of the string buffer
+ * @param offset the offset.
+ * @param str a character array.
+ * @param len the number of characters to append.
+ */
+void SAL_CALL rtl_uStringbuffer_insert_ascii( /*inout*/rtl_uString ** This,
+ /*inout*/sal_Int32 * capacity,
+ sal_Int32 offset,
+ const sal_Char * str,
+ sal_Int32 len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTL_USTRBUF_H_ */
+
+
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
new file mode 100644
index 000000000000..6178ddf2e41d
--- /dev/null
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -0,0 +1,736 @@
+/*************************************************************************
+ *
+ * $RCSfile: ustrbuf.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:14 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_USTRBUF_HXX_
+#define _RTL_USTRBUF_HXX_
+
+#ifndef _OSL_DIAGNOSE_H_
+#include +
. For example, the code:
+ *
+ * x = "a" + 4 + "c"
+ *
+ * x = new OUStringBuffer().append("a").append(4).append("c")
+ * .toString()
+ *
OUStringBuffer
are the
+ * append
and insert
methods, which are
+ * overloaded so as to accept data of any type. Each effectively
+ * converts a given datum to a string and then appends or inserts the
+ * characters of that string to the string buffer. The
+ * append
method always adds these characters at the end
+ * of the buffer; the insert
method adds the characters at
+ * a specified point.
+ * z
refers to a string buffer object
+ * whose current contents are "start
", then
+ * the method call z.append("le")
would cause the string
+ * buffer to contain "startle
", whereas
+ * z.insert(4, "le")
would alter the string buffer to
+ * contain "starlet
".
+ * OStringBuffer
.
+ */
+ OUStringBuffer( const OUStringBuffer & value )
+ : pData(NULL)
+ , nCapacity( value.nCapacity )
+ {
+ rtl_uStringbuffer_newFromStringBuffer( &pData, value.nCapacity, value.pData );
+ }
+
+ /**
+ * Constructs a string buffer with no characters in it and an
+ * initial capacity specified by the length
argument.
+ *
+ * @param length the initial capacity.
+ */
+ OUStringBuffer(sal_Int32 length)
+ : pData(NULL)
+ , nCapacity( length )
+ {
+ rtl_uString_new_WithLength( &pData, length );
+ }
+
+ /**
+ * 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 16
plus the length
+ * of the string argument.
+ *
+ * @param str the initial contents of the buffer.
+ */
+ OUStringBuffer(OUString value)
+ : pData(NULL)
+ , nCapacity( value.getLength() + 16 )
+ {
+ rtl_uStringbuffer_newFromStr_WithLength( &pData, value.getStr(), value.getLength() );
+ }
+
+ /**
+ * Release the string own string data and notice and acquire the string data of value.
+ */
+ OUStringBuffer& operator = ( const OUStringBuffer& value )
+ {
+ rtl_uString_assign( &pData, value.pData );
+ return *this;
+ }
+
+ /**
+ * Release the string data.
+ */
+ ~OUStringBuffer()
+ {
+ rtl_uString_release( pData );
+ }
+
+ /**
+ * Fill the string data in the new string and clear the buffer.
+ * This method is more efficient than the contructor of the string. It does
+ * not copy the buffer.
+ *
+ * @return the string previously contained in the buffer.
+ */
+ OUString makeStringAndClear()
+ {
+ OUString aRet( pData );
+ RTL_USTRING_NEW(&pData);
+ nCapacity = 0;
+ return aRet;
+ }
+
+ /**
+ * Returns the length (character count) of this string buffer.
+ *
+ * @return the number of characters in this string buffer.
+ */
+ sal_Int32 getLength()
+ {
+ return pData->length;
+ }
+
+ /**
+ * Returns the current capacity of the String buffer. The capacity
+ * is the amount of storage available for newly inserted
+ * characters. The real buffer size is 2 bytes longer, because
+ * all strings are 0 terminated.
+ *
+ * @return the current capacity of this string buffer.
+ */
+ sal_Int32 getCapacity()
+ {
+ return nCapacity;
+ }
+
+ /**
+ * Ensures that the capacity of the buffer is at least equal to the
+ * specified minimum.
+ * If the current capacity of this string buffer is less than the
+ * argument, then a new internal buffer is allocated with greater
+ * capacity. The new capacity is the larger of:
+ *
+ *
+ * If the minimumCapacity
argument.
+ * 2
.
+ * minimumCapacity
argument is nonpositive, this
+ * method takes no action and simply returns.
+ *
+ * @param minimumCapacity the minimum desired capacity.
+ */
+ void ensureCapacity(sal_Int32 minimumCapacity)
+ {
+ rtl_uStringbuffer_ensureCapacity( &pData, &nCapacity, minimumCapacity );
+ }
+
+ /**
+ * Sets the length of this String buffer.
+ * If the newLength
argument is less than the current
+ * length of the string buffer, the string buffer is truncated to
+ * contain exactly the number of characters given by the
+ * newLength
argument.
+ * newLength
argument is greater than or equal
+ * to the current length, sufficient null characters
+ * ('\u0000'
) are appended to the string buffer so that
+ * length becomes the newLength
argument.
+ * newLength
argument must be greater than or equal
+ * to 0
.
+ *
+ * @param newLength the new length of the buffer.
+ */
+ void setLength(sal_Int32 newLength)
+ {
+ if( newLength > nCapacity )
+ rtl_uStringbuffer_ensureCapacity(&pData, &nCapacity, newLength);
+ else
+ pData->buffer[newLength] = 0;
+ pData->length = newLength;
+ }
+
+ /**
+ * Returns the character at a specific index in this string buffer.
+ * 0
, the next at index 1
, and so on, for
+ * array indexing.
+ * 0
, and less than the length of this string buffer.
+ *
+ * @param index the index of the desired character.
+ * @return the character at the specified index of this string buffer.
+ */
+ sal_Unicode charAt( sal_Int32 index )
+ {
+ return pData->buffer[ index ];
+ }
+
+ /**
+ * Return a null terminated unicode character array.
+ */
+ operator const sal_Unicode *() const { return pData->buffer; }
+
+ /**
+ * Return a null terminated unicode character array.
+ */
+ const sal_Unicode* getStr() const { return pData->buffer; }
+
+
+ /**
+ * The character at the specified index of this string buffer is set
+ * to ch
.
+ * 0
, and less than the length of this string buffer.
+ *
+ * @param index the index of the character to modify.
+ * @param ch the new character.
+ */
+ OUStringBuffer & setCharAt(sal_Int32 index, sal_Unicode ch)
+ {
+ pData->buffer[ index ] = ch;
+ return *this;
+ }
+
+ /**
+ * Appends the string to this string buffer.
+ * String
argument are appended, in
+ * order, to the contents of this string buffer, increasing the
+ * length of this string buffer by the length of the argument.
+ *
+ * @param str a string.
+ * @return this string buffer.
+ */
+ OUStringBuffer & append(const OUString &str)
+ {
+ return append( str.getStr(), str.getLength() );
+ }
+
+ /**
+ * Appends the string representation of the char
array
+ * argument to this string buffer.
+ * char
array
+ * argument to this string buffer.
+ * str
are appended,
+ * in order, to the contents of this string buffer. The length of this
+ * string buffer increases by the value of len
.
+ *
+ * @param str the characters to be appended.
+ * @param len the number of characters to append.
+ * @return this string buffer.
+ */
+ OUStringBuffer & append( const sal_Unicode * str, sal_Int32 len)
+ {
+ // insert behind the last character
+ rtl_uStringbuffer_insert( &pData, &nCapacity, getLength(), str, len );
+ return *this;
+ }
+
+ /**
+ * Appends a 8-Bit ASCII character string to this string buffer.
+ * Since this method is optimized for performance. the ASCII
+ * character values are not converted in any way. The caller
+ * has to make sure that all ASCII characters are in the
+ * allowed range between 0 and 127. The ASCII string must be
+ * NULL-terminated.
+ * str
are appended,
+ * in order, to the contents of this string buffer. The length of this
+ * string buffer increases by the value of len
.
+ *
+ * @param str the 8-Bit ASCII characters to be appended.
+ * @param len the number of characters to append.
+ * @return this string buffer.
+ */
+ OUStringBuffer & appendAscii( const sal_Char * str, sal_Int32 len)
+ {
+ rtl_uStringbuffer_insert_ascii( &pData, &nCapacity, getLength(), str, len );
+ return *this;
+ }
+
+
+ /**
+ * Appends the string representation of the sal_Bool
+ * argument to the string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then appended to this string buffer.
+ *
+ * @param b a sal_Bool
.
+ * @return this string buffer.
+ */
+ OUStringBuffer & append(sal_Bool b)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFBOOLEAN];
+ return append( sz, rtl_ustr_valueOfBoolean( sz, b ) );
+ }
+
+ /**
+ * Appends the string representation of the char
+ * argument to this string buffer.
+ * 1
.
+ *
+ * @param ch a char
.
+ * @return this string buffer.
+ */
+ OUStringBuffer & append(sal_Unicode c)
+ {
+ return append( &c, 1 );
+ }
+
+ /**
+ * Appends the string representation of the sal_Int32
+ * argument to this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then appended to this string buffer.
+ *
+ * @param i an sal_Int32
.
+ * @return this string buffer.
+ */
+ OUStringBuffer & append(sal_Int32 i, sal_Int16 radix = 10 )
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFINT32];
+ return append( sz, rtl_ustr_valueOfInt32( sz, i, radix ) );
+ }
+
+ /**
+ * Appends the string representation of the long
+ * argument to this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then appended to this string buffer.
+ *
+ * @param l a long
.
+ * @return this string buffer.
+ */
+ OUStringBuffer & append(sal_Int64 l, sal_Int16 radix = 10 )
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFINT64];
+ return append( sz, rtl_ustr_valueOfInt64( sz, l, radix ) );
+ }
+
+ /**
+ * Appends the string representation of the float
+ * argument to this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then appended to this string buffer.
+ *
+ * @param f a float
.
+ * @return this string buffer.
+ */
+ OUStringBuffer & append(float f)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFFLOAT];
+ return append( sz, rtl_ustr_valueOfFloat( sz, f ) );
+ }
+
+ /**
+ * Appends the string representation of the double
+ * argument to this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then appended to this string buffer.
+ *
+ * @param d a double
.
+ * @return this string buffer.
+ */
+ OUStringBuffer & append(double d)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFDOUBLE];
+ return append( sz, rtl_ustr_valueOfDouble( sz, d ) );
+ }
+
+ /**
+ * Inserts the string into this string buffer.
+ * String
argument are inserted, in
+ * order, into this string buffer at the indicated offset. The length
+ * of this string buffer is increased by the length of the argument.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param str a string.
+ * @return this string buffer.
+ */
+ OUStringBuffer & insert(sal_Int32 offset, const OUString & str)
+ {
+ return insert( offset, str.getStr(), str.getLength() );
+ }
+
+ /**
+ * Inserts the string representation of the char
array
+ * argument into this string buffer.
+ * offset
. The length of this string buffer increases by
+ * the length of the argument.
+ *
+ * @param offset the offset.
+ * @param ch a character array.
+ * @return this string buffer.
+ */
+ OUStringBuffer & insert( sal_Int32 offset, const sal_Unicode * str )
+ {
+ return insert( offset, str, rtl_ustr_getLength( str ) );
+ }
+
+ /**
+ * Inserts the string representation of the char
array
+ * argument into this string buffer.
+ * offset
. The length of this string buffer increases by
+ * the length of the argument.
+ *
+ * @param offset the offset.
+ * @param ch a character array.
+ * @param len the number of characters to append.
+ * @return this string buffer.
+ */
+ OUStringBuffer & insert( sal_Int32 offset, const sal_Unicode * str, sal_Int32 len)
+ {
+ // insert behind the last character
+ rtl_uStringbuffer_insert( &pData, &nCapacity, offset, str, len );
+ return *this;
+ }
+
+ /**
+ * Inserts the string representation of the sal_Bool
+ * argument into this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then inserted into this string buffer at the indicated
+ * offset.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param b a sal_Bool
.
+ * @return this string buffer.
+ */
+ OUStringBuffer & insert(sal_Int32 offset, sal_Bool b)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFBOOLEAN];
+ return insert( offset, sz, rtl_ustr_valueOfBoolean( sz, b ) );
+ }
+
+ /**
+ * Inserts the string representation of the char
+ * argument into this string buffer.
+ * offset
. The length
+ * of this string buffer increases by one.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param ch a char
.
+ * @return this string buffer.
+ */
+ OUStringBuffer & insert(sal_Int32 offset, sal_Unicode c)
+ {
+ return insert( offset, &c, 1 );
+ }
+
+ /**
+ * Inserts the string representation of the second sal_Int32
+ * argument into this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then inserted into this string buffer at the indicated
+ * offset.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param b an sal_Int32
.
+ * @return this string buffer.
+ * @exception StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ OUStringBuffer & insert(sal_Int32 offset, sal_Int32 i, sal_Int16 radix = 10 )
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFINT32];
+ return insert( offset, sz, rtl_ustr_valueOfInt32( sz, i, radix ) );
+ }
+
+ /**
+ * Inserts the string representation of the long
+ * argument into this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then inserted into this string buffer at the indicated
+ * offset.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param b a long
.
+ * @return this string buffer.
+ * @exception StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ OUStringBuffer & insert(sal_Int32 offset, sal_Int64 l, sal_Int16 radix = 10 )
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFINT64];
+ return insert( offset, sz, rtl_ustr_valueOfInt64( sz, l, radix ) );
+ }
+
+ /**
+ * Inserts the string representation of the float
+ * argument into this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then inserted into this string buffer at the indicated
+ * offset.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param b a float
.
+ * @return this string buffer.
+ * @exception StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ OUStringBuffer insert(sal_Int32 offset, float f)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFFLOAT];
+ return insert( offset, sz, rtl_ustr_valueOfFloat( sz, f ) );
+ }
+
+ /**
+ * Inserts the string representation of the double
+ * argument into this string buffer.
+ * String.valueOf
, and the characters of that
+ * string are then inserted into this string buffer at the indicated
+ * offset.
+ * 0
, and less than or equal to the length of this
+ * string buffer.
+ *
+ * @param offset the offset.
+ * @param b a double
.
+ * @return this string buffer.
+ * @exception StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ OUStringBuffer & insert(sal_Int32 offset, double d)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFDOUBLE];
+ return insert( offset, sz, rtl_ustr_valueOfDouble( sz, d ) );
+ }
+private:
+ /**
+ * A pointer to the data structur which contains the data.
+ */
+ rtl_uString * pData;
+
+ /**
+ * The len of the pData->buffer.
+ */
+ sal_Int32 nCapacity;
+};
+
+#ifdef _USE_NAMESPACE
+}
+#endif
+
+#endif /* __cplusplus */
+#endif /* _RTL_USTRBUF_HXX_ */
+
+
diff --git a/sal/inc/rtl/ustring.h b/sal/inc/rtl/ustring.h
new file mode 100644
index 000000000000..952bb431a330
--- /dev/null
+++ b/sal/inc/rtl/ustring.h
@@ -0,0 +1,717 @@
+/*************************************************************************
+ *
+ * $RCSfile: ustring.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _RTL_USTRING_H_
+#define _RTL_USTRING_H_
+
+#ifndef _SAL_TYPES_H_
+#include true
if and only if second string represents
+ * the same sequence of characters as the first string, where case is ignored.
+ *
+ *
+ * ==
+ * operator).
+ * Character.toUppercase
to each
+ * character produces the same result.
+ * Character.toLowercase
to each
+ * character produces the same result.
+ * string
to compared.
+ * @param second the string
to compare first
+ * String
against.
+ * @return true
if the String
s are equal,
+ * ignoring case; false
otherwise.
+ */
+sal_Bool SAL_CALL rtl_ustr_equalsIgnoreCase_WithLength( const sal_Unicode * first, sal_Int32 firstLen, const sal_Unicode * second, sal_Int32 secondLen );
+sal_Bool SAL_CALL rtl_ustr_equalsIgnoreCase( const sal_Unicode * first, const sal_Unicode * second );
+
+/**
+ * Compares two strings lexicographically. Both
+ * strings must be NULL-terminated.
+ * The comparison is based on the Unicode value of each character in
+ * the strings.
+ *
+ * @param first the String
to be compared.
+ * @param second the String
to compare first
+ * String
against.
+ * @return the value 0
if the argument string is equal to
+ * this string; a value less than 0
if first string
+ * is lexicographically less than the second string; and a
+ * value greater than 0
if first string is
+ * lexicographically greater than the second string.
+ */
+sal_Int32 SAL_CALL rtl_ustr_compare_WithLength( const sal_Unicode * first, sal_Int32 firstLen, const sal_Unicode * second, sal_Int32 secondLen );
+sal_Int32 SAL_CALL rtl_ustr_compare( const sal_Unicode * first, const sal_Unicode * second );
+
+/**
+ * Compares two strings lexicographically. Both
+ * strings must be NULL-terminated.
+ * The comparison is based on the Unicode value of each character in
+ * the strings.
+ *
+ * @param first the String
to be compared.
+ * @param second the String
to compare first
+ * String
against.
+ * @param shortenedLength the number of characters which should be compared.
+ * This length can be longer, shorter or equal than the both other strings.
+ *
+ * @return the value 0
if the argument string is equal to
+ * this string; a value less than 0
if first string
+ * is lexicographically less than the second string; and a
+ * value greater than 0
if first string is
+ * lexicographically greater than the second string.
+ */
+sal_Int32 SAL_CALL rtl_ustr_shortenedCompare_WithLength( const sal_Unicode * first, sal_Int32 firstLen,
+ const sal_Unicode * second, sal_Int32 secondLen, sal_Int32 shortenedLength );
+
+/**
+ * Compares lexicographically a 16-Bit Unicode character string directly
+ * with a 8-Bit ASCII character string. Since this function is optimized
+ * for performance. the ASCII character values are not converted in any
+ * way. The caller has to make sure that all ASCII characters are in the
+ * allowed range between 0 and 127. strings must be NULL-terminated.
+ *
+ * @param first the String
to be compared.
+ * @param second the String
to compare first
+ * String
against.
+ *
+ * @return the value 0
if the argument string is equal to
+ * this string; a value less than 0
if first string
+ * is lexicographically less than the second string; and a
+ * value greater than 0
if first string is
+ * lexicographically greater than the second string.
+ */
+sal_Int32 SAL_CALL rtl_ustr_ascii_compare_WithLength( const sal_Unicode * first, sal_Int32 firstLen,
+ const sal_Char * second );
+sal_Int32 SAL_CALL rtl_ustr_ascii_compare( const sal_Unicode * first, const sal_Char * second );
+
+/**
+ * Compares the string reverse lexicographically with a 8-Bit ASCII
+ * character string. The secondLength parameter is the length of
+ * the ASCII string and not the number of characters which should be
+ * compared. The reverse comparison is based on the
+ * numerical values of each Unicode/ASCII character in the
+ * strings with a 8-Bit ASCII character string. Since this
+ * method is optimized for performance. the ASCII character
+ * values are not converted in any way. The caller has to
+ * ensure that all ASCII characters are in the allowed
+ * range between 0 and 127.
+ * The ASCII string must be NULL-terminated.
+ *
+ * @param first the String
to be compared.
+ * @param second the String
to compare first
+ * String
against.
+ * @param secondLength the
+ *
+ * @return the value 0
if the argument string is equal to
+ * this string; a value less than 0
if first string
+ * is lexicographically less than the second string; and a
+ * value greater than 0
if first string is
+ * lexicographically greater than the second string.
+ * The compare order is from the last character to the
+ * first one.
+ */
+sal_Int32 SAL_CALL rtl_ustr_asciil_reverseCompare_WithLength( const sal_Unicode * first, sal_Int32 firstLen,
+ const sal_Char * second, sal_Int32 secondLength );
+
+/**
+ * Compares lexicographically a 16-Bit Unicode character string directly
+ * with a 8-Bit ASCII character string. Since this function is optimized
+ * for performance. the ASCII character values are not converted in any
+ * way. The caller has to make sure that all ASCII characters are in the
+ * allowed range between 0 and 127. strings must be NULL-terminated.
+ *
+ * @param first the String
to be compared.
+ * @param second the String
to compare first
+ * String
against.
+ * @param shortenedLength the number of characters which should be compared.
+ * This length can be longer, shorter or equal than the both other strings.
+ *
+ * @return the value 0
if the argument string is equal to
+ * this string; a value less than 0
if first string
+ * is lexicographically less than the second string; and a
+ * value greater than 0
if first string is
+ * lexicographically greater than the second string.
+ */
+sal_Int32 SAL_CALL rtl_ustr_ascii_shortenedCompare_WithLength( const sal_Unicode * first, sal_Int32 firstLen,
+ const sal_Char * second, sal_Int32 shortenedLength );
+
+/**
+ * Returns a hashcode for the string.
+ *
+ * @param str a NULL-terminated string.
+ * @return a hash code value for str.
+ */
+sal_Int32 SAL_CALL rtl_ustr_hashCode_WithLength( const sal_Unicode * str, sal_Int32 len );
+sal_Int32 SAL_CALL rtl_ustr_hashCode( const sal_Unicode * str );
+
+/**
+ * Returns the index within the string of the first occurrence of the
+ * specified character.
+ *
+ * @param str a NULL-terminated string.
+ * @param ch a character.
+ * @return the index of the first occurrence of the character in the
+ * character sequence represented by the string, or
+ * -1
if the character does not occur.
+ */
+sal_Int32 SAL_CALL rtl_ustr_indexOfChar_WithLength( const sal_Unicode * str, sal_Int32 len, sal_Unicode ch );
+sal_Int32 SAL_CALL rtl_ustr_indexOfChar( const sal_Unicode * str, sal_Unicode ch );
+
+/**
+ * Returns the index within the string of the last occurrence of the
+ * specified character, searching backward starting at the specified index.
+ *
+ * @param str a NULL-terminated string.
+ * @param ch a character.
+ * @return the index of the last occurrence of the character in the
+ * character sequence represented by the string, or
+ * -1
if the character does not occur.
+ */
+sal_Int32 SAL_CALL rtl_ustr_lastIndexOfChar_WithLength( const sal_Unicode * str, sal_Int32 len, sal_Unicode ch );
+sal_Int32 SAL_CALL rtl_ustr_lastIndexOfChar( const sal_Unicode * str, sal_Unicode ch );
+
+/**
+ * Returns the index within the string of the first occurrence of the
+ * specified substring.
+ *
+ * @param str a NULL-terminated string.
+ * @param subStr a NULL-terminated substring to be searched for.
+ * @return if the string argument occurs as a substring within the
+ * string, then the index of the first character of the first
+ * such substring is returned; if it does not occur as a
+ * substring, -1
is returned.
+ */
+sal_Int32 SAL_CALL rtl_ustr_indexOfStr_WithLength( const sal_Unicode * str, sal_Int32 len, const sal_Unicode * subStr, sal_Int32 subLen );
+sal_Int32 SAL_CALL rtl_ustr_indexOfStr( const sal_Unicode * str, const sal_Unicode * subStr );
+
+/**
+ * Returns the index within this string of the last occurrence of
+ * the specified substring.
+ * The returned index indicates the start of the substring, and it
+ * must be equal to or less than fromIndex
.
+ *
+ * @param str a NULL-terminated string.
+ * @param subStr a NULL-terminated substring to be searched for.
+ * @return If the string argument occurs one or more times as a substring
+ * within the string, then the index of the first character of
+ * the last such substring is returned. If it does not occur as a
+ * substring -1
is returned.
+ */
+sal_Int32 SAL_CALL rtl_ustr_lastIndexOfStr_WithLength( const sal_Unicode * str, sal_Int32 len, const sal_Unicode * subStr, sal_Int32 subLen );
+sal_Int32 SAL_CALL rtl_ustr_lastIndexOfStr( const sal_Unicode * ggstr, const sal_Unicode * subStr );
+
+/**
+ * Replaces all occurrences of oldChar
in the string with
+ * newChar
.
+ * oldChar
does not occur in the
+ * character sequence represented by this object, then the string is
+ *not modified.
+ *
+ * @param str a NULL-terminated string.
+ * @param oldChar the old character.
+ * @param newChar the new character.
+ */
+void SAL_CALL rtl_ustr_replaceChar_WithLength( sal_Unicode * str, sal_Int32 len, sal_Unicode oldChar, sal_Unicode newChar);
+void SAL_CALL rtl_ustr_replaceChar( sal_Unicode * str, sal_Unicode oldChar, sal_Unicode newChar);
+
+/**
+ * Converts all of the characters in the string
to lower case.
+ * @param str a NULL-terminated string.
+ */
+void SAL_CALL rtl_ustr_toAsciiLowerCase_WithLength( sal_Unicode * str, sal_Int32 len );
+void SAL_CALL rtl_ustr_toAsciiLowerCase( sal_Unicode * str );
+
+/**
+ * Converts all of the characters in the string
to upper case.
+ *
+ * @param str a NULL-terminated string.
+ */
+void SAL_CALL rtl_ustr_toAsciiUpperCase_WithLength(sal_Unicode * str, sal_Int32 len);
+void SAL_CALL rtl_ustr_toAsciiUpperCase(sal_Unicode * str);
+
+/**
+ * Removes white space from both ends of the string.
+ * '\u0020'
(the space character) are considered to be
+ * white space.
+ *
+ * @param str a NULL-terminated string.
+ * @return new length of the string.
+ */
+sal_Int32 SAL_CALL rtl_ustr_trim_WithLength( sal_Unicode * str, sal_Int32 len );
+sal_Int32 SAL_CALL rtl_ustr_trim( sal_Unicode * str );
+
+/**
+ * Returns the string representation of the sal_Bool
argument.
+ *
+ * @param str a newly allocated string with the length RTL_USTR_MAX_VALUEOFBOOLEAN
.
+ * @param b a sal_Bool
.
+ * @return if the argument is true
, a string equal to
+ * "true"
is returned; otherwise, a string equal to
+ * "false"
is returned.
+ */
+#define RTL_USTR_MAX_VALUEOFBOOLEAN 6
+sal_Int32 SAL_CALL rtl_ustr_valueOfBoolean( sal_Unicode * str, sal_Bool b );
+
+/**
+ * Returns the string representation of the char
argument.
+ *
+ * @param str a newly allocated string with the length RTL_USTR_MAX_VALUEOFCHAR
.
+ * @param ch a char
.
+ * @return a newly allocated string of length 1
containing
+ * as its single character the argument ch
.
+ */
+#define RTL_USTR_MAX_VALUEOFCHAR 2
+sal_Int32 SAL_CALL rtl_ustr_valueOfChar( sal_Unicode * str, sal_Unicode ch );
+
+/**
+ * Returns the string representation of the int
argument.
+ * Integer.toString
method of one argument.
+ *
+ * @param str a newly allocated string with the length RTL_USTR_MAX_VALUEOFINT32
.
+ * @param i an sal_Int32
.
+ * @return a newly allocated string containing a string representation of
+ * the int
argument.
+ * @see java.lang.Integer#toString(int, int)
+ */
+#define RTL_USTR_MIN_RADIX 2
+#define RTL_USTR_MAX_RADIX 36
+#define RTL_USTR_MAX_VALUEOFINT32 33
+sal_Int32 SAL_CALL rtl_ustr_valueOfInt32(sal_Unicode * str, sal_Int32 i, sal_Int16 radix );
+
+/**
+ * Returns the string representation of the long
argument.
+ * Long.toString
method of one argument.
+ *
+ * @param str a newly allocated string with the length RTL_USTR_MAX_VALUEOFINT64
.
+ * @param l a sal_Int64
.
+ * @return a newly allocated string containing a string representation of
+ * the long
argument.
+ * @see java.lang.Long#toString(long)
+ */
+#define RTL_USTR_MAX_VALUEOFINT64 65
+sal_Int32 SAL_CALL rtl_ustr_valueOfInt64(sal_Unicode * str, sal_Int64 l, sal_Int16 radix );
+
+/**
+ * Returns the string representation of the float
argument.
+ * Float.toString
method of one argument.
+ *
+ * @param f a float
.
+ * @return a newly allocated string containing a string representation of
+ * the float
argument.
+ * @see java.lang.Float#toString(float)
+ */
+#define RTL_USTR_MAX_VALUEOFFLOAT 15
+sal_Int32 SAL_CALL rtl_ustr_valueOfFloat(sal_Unicode * str, float f);
+
+/**
+ * Returns the string representation of the double
argument.
+ * Double.toString
method of one argument.
+ *
+ * @param d a double
.
+ * @return a newly allocated string containing a string representation of
+ * the double
argument.
+ * @see java.lang.Double#toString(double)
+ */
+#define RTL_USTR_MAX_VALUEOFDOUBLE 25
+sal_Int32 SAL_CALL rtl_ustr_valueOfDouble(sal_Unicode * str, double d);
+
+/**
+ * Returns the int32 value represented str
argument.
+ * str
argument.
+ * str
argument.
+ * str
argument.
+ * string
containing no characters.
+ * Use the macro RTL_NEWDEFAULTSTRING() which optimize platform dependend
+ * the access to the default string.
+ */
+void SAL_CALL rtl_uString_new( rtl_uString ** newStr);
+#define RTL_USTRING_NEW(newStr) rtl_uString_new(newStr)
+
+/**
+ * Allocates a new string
containing nLen characters.
+ * The values of the characters are '\u0000' defined.
+ */
+void SAL_CALL rtl_uString_new_WithLength( rtl_uString ** newStr, sal_Int32 nLen );
+
+/**
+ * Allocates a new string that contains the same sequence of
+ * characters as the string argument.
+ *
+ * @param value a string
.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_uString_newFromString( rtl_uString ** newStr, rtl_uString * value);
+
+/**
+ * Allocates a new string
so that it represents the
+ * sequence of characters currently contained in the character array
+ * argument.
+ *
+ * @param value the initial value of the string.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_uString_newFromStr( rtl_uString ** newStr, const sal_Unicode * value );
+
+/**
+ * Allocates a new String
that contains characters from
+ * the character array argument.
+ *
+ * @param value array that is the source of characters.
+ * @param len the length of the array.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_uString_newFromStr_WithLength( rtl_uString ** newStr, const sal_Unicode * value, sal_Int32 Len);
+
+/**
+ * Allocates a new string
so that it represents the
+ * sequence of characters currently contained in the character array
+ * argument.
+ *
+ * @param value the initial value of the string.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_uString_newFromWStr( rtl_uString ** newStr, const wchar_t * value );
+
+/**
+ * Allocates a new String
that contains characters from
+ * the character array argument.
+ *
+ * @param value array that is the source of characters.
+ * @param len the length of the array.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_uString_newFromWStr_WithLength( rtl_uString ** newStr, const wchar_t * value, sal_Int32 Len);
+
+/**
+ * Allocates a new string
so that it represents the
+ * sequence of ASCII characters currently contained in the sal_Char
+ * array argument. Since this function is optimized for performance.
+ * the ASCII character values are not converted in any way. The
+ * caller has to make sure that all ASCII characters are in the
+ * allowed range between 0 and 127.
+ *
+ * @param value the initial value of the string in ASCII characters.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_uString_newFromAscii( rtl_uString ** newStr, const sal_Char * value );
+
+/**
+ * Assign rightValue to *str. Release *str and aquire rightValue!
+ */
+void SAL_CALL rtl_uString_assign( rtl_uString ** str, rtl_uString * rightValue );
+
+/**
+ * Returns the length of this string.
+ * The length is equal to the number of 16-bit
+ * Unicode characters in the string.
+ *
+ * @return the length of the sequence of characters represented by the
+ * string.
+ */
+sal_Int32 SAL_CALL rtl_uString_getLength( rtl_uString * str );
+
+/**
+ * Return the pointer to the sal_Unicode array of the string
.
+ *
+ * @return a null terminated sal_Unicode *.
+ */
+sal_Unicode * SAL_CALL rtl_uString_getStr( rtl_uString * str );
+
+/**
+ * Concatenates the right string to the end of the left string. Left and
+ * right must be NULL-terminated strings.
+ * oldChar
in this string with newChar
.
+ * oldChar
does not occur in the
+ * character sequence represented by the string, then the string is
+ * returned.
+ *
+ * @param oldChar the old character.
+ * @param newChar the new character.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_uString_newReplace( rtl_uString ** newStr,
+ rtl_uString * str,
+ sal_Unicode oldChar,
+ sal_Unicode newChar);
+
+/**
+ * Returns a new string resulting from replacing n = count characters
+ * from position index in this string with newStr
.
+ * String
to lower
+ * case using the rules of the given locale.
+ * @param locale use the case transformation rules for this locale
+ * @return the String, converted to lowercase.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_uString_newToLowerCase( rtl_uString ** newStr, rtl_uString * str, struct _rtl_Locale * locale );
+
+/**
+ * Converts all of the characters in this String
to upper
+ * case using the rules of the given locale.
+ * @param locale use the case transformation rules for this locale
+ * @return the String, converted to uppercase.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_uString_newToUpperCase( rtl_uString ** newStr, rtl_uString * str, struct _rtl_Locale * locale );
+
+/**
+ * Removes white space from both ends of the string.
+ * '\u0020'
(the space character) are considered to be
+ * white space.
+ *
+ * @return this string, with white space removed from the front and end.
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_uString_newTrim( rtl_uString ** newStr, rtl_uString * str );
+
+/**
+ * Returns the number of tokens in this String
seperated
+ * by cTok
.
+ *
+ * @param cTok the character which seperate the tokens
+ * @return the number of tokens.
+ */
+sal_Int32 SAL_CALL rtl_uString_getTokenCount( rtl_uString * str , sal_Unicode cTok);
+
+/**
+ * Returns a new string for the token specified by nToken. If nToken < 0 or
+ * nToken > tokenCount then an empty string is returned.
+ *
+ * @param nToken the number of the token to return.
+ * @param cTok the character which seperate the tokens
+ * @param newStr the new string for the token
+ * @return the new string. The reference count is 1.
+ */
+void SAL_CALL rtl_uString_getToken( rtl_uString ** newStr , rtl_uString * str, sal_Int32 nToken, sal_Unicode cTok);
+
+
+void SAL_CALL rtl_string2UString( rtl_uString** newStr, const sal_Char* pStr, sal_Int32 nLen,
+ rtl_TextEncoding encoding, sal_uInt32 nCvtFlags );
+
+void SAL_CALL rtl_uString2String( rtl_String** newStr, const sal_Unicode* pWStr, sal_Int32 nWLen,
+ rtl_TextEncoding encoding, sal_uInt32 nCvtFlags );
+
+/* constAsciiStr must be a "..." or char const aFoo[] = "..." */
+#define RTL_CONSTASCII_USTRINGPARAM( constAsciiStr ) constAsciiStr, sizeof( constAsciiStr )-1, RTL_TEXTENCODING_ASCII_US
+#ifndef RTL_CONSTASCII_STRINGPARAM
+#define RTL_CONSTASCII_STRINGPARAM( constAsciiStr ) constAsciiStr, sizeof( constAsciiStr )-1
+#endif
+#ifndef RTL_CONSTASCII_LENGTH
+#define RTL_CONSTASCII_LENGTH( constAsciiStr ) (sizeof( constAsciiStr )-1)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTL_USTRING_H_ */
+
+
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
new file mode 100644
index 000000000000..2f11e3499aa8
--- /dev/null
+++ b/sal/inc/rtl/ustring.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * $RCSfile: ustring.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_USTRING_HXX_
+#define _RTL_USTRING_HXX_
+
+#ifndef _RTL_USTRING_
+#include OUString
to lower
+ * case using the rules of the given locale.
+ * @param locale use the case transformation rules for this locale
+ * @return the OUString, converted to lowercase.
+ * @see java.lang.Character#toLowerCase(char)
+ * @see java.lang.OUString#toUpperCase()
+ * @since JDK1.1
+ */
+inline OUString OUString::toLowerCase( const OLocale & locale ) const
+{
+ OUString newStr;
+ rtl_uString_newToLowerCase( &newStr.pData, pData, *(rtl_Locale **)&locale );
+ return newStr;
+}
+
+
+/**
+ * Converts all of the characters in this OUString
to upper
+ * case using the rules of the given locale.
+ * @param locale use the case transformation rules for this locale
+ * @return the OUString, converted to uppercase.
+ * @see java.lang.Character#toUpperCase(char)
+ * @see java.lang.OUString#toLowerCase(char)
+ * @since JDK1.1
+ */
+inline OUString OUString::toUpperCase( const OLocale & locale) const
+{
+ OUString newStr;
+ rtl_uString_newToUpperCase( &newStr.pData, pData, *(rtl_Locale **)&locale );
+ return newStr;
+}
+
+// Helper functions
+inline OUString OStringToOUString( const OString & rStr,
+ rtl_TextEncoding encoding,
+ sal_uInt32 nCvtFlags=OSTRING_TO_OUSTRING_CVTFLAGS )
+{
+ OUString newStr;
+ if (rStr.getLength())
+ rtl_string2UString( &newStr.pData, rStr.getStr(), rStr.getLength(), encoding, nCvtFlags );
+ return newStr;
+}
+
+inline OString OUStringToOString( const OUString & rUnicode,
+ rtl_TextEncoding encoding,
+ sal_uInt32 nCvtFlags=OUSTRING_TO_OSTRING_CVTFLAGS )
+{
+ OString newStr;
+ if (rUnicode.getLength())
+ rtl_uString2String( &newStr.pData, rUnicode.getStr(), rUnicode.getLength(), encoding, nCvtFlags );
+ return newStr;
+}
+
+#ifdef _USE_NAMESPACE
+}
+#endif
+
+#endif /* _RTL_USTRING_HXX_ */
+
+
diff --git a/sal/inc/rtl/uuid.h b/sal/inc/rtl/uuid.h
new file mode 100644
index 000000000000..dfb9d3b70695
--- /dev/null
+++ b/sal/inc/rtl/uuid.h
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * $RCSfile: uuid.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _RTL_UUID_H_
+#define _RTL_UUID_H_
+
+
+#include
+ * if sal_False, the generator generates a new 6-Byte random
+ * value each time it is called with pPredecessorUUID = 0.
+ *
+ **/
+void SAL_CALL rtl_createUuid( sal_uInt8 *pTargetUUID ,
+ const sal_uInt8 *pPredecessorUUID,
+ sal_Bool bUseEthernetAddress );
+
+/****
+ * uuid_compare -- Compare two UUID's "lexically" and return
+ * -1 u1 is lexically before u2
+ * 0 u1 is equal to u2
+ * 1 u1 is lexically after u2
+ *
+ * Note: lexical ordering is not temporal ordering!
+ * Note: For equalnesschecking, a memcmp(pUUID1,pUUID2,16) is more efficient
+ ****/
+sal_Int32 SAL_CALL rtl_compareUuid( const sal_uInt8 *pUUID1 , const sal_uInt8 *pUUID2 );
+
+/****
+ * The version 3 UUID is meant for generating UUIDs from "names" that
+ * are drawn from, and unique within, some "name space". Some examples
+ * of names (and, implicitly, name spaces) might be DNS names, URLs, ISO
+ * Object IDs (OIDs), reserved words in a programming language, or X.500
+ * Distinguished Names (DNs); thus, the concept of name and name space
+ * should be broadly construed, and not limited to textual names.
+ *
+ * The requirements for such UUIDs are as follows:
+ *
+ * - The UUIDs generated at different times from the same name in the
+ * same namespace MUST be equal
+ *
+ * - The UUIDs generated from two different names in the same namespace
+ * should be different (with very high probability)
+ *
+ * - The UUIDs generated from the same name in two different namespaces
+ * should be different with (very high probability)
+ *
+ * - If two UUIDs that were generated from names are equal, then they
+ * were generated from the same name in the same namespace (with very
+ * high probability).
+ *
+ * @param pTargetUUID pointer to at least 16 bytes of memory. After the call
+ * it contains the newly generated uuid in network byte order.
+ * @param pNameSpaceUUID The namespace uuid. Below are some predefined ones,
+ * but any arbitray uuid can be used as namespace.
+ *
+ * @param pName the name
+ *
+ ****/
+void SAL_CALL rtl_createNamedUuid(
+ sal_uInt8 *pTargetUUID,
+ const sal_uInt8 *pNameSpaceUUID,
+ const rtl_String *pName
+ );
+
+
+
+/****
+ * Predefined Namespaces
+ * (Use them the following way : sal_uInt8 aNsDNS[16]) = RTL_UUID_NAMESPACE_DNS;
+ *
+ ****/
+/* 6ba7b810-9dad-11d1-80b4-00c04fd430c8 */
+#define RTL_UUID_NAMESPACE_DNS {\
+ 0x6b,0xa7,0xb8,0x10,\
+ 0x9d,0xad,\
+ 0x11,0xd1,\
+ 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8\
+ }
+
+/* 6ba7b811-9dad-11d1-80b4-00c04fd430c8 */
+#define RTL_UUID_NAMESPACE_URL { \
+ 0x6b, 0xa7, 0xb8, 0x11,\
+ 0x9d, 0xad,\
+ 0x11, 0xd1,\
+ 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8\
+ }
+
+/* 6ba7b812-9dad-11d1-80b4-00c04fd430c8 */
+#define RTL_UUID_NAMESPACE_OID {\
+ 0x6b, 0xa7, 0xb8, 0x12,\
+ 0x9d, 0xad,\
+ 0x11, 0xd1,\
+ 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8\
+ }
+
+/* 6ba7b814-9dad-11d1-80b4-00c04fd430c8 */
+#define RTL_UUID_NAMESPACE_X500 {\
+ 0x6b, 0xa7, 0xb8, 0x14,\
+ 0x9d, 0xad,\
+ 0x11, 0xd1,\
+ 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8\
+ }
+
+
+/**
+ * This macro must have a value below the system time resolution of the
+ * system. The uuid routines use this value as an upper limit for adding ticks to the
+ * the predecessor time value if system times are equal.
+ ***/
+#ifdef SAL_W32
+#define UUID_SYSTEM_TIME_RESOLUTION_100NS_TICKS 1000
+#elif LINUX
+#define UUID_SYSTEM_TIME_RESOLUTION_100NS_TICKS 10
+#elif SOLARIS
+#define UUID_SYSTEM_TIME_RESOLUTION_100NS_TICKS 10
+#elif MACOSX
+#define UUID_SYSTEM_TIME_RESOLUTION_100NS_TICKS 100000
+#elif MACOS
+#define UUID_SYSTEM_TIME_RESOLUTION_100NS_TICKS 100000
+#else
+#error "System time resolution must be calculated!"
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/sal/inc/sal/config.h b/sal/inc/sal/config.h
new file mode 100644
index 000000000000..77af6e31a0fc
--- /dev/null
+++ b/sal/inc/sal/config.h
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * $RCSfile: config.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SAL_CONFIG_H_
+#define _SAL_CONFIG_H_
+
+#include
+*/
+typedef struct _sal_Sequence
+{
+ /** reference count of sequence
+ */
+ sal_Int32 nRefCount;
+ /** element count
+ */
+ sal_Int32 nElements;
+ /** elements array
+ */
+ char elements[1];
+} sal_Sequence;
+
+#define SAL_SEQUENCE_HEADER_SIZE ((sal_Size)&((sal_Sequence *)0)->elements)
+
+#ifdef SAL_W32
+#pragma pack(pop)
+#elif defined(SAL_OS2)
+#pragma pack()
+#endif
+
+
+/** Wrap C++ const_cast, reinterpret_cast and static_cast expressions in
+ macros to keep code portable to old compilers (since most compilers still
+ lack RTTI support, dynamic_cast is not included here).
+ */
+#ifdef __cplusplus
+#if defined SAL_W32 || defined SOLARIS || defined LINUX
+#define SAL_CONST_CAST(type, expr) (const_cast< type >(expr))
+#define SAL_REINTERPRET_CAST(type, expr) (reinterpret_cast< type >(expr))
+#define SAL_STATIC_CAST(type, expr) (static_cast< type >(expr))
+#else /* SAL_W32, SOLARIS, LINUX */
+#define SAL_CONST_CAST(type, expr) ((type) (expr))
+#define SAL_REINTERPRET_CAST(type, expr) ((type) (expr))
+#define SAL_STATIC_CAST(type, expr) ((type) (expr))
+#endif /* SAL_W32, SOLARIS, LINUX */
+#endif /* __cplusplus */
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /*_SAL_TYPES_H_ */
+
diff --git a/sal/inc/systools/win32/StrConvert.h b/sal/inc/systools/win32/StrConvert.h
new file mode 100644
index 000000000000..1922928433bb
--- /dev/null
+++ b/sal/inc/systools/win32/StrConvert.h
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * $RCSfile: StrConvert.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _STRCONVERT_H_
+#define _STRCONVERT_H_
+
+#include