bump product version to 4.1.6.2
[LibreOffice.git] / include / cosv / csv_env.hxx
blobf49ed54ea4649f4b6c4692787f70897f96b6a916
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef CSV_CSV_ENV_HXX
21 #define CSV_CSV_ENV_HXX
25 //******* Include c-language-types ************//
26 // size_t, wchar_t
27 #include <stdlib.h>
31 //******* Builtin types of exact length ************//
33 // Exact length builtin types
34 typedef signed char INT8;
35 typedef unsigned char UINT8;
36 typedef short INT16;
37 typedef unsigned short UINT16;
38 typedef long INT32;
39 typedef unsigned long UINT32;
40 typedef float REAL32;
41 typedef double REAL64;
44 // Additional builtin types
45 typedef INT32 intt; // standard sized integer.
46 typedef UINT32 uintt; // standard sized unsigned integer.
47 typedef REAL64 real; // standard sized real.
49 // Constants
50 // ---------
51 // Zero-pointer for use in ellipsed (...) parameter lists which expect a
52 // pointer which may have another size than an int.
53 // Must be a define to be used in precompiled headers:
54 #define NIL ((void*)0)
55 // char '\0'
56 #define NULCH '\0'
60 // Boolesche Operatoren
61 #define AND &&
62 #define OR ||
63 #define NOT !
65 // Macro for distinguishing dynamic allocated pointers from
66 // referencing pointers
67 #define DYN // Exact specification: DYN has to be used if and only if:
68 // 1. DYN specifies a class member pointer or reference variable and
69 // the class must free the referenced memory.
70 // 2. DYN specifies a pointer or reference (return-) parameter of a function
71 // and for in-parameters the function or its class
72 // must free the referenced memory, the parameter is then called
73 // a let-parameter.
74 // For out- and inout-parameters
75 // or return values the caller of the function hast to
76 // free the referenced memory.
78 // It is irrelevant who allocated the memory!
80 // DYN - variables use the prefixes "dp" or "dr" instead of "p" or "r".
83 //****** Assertions ******//
85 namespace csv
87 void PerformAssertion(
88 const char * condition,
89 const char * file,
90 unsigned line );
93 // Programming by contract
94 #ifndef CSV_NO_ASSERTIONS
96 #ifdef CSV_USE_CSV_ASSERTIONS
97 #define csv_assert(x) ( (x) ? (void)(0) : ::csv::PerformAssertion( #x, __FILE__, __LINE__) )
98 #else
100 // Save NDEBUG state
101 #ifdef NDEBUG
102 #define CSV_CSV_ENV_HXX_HAD_NDEBUG
103 #undef NDEBUG
104 #endif
106 #if OSL_DEBUG_LEVEL == 0
107 #define NDEBUG
108 #endif
109 #include <assert.h>
111 #define csv_assert(x) assert(x);
113 // Restore NDEBUG state
114 #ifdef CSV_CSV_ENV_HXX_HAD_NDEBUG
115 #define NDEBUG
116 #else
117 #undef NDEBUG
118 #endif
120 #endif
122 #else // #ifndef CSV_NO_ASSERTIONS else
124 #define csv_assert(x)
126 #endif // end ifndef CSV_NO_ASSERTIONS else
130 /* Additional Programming Conventions
132 1. see above at "#define DYN"
133 2. function parameters get one of these prefixes:
134 - i_ := Function uses only the value, but must not change a referenced variable.
135 - o_ := Parameter is undefined until function has set it.
136 Parametere must be set by the function.
137 - io_ := Function may use and change the referenced variable.
138 - pass_ := Funktion may use and change the referenced variable and HAS TO free the
139 associated memory.
140 3. Global constants get the prefix 'C_', global variables the prefix 'G_'.
141 4. Static members end with an underscore '_'.
146 #endif
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */