celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [2/3] celix git commit: CELIX-390: Refactors celix utils. Ensures that celix_utils is build before celix framework and does not have the celix framework as include path.
Date Tue, 20 Dec 2016 20:07:47 GMT
http://git-wip-us.apache.org/repos/asf/celix/blob/147e8bfe/utils/public/include/celixbool.h
----------------------------------------------------------------------
diff --git a/utils/public/include/celixbool.h b/utils/public/include/celixbool.h
new file mode 100644
index 0000000..526392b
--- /dev/null
+++ b/utils/public/include/celixbool.h
@@ -0,0 +1,61 @@
+/*
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * celixbool.h
+ *
+ *  \date       Jun 16, 2011
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+#ifndef CELIXBOOL_H_
+#define CELIXBOOL_H_
+
+
+#if defined(__STDC__)
+# define C89
+# if defined(__STDC_VERSION__)
+#  define C90
+#  if (__STDC_VERSION__ >= 199409L)
+#   define C94
+#  endif
+#  if (__STDC_VERSION__ >= 199901L)
+#   define C99
+#  endif
+# endif
+#endif
+
+
+#if __STDC_VERSION__ < 199901L && __GNUC__ < 3
+// #ifndef C99
+
+typedef int _Bool;
+
+#define bool _Bool
+#define false 0 
+#define true 1
+
+
+#else
+
+#include <stdbool.h>
+
+#endif
+
+#endif /* CELIXBOOL_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/147e8bfe/utils/public/include/properties.h
----------------------------------------------------------------------
diff --git a/utils/public/include/properties.h b/utils/public/include/properties.h
new file mode 100644
index 0000000..6eaf1fe
--- /dev/null
+++ b/utils/public/include/properties.h
@@ -0,0 +1,54 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * properties.h
+ *
+ *  \date       Apr 27, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+#ifndef PROPERTIES_H_
+#define PROPERTIES_H_
+
+#include <stdio.h>
+
+#include "hash_map.h"
+#include "exports.h"
+#include "celix_errno.h"
+
+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_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 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);)

+
+#endif /* PROPERTIES_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/147e8bfe/utils/public/include/utils.h
----------------------------------------------------------------------
diff --git a/utils/public/include/utils.h b/utils/public/include/utils.h
new file mode 100644
index 0000000..07eec92
--- /dev/null
+++ b/utils/public/include/utils.h
@@ -0,0 +1,49 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+/*
+ * utils.h
+ *
+ *  \date       Jul 27, 2010
+ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+ *  \copyright	Apache License, Version 2.0
+ */
+
+#ifndef UTILS_H_
+#define UTILS_H_
+
+#include <ctype.h>
+
+#include "celix_errno.h"
+#include "celixbool.h"
+#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);
+
+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);
+
+#endif /* UTILS_H_ */


Mime
View raw message