celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [1/2] celix git commit: Adding extern "C" to headers in case __cplusplus is defined
Date Tue, 31 Jan 2017 20:07:59 GMT
Repository: celix
Updated Branches:
  refs/heads/develop d62731a3c -> ce0586bcb


http://git-wip-us.apache.org/repos/asf/celix/blob/ce0586bc/utils/public/include/linked_list.h
----------------------------------------------------------------------
diff --git a/utils/public/include/linked_list.h b/utils/public/include/linked_list.h
index 6321c5a..cbf650c 100644
--- a/utils/public/include/linked_list.h
+++ b/utils/public/include/linked_list.h
@@ -32,32 +32,60 @@
 #include "celix_errno.h"
 #include "exports.h"
 
-typedef struct linked_list_entry * linked_list_entry_pt;
-typedef struct linked_list * linked_list_pt;
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef struct linked_list_entry *linked_list_entry_pt;
+typedef struct linked_list *linked_list_pt;
 
 UTILS_EXPORT celix_status_t linkedList_create(linked_list_pt *list);
+
 UTILS_EXPORT celix_status_t linkedList_destroy(linked_list_pt list);
+
 UTILS_EXPORT celix_status_t linkedList_clone(linked_list_pt list, linked_list_pt *clone);
-UTILS_EXPORT void * linkedList_getFirst(linked_list_pt list);
-UTILS_EXPORT void * linkedList_getLast(linked_list_pt list);
-UTILS_EXPORT void * linkedList_removeFirst(linked_list_pt list);
-UTILS_EXPORT void * linkedList_removeLast(linked_list_pt list);
-UTILS_EXPORT void linkedList_addFirst(linked_list_pt list, void * element);
-UTILS_EXPORT void linkedList_addLast(linked_list_pt list, void * element);
-UTILS_EXPORT bool linkedList_contains(linked_list_pt list, void * element);
+
+UTILS_EXPORT void *linkedList_getFirst(linked_list_pt list);
+
+UTILS_EXPORT void *linkedList_getLast(linked_list_pt list);
+
+UTILS_EXPORT void *linkedList_removeFirst(linked_list_pt list);
+
+UTILS_EXPORT void *linkedList_removeLast(linked_list_pt list);
+
+UTILS_EXPORT void linkedList_addFirst(linked_list_pt list, void *element);
+
+UTILS_EXPORT void linkedList_addLast(linked_list_pt list, void *element);
+
+UTILS_EXPORT bool linkedList_contains(linked_list_pt list, void *element);
+
 UTILS_EXPORT int linkedList_size(linked_list_pt list);
+
 UTILS_EXPORT bool linkedList_isEmpty(linked_list_pt list);
-UTILS_EXPORT bool linkedList_addElement(linked_list_pt list, void * element);
-UTILS_EXPORT bool linkedList_removeElement(linked_list_pt list, void * element);
+
+UTILS_EXPORT bool linkedList_addElement(linked_list_pt list, void *element);
+
+UTILS_EXPORT bool linkedList_removeElement(linked_list_pt list, void *element);
+
 UTILS_EXPORT void linkedList_clear(linked_list_pt list);
-UTILS_EXPORT void * linkedList_get(linked_list_pt list, int index);
-UTILS_EXPORT void * linkedList_set(linked_list_pt list, int index, void * element);
-UTILS_EXPORT void linkedList_addIndex(linked_list_pt list, int index, void * element);
-UTILS_EXPORT void * linkedList_removeIndex(linked_list_pt list, int index);
+
+UTILS_EXPORT void *linkedList_get(linked_list_pt list, int index);
+
+UTILS_EXPORT void *linkedList_set(linked_list_pt list, int index, void *element);
+
+UTILS_EXPORT void linkedList_addIndex(linked_list_pt list, int index, void *element);
+
+UTILS_EXPORT void *linkedList_removeIndex(linked_list_pt list, int index);
+
 UTILS_EXPORT linked_list_entry_pt linkedList_entry(linked_list_pt list, int index);
-UTILS_EXPORT int linkedList_indexOf(linked_list_pt list, void * element);
-UTILS_EXPORT linked_list_entry_pt linkedList_addBefore(linked_list_pt list, void * element,
linked_list_entry_pt entry);
-UTILS_EXPORT void * linkedList_removeEntry(linked_list_pt list, linked_list_entry_pt entry);
 
