5fc4773ed681d1f0b29a3df56f483141f9def695
[public/netxms.git] / src / libnetxms / inline.cpp
1 /*
2 ** libnetxms - Common NetXMS utility library
3 ** Copyright (C) 2003, 2004 Victor Kirhenshtein
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 **
19 ** $module: inline.cpp
20 **
21 **/
22
23 #define LIBNETXMS_INLINE
24 #include "libnetxms.h"
25
26
27 //
28 // Functions defined as inline for C++ programs
29 //
30
31 extern "C" void LIBNETXMS_EXPORTABLE ret_string(char *rbuf, char *value)
32 {
33 strncpy(rbuf, value, MAX_RESULT_LENGTH);
34 }
35
36 extern "C" void LIBNETXMS_EXPORTABLE ret_int(char *rbuf, long value)
37 {
38 sprintf(rbuf, "%ld", value);
39 }
40
41 extern "C" void LIBNETXMS_EXPORTABLE ret_uint(char *rbuf, unsigned long value)
42 {
43 sprintf(rbuf, "%lu", value);
44 }
45
46 extern "C" void LIBNETXMS_EXPORTABLE ret_double(char *rbuf, double value)
47 {
48 sprintf(rbuf, "%f", value);
49 }
50
51 extern "C" void LIBNETXMS_EXPORTABLE ret_int64(char *rbuf, INT64 value)
52 {
53 #ifdef _WIN32
54 sprintf(rbuf, "%I64d", value);
55 #else /* _WIN32 */
56 sprintf(rbuf, "%lld", value);
57 #endif /* _WIN32 */
58 }
59
60 extern "C" void LIBNETXMS_EXPORTABLE ret_uint64(char *rbuf, QWORD value)
61 {
62 #ifdef _WIN32
63 sprintf(rbuf, "%I64u", value);
64 #else /* _WIN32 */
65 sprintf(rbuf, "%llu", value);
66 #endif /* _WIN32 */
67 }