LibreOffice
LibreOffice 4.3 SDK C/C++ API Reference
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions
types.h File Reference
#include <sal/config.h>
#include <sal/macros.h>
#include <sal/typesizes.h>

Go to the source code of this file.

Classes

struct  _sal_Sequence
 This is the binary specification of a SAL sequence. More...
 

Namespaces

 com
 
 com::sun
 
 com::sun::star
 
 sal
 

Macros

#define sal_False   ((sal_Bool)0)
 
#define sal_True   ((sal_Bool)1)
 
#define SAL_UNICODE_NOTEQUAL_WCHAR_T
 
#define SAL_PRI_SIZET   "z"
 
#define SAL_PRI_PTRDIFFT   "t"
 
#define SAL_MIN_INT8   ((sal_Int8) (-0x7F - 1))
 
#define SAL_MAX_INT8   ((sal_Int8) 0x7F)
 
#define SAL_MAX_UINT8   ((sal_uInt8) 0xFF)
 
#define SAL_MIN_INT16   ((sal_Int16) (-0x7FFF - 1))
 
#define SAL_MAX_INT16   ((sal_Int16) 0x7FFF)
 
#define SAL_MAX_UINT16   ((sal_uInt16) 0xFFFF)
 
#define SAL_MIN_INT32   ((sal_Int32) (-0x7FFFFFFF - 1))
 
#define SAL_MAX_INT32   ((sal_Int32) 0x7FFFFFFF)
 
#define SAL_MAX_UINT32   ((sal_uInt32) 0xFFFFFFFF)
 
#define SAL_MIN_INT64   ((sal_Int64) (SAL_CONST_INT64(-0x7FFFFFFFFFFFFFFF) - 1))
 
#define SAL_MAX_INT64   ((sal_Int64) SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF))
 
#define SAL_MAX_UINT64   ((sal_uInt64) SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF))
 
#define SAL_EXCEPTION_DLLPUBLIC_EXPORT
 Exporting the symbols necessary for exception handling on GCC. More...
 
#define SAL_EXCEPTION_DLLPRIVATE
 
#define SAL_WARN_UNUSED_RESULT
 Use this as markup for functions and methods whose return value must be checked. More...
 
#define SAL_NO_VTABLE
 Use this for pure virtual classes, e.g. More...
 
#define SAL_SEQUENCE_HEADER_SIZE   ((sal_Size)&((sal_Sequence *)0)->elements)
 
#define SAL_THROW(x)
 Exception specification documentation. More...
 
#define SAL_THROW_EXTERN_C()   throw ()
 Nothrow specification for C functions. More...
 
#define SAL_DELETED_FUNCTION
 short-circuit extra-verbose API namespaces More...
 
#define SAL_OVERRIDE
 C++11 "override" feature. More...
 
#define SAL_FINAL
 C++11 "final" feature. More...
 
#define SAL_DEPRECATED(message)
 Use as follows: SAL_DEPRECATED("Dont use, its evil.") void doit(int nPara);. More...
 
#define SAL_DEPRECATED_INTERNAL(message)   SAL_DEPRECATED(message)
 This macro is used to tag interfaces that are deprecated for both internal and external API users, but where we are still writing out the internal usage. More...
 
#define SAL_WNODEPRECATED_DECLARATIONS_PUSH
 Use as follows: SAL_WNODEPRECATED_DECLARATIONS_PUSH ::std::auto_ptr<X> ... More...
 
#define SAL_WNODEPRECATED_DECLARATIONS_POP
 
#define SAL_WNOUNREACHABLE_CODE_PUSH
 Use as follows: More...
 
#define SAL_WNOUNREACHABLE_CODE_POP
 
#define SAL_UNUSED_PARAMETER
 Annotate unused but required C++ function parameters. More...
 
#define SAL_WARN_UNUSED
 Annotate classes where a compiler should warn if an instance is unused. More...
 

Typedefs

typedef unsigned char sal_Bool
 
typedef signed char sal_Int8
 
typedef unsigned char sal_uInt8
 
typedef char sal_Char
 A legacy synonym for char. More...
 
typedef signed char sal_sChar
 A legacy synonym for signed char. More...
 
typedef unsigned char sal_uChar
 A legacy synonym for unsigned char. More...
 
typedef sal_uInt16 sal_Unicode
 
typedef void * sal_Handle
 
typedef struct _sal_Sequence sal_Sequence
 This is the binary specification of a SAL sequence. More...
 

Enumerations

enum  __sal_NoAcquire { SAL_NO_ACQUIRE }
 

Functions

template<typename T1 , typename T2 >
T1 sal::static_int_cast (T2 n)
 A static_cast between integral types, to avoid C++ compiler warnings. More...
 

Macro Definition Documentation

#define SAL_DELETED_FUNCTION

short-circuit extra-verbose API namespaces

Since
LibreOffice 4.0C++11 "= delete" feature.

With HAVE_CXX11_DELETE, calling a deleted function will cause a compile-time error, while otherwise it will only cause a link-time error as the declared function is not defined.

Since
LibreOffice 4.1
#define SAL_DEPRECATED (   message)

Use as follows: SAL_DEPRECATED("Dont use, its evil.") void doit(int nPara);.

#define SAL_DEPRECATED_INTERNAL (   message)    SAL_DEPRECATED(message)

This macro is used to tag interfaces that are deprecated for both internal and external API users, but where we are still writing out the internal usage.

Ultimately these should be replaced by SAL_DEPRECATED, and then removed.

Use as follows: SAL_DEPRECATED_INTERNAL("Dont use, its evil.") void doit(int nPara);

#define SAL_EXCEPTION_DLLPRIVATE
#define SAL_EXCEPTION_DLLPUBLIC_EXPORT

Exporting the symbols necessary for exception handling on GCC.

These macros are used for inline declarations of exception classes, as in rtl/malformeduriexception.hxx.

#define sal_False   ((sal_Bool)0)
#define SAL_FINAL

C++11 "final" feature.

With HAVE_CXX11_FINAL, mark a class as non-derivable or a method as non-overridable.

Since
LibreOffice 4.1
#define SAL_MAX_INT16   ((sal_Int16) 0x7FFF)
#define SAL_MAX_INT32   ((sal_Int32) 0x7FFFFFFF)
#define SAL_MAX_INT64   ((sal_Int64) SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF))
#define SAL_MAX_INT8   ((sal_Int8) 0x7F)
#define SAL_MAX_UINT16   ((sal_uInt16) 0xFFFF)
#define SAL_MAX_UINT32   ((sal_uInt32) 0xFFFFFFFF)
#define SAL_MAX_UINT64   ((sal_uInt64) SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF))
#define SAL_MAX_UINT8   ((sal_uInt8) 0xFF)
#define SAL_MIN_INT16   ((sal_Int16) (-0x7FFF - 1))
#define SAL_MIN_INT32   ((sal_Int32) (-0x7FFFFFFF - 1))
#define SAL_MIN_INT64   ((sal_Int64) (SAL_CONST_INT64(-0x7FFFFFFFFFFFFFFF) - 1))
#define SAL_MIN_INT8   ((sal_Int8) (-0x7F - 1))
#define SAL_NO_VTABLE

Use this for pure virtual classes, e.g.

class SAL_NO_VTABLE Foo { ... This hinders the compiler from setting a generic vtable stating that a pure virtual function was called and thus slightly reduces code size.

#define SAL_OVERRIDE

C++11 "override" feature.

With HAVE_CXX11_OVERRIDE, force the method to override a existing method in parent, error out if the method with the correct signature does not exist.

Since
LibreOffice 4.1
#define SAL_PRI_PTRDIFFT   "t"
#define SAL_PRI_SIZET   "z"
#define SAL_SEQUENCE_HEADER_SIZE   ((sal_Size)&((sal_Sequence *)0)->elements)
#define SAL_THROW (   x)

Exception specification documentation.

The original intent of this macro was to control whether or not actual exception specifications are emitted, based on how much they impact code size etc. in a specific scenario. But it ended up always being disabled (except for MSVC, which effectively ignored it even though being enabled), and used in ways that would make enabling it illegal (e.g., in the cppu::ComponentFactoryFunc typedef, or with necessarily incomplete com::sun::star::uno::RuntimeException in com/sun/star/uno/Reference.h), so has officially been demoted to pure documentation now.

Deprecated:
do not use in new code.
#define SAL_THROW_EXTERN_C ( )    throw ()

Nothrow specification for C functions.

This is a macro so it can expand to nothing in C code.

#define sal_True   ((sal_Bool)1)
#define SAL_UNICODE_NOTEQUAL_WCHAR_T
#define SAL_UNUSED_PARAMETER

Annotate unused but required C++ function parameters.

An unused parameter is required if the function needs to adhere to a given type (e.g., if its address is assigned to a function pointer of a specific type, or if it is called from template code). This annotation helps static analysis tools suppress false warnings. In the case of virtual functions (where unused required parameters are common, too), the annotation is not required (as static analysis tools can themselves derive the information whether a function is virtual).

Use the annotation in function definitions like

void f(SAL_UNUSED_PARAMETER int) {}

C does not allow unnamed parameters, anyway, so a function definition like the above needs to be written there as

void f(int dummy) { (void) dummy; / * avoid warnings * / }

without a SAL_UNUSED_PARAMETER annotation.

Since
LibreOffice 3.6
#define SAL_WARN_UNUSED

Annotate classes where a compiler should warn if an instance is unused.

The compiler cannot warn about unused instances if they have non-trivial or external constructors or destructors. Classes marked with SAL_WARN_UNUSED will be warned about.

Since
LibreOffice 4.0
#define SAL_WARN_UNUSED_RESULT

Use this as markup for functions and methods whose return value must be checked.

Compilers that support a construct of this nature will emit a compile time warning on unchecked return value.

#define SAL_WNODEPRECATED_DECLARATIONS_POP
#define SAL_WNODEPRECATED_DECLARATIONS_PUSH

Use as follows: SAL_WNODEPRECATED_DECLARATIONS_PUSH ::std::auto_ptr<X> ...

SAL_WNODEPRECATED_DECLARATIONS_POP

#define SAL_WNOUNREACHABLE_CODE_POP
#define SAL_WNOUNREACHABLE_CODE_PUSH

Use as follows:

SAL_WNOUNREACHABLE_CODE_PUSH

function definition

SAL_WNOUNREACHABLE_CODE_POP

Useful in cases where the compiler is "too clever" like when doing link-time code generation, and noticing that a called function always throws, and fixing the problem cleanly so that it produceds no warnings in normal non-LTO compilations either is not easy.

Typedef Documentation

typedef unsigned char sal_Bool
typedef char sal_Char

A legacy synonym for char.

Deprecated:
use plain char instead.
typedef void* sal_Handle
typedef signed char sal_Int8
typedef signed char sal_sChar

A legacy synonym for signed char.

Deprecated:
use plain signed char instead.
typedef struct _sal_Sequence sal_Sequence

This is the binary specification of a SAL sequence.


typedef unsigned char sal_uChar

A legacy synonym for unsigned char.

Deprecated:
use plain unsigned char instead.
typedef unsigned char sal_uInt8
typedef sal_uInt16 sal_Unicode

Enumeration Type Documentation

Enumerator
SAL_NO_ACQUIRE 

definition of a no acquire enum for ctors