+UTILS_EXPORT int linkedList_indexOf(linked_list_pt list, void *element);
+
+UTILS_EXPORT linked_list_entry_pt linkedList_addBefore(linked_list_pt list, void *element,
linked_list_entry_pt entry);
+
+UTILS_EXPORT void *linkedList_removeEntry(linked_list_pt list, linked_list_entry_pt entry);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* LINKED_LIST_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/ce0586bc/utils/public/include/linked_list_iterator.h
----------------------------------------------------------------------
diff --git a/utils/public/include/linked_list_iterator.h b/utils/public/include/linked_list_iterator.h
index 778da74..f765d5d 100644
--- a/utils/public/include/linked_list_iterator.h
+++ b/utils/public/include/linked_list_iterator.h
@@ -32,19 +32,35 @@
 #include "linked_list.h"
 #include "exports.h"
 
-typedef struct linkedListIterator * linked_list_iterator_pt;
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef struct linkedListIterator *linked_list_iterator_pt;
 
 UTILS_EXPORT linked_list_iterator_pt linkedListIterator_create(linked_list_pt list, unsigned
int index);
+
 UTILS_EXPORT void linkedListIterator_destroy(linked_list_iterator_pt iterator);
+
 UTILS_EXPORT bool linkedListIterator_hasNext(linked_list_iterator_pt iterator);
-UTILS_EXPORT void * linkedListIterator_next(linked_list_iterator_pt iterator);
+
+UTILS_EXPORT void *linkedListIterator_next(linked_list_iterator_pt iterator);
+
 UTILS_EXPORT bool linkedListIterator_hasPrevious(linked_list_iterator_pt iterator);
-UTILS_EXPORT void * linkedListIterator_previous(linked_list_iterator_pt iterator);
+
+UTILS_EXPORT void *linkedListIterator_previous(linked_list_iterator_pt iterator);
+
 UTILS_EXPORT int linkedListIterator_nextIndex(linked_list_iterator_pt iterator);
+
 UTILS_EXPORT int linkedListIterator_previousIndex(linked_list_iterator_pt iterator);
+
 UTILS_EXPORT void linkedListIterator_remove(linked_list_iterator_pt iterator);
-UTILS_EXPORT void linkedListIterator_set(linked_list_iterator_pt iterator, void * element);
-UTILS_EXPORT void linkedListIterator_add(linked_list_iterator_pt iterator, void * element);
 
+UTILS_EXPORT void linkedListIterator_set(linked_list_iterator_pt iterator, void *element);
+
+UTILS_EXPORT void linkedListIterator_add(linked_list_iterator_pt iterator, void *element);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* LINKED_LIST_ITERATOR_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/ce0586bc/utils/public/include/properties.h
----------------------------------------------------------------------
diff --git a/utils/public/include/properties.h b/utils/public/include/properties.h
index 6eaf1fe..b32197a 100644
--- a/utils/public/include/properties.h
+++ b/utils/public/include/properties.h
@@ -32,23 +32,34 @@
 #include "hash_map.h"
 #include "exports.h"
 #include "celix_errno.h"
