Helpers.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef IGNITION_RNDF_HELPERS_HH_
19 #define IGNITION_RNDF_HELPERS_HH_
20 
21 #include <cstdio>
22 #include <cstring>
23 #include <string>
24 
27 
30 
31 #if defined BUILDING_STATIC_LIBS
32  #define IGNITION_RNDF_VISIBLE
33  #define IGNITION_RNDF_HIDDEN
34 #else
35  #if defined __WIN32 || defined __CYGWIN__
36  #ifdef BUILDING_DLL
37  #ifdef __GNUC__
38  #define IGNITION_RNDF_VISIBLE __attribute__ ((dllexport))
39  #else
40  #define IGNITION_RNDF_VISIBLE __declspec(dllexport)
41  #endif
42  #else
43  #ifdef __GNUC__
44  #define IGNITION_RNDF_VISIBLE __attribute__ ((dllimport))
45  #else
46  #define IGNITION_RNDF_VISIBLE __declspec(dllimport)
47  #endif
48  #endif
49  #define IGNITION_RNDF_HIDDEN
50  #else
51  #if __GNUC__ >= 4
52  #define IGNITION_RNDF_VISIBLE __attribute__ ((visibility ("default")))
53  #define IGNITION_RNDF_HIDDEN __attribute__ ((visibility ("hidden")))
54  #else
55  #define IGNITION_RNDF_VISIBLE
56  #define IGNITION_RNDF_HIDDEN
57  #endif
58  #endif
59 // BUILDING_STATIC_LIBS
60 #endif
61 
62 namespace ignition
63 {
64  namespace rndf
65  {
71  bool env(const std::string &_name,
72  std::string &_value);
73  }
74 }
75 
76 // Use safer functions on Windows
77 #ifdef _MSC_VER
78  #define ign_strcat strcat_s
79  #define ign_strcpy strcpy_s
80  #define ign_sprintf sprintf_s
81  #define ign_strdup _strdup
82 #else
83  #define ign_strcat std::strcat
84  #define ign_strcpy std::strcpy
85  #define ign_sprintf std::sprintf
86  #define ign_strdup strdup
87 #endif
88 
89 // IGNITION_RNDF_HELPERS_HH_
90 #endif
#define IGNITION_RNDF_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:55
bool env(const std::string &_name, std::string &_value)
Find the environment variable &#39;_name&#39; and return its value.
Definition: Checkpoint.hh:25