-
+#ifdef __cplusplus
+extern "C" {
+#endif
 typedef hash_map_pt properties_pt;
 
 UTILS_EXPORT properties_pt properties_create(void);
+
 UTILS_EXPORT void properties_destroy(properties_pt properties);
-UTILS_EXPORT properties_pt properties_load(const char* filename);
+
+UTILS_EXPORT properties_pt properties_load(const char *filename);
+
 UTILS_EXPORT properties_pt properties_loadWithStream(FILE *stream);
-UTILS_EXPORT void properties_store(properties_pt properties, const char* file, const char*
header);
 
-UTILS_EXPORT const char* properties_get(properties_pt properties, const char* key);
-UTILS_EXPORT const char* properties_getWithDefault(properties_pt properties, const char*
key, const char* defaultValue);
-UTILS_EXPORT void properties_set(properties_pt properties, const char* key, const char* value);
+UTILS_EXPORT void properties_store(properties_pt properties, const char *file, const char
*header);
+
+UTILS_EXPORT const char *properties_get(properties_pt properties, const char *key);
+
+UTILS_EXPORT const char *properties_getWithDefault(properties_pt properties, const char *key,
const char *defaultValue);
+
+UTILS_EXPORT void properties_set(properties_pt properties, const char *key, const char *value);
 
 UTILS_EXPORT celix_status_t properties_copy(properties_pt properties, properties_pt *copy);
 
 #define PROPERTIES_FOR_EACH(props, key) \
-	for(hash_map_iterator_t iter = hashMapIterator_construct(props); \
-		hashMapIterator_hasNext(&iter), (key) = (const char*)hashMapIterator_nextKey(&iter);)

+    for(hash_map_iterator_t iter = hashMapIterator_construct(props); \
+        hashMapIterator_hasNext(&iter), (key) = (const char*)hashMapIterator_nextKey(&iter);)
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* PROPERTIES_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/ce0586bc/utils/public/include/thpool.h
----------------------------------------------------------------------
diff --git a/utils/public/include/thpool.h b/utils/public/include/thpool.h
index ab3063b..0180aa6 100644
--- a/utils/public/include/thpool.h
+++ b/utils/public/include/thpool.h
@@ -8,13 +8,15 @@
 #define _THPOOL_
 
 
-
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 
 /* =================================== API ======================================= */
 
 
-typedef struct thpool_* threadpool;
+typedef struct thpool_ *threadpool;
 
 
 /**
@@ -64,7 +66,7 @@ threadpool thpool_init(int num_threads);
  * @param  arg_p         pointer to an argument
  * @return nothing
  */
-int thpool_add_work(threadpool, void *(*function_p)(void*), void* arg_p);
+int thpool_add_work(threadpool, void *(*function_p)(void *), void *arg_p);
 
 
 /**
@@ -159,6 +161,8 @@ void thpool_resume(threadpool);
 void thpool_destroy(threadpool);
 
 
-
+#ifdef __cplusplus
+}
+#endif
 
 #endif

http://git-wip-us.apache.org/repos/asf/celix/blob/ce0586bc/utils/public/include/utils.h
----------------------------------------------------------------------
diff --git a/utils/public/include/utils.h b/utils/public/include/utils.h
index 07eec92..2fc7d44 100644
--- a/utils/public/include/utils.h
+++ b/utils/public/include/utils.h
@@ -34,16 +34,28 @@
 #include "exports.h"
 #include "celix_threads.h"
 
-UTILS_EXPORT unsigned int utils_stringHash(const void* string);
-UTILS_EXPORT int utils_stringEquals(const void* string, const void* toCompare);
-UTILS_EXPORT char * string_ndup(const char *s, size_t n);
-UTILS_EXPORT char * utils_stringTrim(char * string);
-UTILS_EXPORT bool utils_isStringEmptyOrNull(const char * const str);
+#ifdef __cplusplus
+extern "C" {
+#endif
 
-UTILS_EXPORT int utils_compareServiceIdsAndRanking(unsigned long servId, long servRank, unsigned
long otherServId, long otherServRank);
+UTILS_EXPORT unsigned int utils_stringHash(const void *string);
+
+UTILS_EXPORT int utils_stringEquals(const void *string, const void *toCompare);
+
+UTILS_EXPORT char *string_ndup(const char *s, size_t n);
+
+UTILS_EXPORT char *utils_stringTrim(char *string);
+
+UTILS_EXPORT bool utils_isStringEmptyOrNull(const char *const str);
+
+UTILS_EXPORT int
+utils_compareServiceIdsAndRanking(unsigned long servId, long servRank, unsigned long otherServId,
long otherServRank);
 
 UTILS_EXPORT celix_status_t thread_equalsSelf(celix_thread_t thread, bool *equals);
 
 UTILS_EXPORT celix_status_t utils_isNumeric(const char *number, bool *ret);
 
+#ifdef __cplusplus
+}
+#endif
 #endif /* UTILS_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/ce0586bc/utils/public/include/version.h
----------------------------------------------------------------------
diff --git a/utils/public/include/version.h b/utils/public/include/version.h
index 16f4809..88e146a 100644
--- a/utils/public/include/version.h
+++ b/utils/public/include/version.h
@@ -29,10 +29,15 @@
 
 #include "celix_errno.h"
 #include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * The definition of the version_pt abstract data type.
  */
-typedef struct version * version_pt;
+typedef struct version *version_pt;
 
 /**
  * Creates a new version_pt using the supplied arguments.
@@ -50,7 +55,7 @@ typedef struct version * version_pt;
  * 		- CELIX_ILLEGAL_ARGUMENT If the numerical components are negative
  * 		  or the qualifier string is invalid.
  */
-celix_status_t version_createVersion(int major, int minor, int micro, char * qualifier, version_pt
*version);
+celix_status_t version_createVersion(int major, int minor, int micro, char *qualifier, version_pt
*version);
 
 celix_status_t version_destroy(version_pt version);
 
@@ -93,7 +98,7 @@ celix_status_t version_clone(version_pt version, version_pt *clone);
  * 		- CELIX_ILLEGAL_ARGUMENT If the numerical components are negative,
  * 		  	the qualifier string is invalid or <code>versionStr</code> is improperly
formatted.
  */
-celix_status_t version_createVersionFromString(const char * versionStr, version_pt *version);
+celix_status_t version_createVersionFromString(const char *versionStr, version_pt *version);
 
 /**
  * The empty version "0.0.0".
@@ -108,8 +113,11 @@ celix_status_t version_createVersionFromString(const char * versionStr,
version_
 celix_status_t version_createEmptyVersion(version_pt *version);
 
 celix_status_t version_getMajor(version_pt version, int *major);
+
 celix_status_t version_getMinor(version_pt version, int *minor);
+
 celix_status_t version_getMicro(version_pt version, int *micro);
+
 celix_status_t version_getQualifier(version_pt version, const char **qualifier);
 
 /**
@@ -169,11 +177,10 @@ celix_status_t version_toString(version_pt version, char **string);
  * @return Status code indication failure or success:
  * 		- CELIX_SUCCESS when no errors are encountered.
  */
-celix_status_t version_isCompatible(version_pt user, version_pt provider, bool* isCompatible);
-
+celix_status_t version_isCompatible(version_pt user, version_pt provider, bool *isCompatible);
 
-/**
- * @}
- */
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* VERSION_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/ce0586bc/utils/public/include/version_range.h
----------------------------------------------------------------------
diff --git a/utils/public/include/version_range.h b/utils/public/include/version_range.h
index e0e80b0..b661cd3 100644
--- a/utils/public/include/version_range.h
+++ b/utils/public/include/version_range.h
@@ -37,10 +37,13 @@
 #include "celix_errno.h"
 #include "version.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 /**
  * Type definition for the version_range_pt abstract data type.
  */
-typedef struct versionRange * version_range_pt;
+typedef struct versionRange *version_range_pt;
 
 /**
  * Creates a new <code>version_range_pt</code>.
@@ -54,7 +57,9 @@ typedef struct versionRange * version_range_pt;
  * 		- CELIX_SUCCESS when no errors are encountered.
  * 		- CELIX_ENOMEM If allocating memory for <code>versionRange</code> failed.
  */
-celix_status_t versionRange_createVersionRange(version_pt low, bool isLowInclusive, version_pt
high, bool isHighInclusive, version_range_pt *versionRange);
+celix_status_t
+versionRange_createVersionRange(version_pt low, bool isLowInclusive, version_pt high, bool
isHighInclusive,
+                                version_range_pt *versionRange);
 
 /**
  * Creates an infinite version range using ::version_createEmptyVersion for the low version,
@@ -146,10 +151,10 @@ celix_status_t versionRange_getHighVersion(version_range_pt versionRange,
versio
  * 		- CELIX_ILLEGAL_ARGUMENT If the numerical components are negative,
  * 		  	the qualifier string is invalid or <code>versionStr</code> is impropertly
formatted.
  */
-celix_status_t versionRange_parse(const char* rangeStr, version_range_pt *range);
+celix_status_t versionRange_parse(const char *rangeStr, version_range_pt *range);
 
-/**
- * @}
- */
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* VERSION_RANGE_H_ */


Mime
View raw message