Skip to content

Commit

Permalink
0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Nov 12, 2020
1 parent af48cfa commit eb7f96e
Show file tree
Hide file tree
Showing 30 changed files with 2,001 additions and 1,701 deletions.
45 changes: 45 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''

---

:rotating_light: First, please check:
- existing issues,
- Docs https://cpp.objectbox.io/

**Describe the bug**
A clear and concise description in English of what the bug is.

**Basic info (please complete the following information):**
- ObjectBox version: [e.g. 0.10.0, latest version?]
- C or C++ version: [e.g. C++11]
- Reproducibility: [e.g. occurred once only | occasionally without visible pattern | always]
- OS: [e.g. Ubuntu 20.04]

**To Reproduce**
Steps to reproduce the behavior:
1. Put '...'
2. Make changes to '....'
3. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Code**
If applicable, add code to help explain your problem.
- Include affected entity code.
- Please remove any unnecessary or confidential parts.
- At best, link to or attach a project with a failing test.

**Logs, stack traces**
If applicable, add relevant logs, or a stack trace.

**Additional context**
Add any other context about the problem here.
- Is there anything special about your code?
- May transactions or multi-threading play a role?
- Did you find any workarounds to prevent the issue?
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Question
url: https://stackoverflow.com/questions/tagged/objectbox
about: Ask how to do something, or why it isn't working on Stack Overflow.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Feature request
about: Suggest an idea
title: ''
labels: 'enhancement'
assignees: ''

---

:rotating_light: First, please check:
- existing issues,
- Docs https://cpp.objectbox.io/

Start with a clear and concise description of what problem you are trying to solve.
Often there is already a solution!

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context (e.g. platform or language) about the feature request here.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
ObjectBox C and C++ API Changelog
=================================

0.11.0 (2020-11-12)
------------------
* update CMakeLists.txt to simplify integration for users, e.g. with `FetchContent`,
see the updated [installation docs](https://cpp.objectbox.io/installation#objectbox-library)
* rename `objectbox-cpp.h` to `objectbox.hpp`
* change cursor and box read functions `get/first/current/next` `void**` argument to `const void**`
* change multiple Query and QueryBuilder functions `int count` argument to `size_t count`
* change observer signatures (`obx_err` return value and `size_t count` argument)
* change C++ Store Options to a "builder" pattern and expose all available options
* new obx_model_entity_flags()
* new obx_opt_async_*() to configure Async box behavior
* new C++ AsyncBox and Box::async() to expose asynchronous operations
* new QueryBuilder greater-or-equal/less-or-equal functions for integers and floats
* new obx_query_offset_limit() setter for offset and limit in a single call
* new obx_sync_available() to check whether the loaded runtime library supports [ObjectBox Sync](https://objectbox.io/sync)
* clean up linter warnings in the examples and `objectbox.h(pp)`

0.10.0 (2020-08-13)
------------------
C++ API queries and model classes for more feature-rich generated code.
Expand Down
76 changes: 71 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,78 @@
cmake_minimum_required(VERSION 3.0)

project(ObjectBoxCRoot)
project(ObjectBoxCRoot) # to be displayed in an IDE when this CMake is opened

IF(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib")
message( FATAL_ERROR "Directory lib does not exist; please run ./download.sh first" )
ENDIF()
if (${CMAKE_VERSION} VERSION_LESS "3.11.0")
message("Please consider upgrading your CMake to a more recent version (v3.11+) to get automatic library download.")
if (NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib")
message(FATAL_ERROR "Directory lib does not exist; please run ./download.sh first")
endif ()
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/lib")
else ()
project(objectbox-download)

link_directories("${CMAKE_CURRENT_SOURCE_DIR}/lib")
# Configuration updated for each release
set(DL_VERSION 0.11.0)
set(DL_CHANNEL testing)

# Platform detection and other setup
set(DL_URL https://dl.bintray.com/objectbox/conan/objectbox/objectbox-c)

# ${CMAKE_SYSTEM_PROCESSOR} is invalid on Windows, see https://gitlab.kitware.com/cmake/cmake/-/issues/15170
if (${CMAKE_SYSTEM_NAME} STREQUAL Windows)
if (CMAKE_SIZEOF_VOID_P MATCHES 8)
set(DL_PLATFORM ${CMAKE_SYSTEM_NAME}-x86_64)
else ()
set(DL_PLATFORM ${CMAKE_SYSTEM_NAME}-x86)
endif ()
else ()
set(DL_PLATFORM ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
endif ()

if (${DL_PLATFORM} STREQUAL Linux-x86_64)
set(DL_PACKAGE 4db1be536558d833e52e862fd84d64d75c2b3656)

elseif (${DL_PLATFORM} MATCHES "^Linux-armv7")
set(DL_PACKAGE d42930899c74345edc43f8b7519ec7645c13e4d8)
set(DL_PLATFORM "Linux-armv7hf") # show what we actually download

elseif (${DL_PLATFORM} MATCHES "^Linux-armv6")
set(DL_PACKAGE 4a625f0bd5f477eacd9bd35e9c44c834d057524b)
set(DL_PLATFORM "Linux-armv6hf") # show what we actually download

elseif (${DL_PLATFORM} STREQUAL Darwin-x86_64)
set(DL_PACKAGE 46f53f156846659bf39ad6675fa0ee8156e859fe)

elseif (${DL_PLATFORM} STREQUAL Windows-x86_64)
set(DL_PACKAGE ca33edce272a279b24f87dc0d4cf5bbdcffbc187)

elseif (${DL_PLATFORM} STREQUAL Windows-x86)
set(DL_PACKAGE 11e6a84a7894f41df553e7c92534c3bf26896802)

else ()
message(FATAL_ERROR "Can't download pre-compiled ObjectBox library - platform not supported: ${DL_PLATFORM}")
endif ()

include(FetchContent)
FetchContent_Declare(
${PROJECT_NAME}
URL ${DL_URL}/${DL_VERSION}/${DL_CHANNEL}/0/package/${DL_PACKAGE}/0/conan_package.tgz
)

message(STATUS "Using pre-compiled ObjectBox library version ${DL_CHANNEL}:${DL_VERSION} for ${DL_PLATFORM}")
FetchContent_Populate(${PROJECT_NAME})
message(STATUS "Pre-compiled ObjectBox library is saved in ${objectbox-download_SOURCE_DIR}")

project(objectbox)
add_library(${PROJECT_NAME} SHARED IMPORTED GLOBAL)
set(objectbox_include_dirs ${objectbox-download_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/external/)
set_target_properties(
${PROJECT_NAME} PROPERTIES
IMPORTED_LOCATION ${objectbox-download_SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}objectbox${CMAKE_SHARED_LIBRARY_SUFFIX}
IMPORTED_IMPLIB ${objectbox-download_SOURCE_DIR}/lib/${CMAKE_IMPORT_LIBRARY_PREFIX}objectbox${CMAKE_IMPORT_LIBRARY_SUFFIX}
INTERFACE_INCLUDE_DIRECTORIES "${objectbox_include_dirs}"
)
endif ()

add_subdirectory(src-test)
add_subdirectory(src-test-gen)
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ ObjectBox C and C++ APIs
[ObjectBox](https://objectbox.io) is a superfast database for objects.
This is the **ObjectBox runtime library** to run ObjectBox as an embedded database in your C or C++ application.

**Latest version: 0.10.0** (2020-08-13). See [changelog](CHANGELOG.md) for more details.
**Latest version: 0.11.0** (2020-11-12).
See [changelog](CHANGELOG.md) for more details.

In most cases you want to use the C and C++ APIs in combination with the **[ObjectBox Generator](https://github.com/objectbox/objectbox-generator) tool**.
This way, you get a convenient C or C++ API which requires minimal code on your side to work with the database.
Expand Down Expand Up @@ -36,7 +37,7 @@ Usage and Installation
The APIs come as single header file for C and C++:
* C: [include/objectbox.h](include/objectbox.h)
* C++: [include/objectbox-cpp.h](include/objectbox-cpp.h) (depends on objectbox.h)
* C++: [include/objectbox.hpp](include/objectbox.hpp) (depends on objectbox.h)
Compile your code against it and use the binary library (.so, .dylib, .dll depending on the platform) to link against.
Head over to [ObjectBox C and C++ installation docs](https://cpp.objectbox.io/installation) for step-by-step instructions.
Expand All @@ -60,8 +61,8 @@ Have a look at the following TaskList example apps, depending on your programmin
Documentation
-------------
* [C and C++ docs](https://cpp.objectbox.io/) - official ObjectBox C and C++ documentation
* [include/objectbox.h](include/objectbox.h) - C-API header file contains docs in as code comments
* [include/objectbox-cpp.h](include/objectbox-cpp.h) - C-API header file contains docs in as code comments
* [include/objectbox.h](include/objectbox.h) - C API header file contains docs as code comments
* [include/objectbox.hpp](include/objectbox.hpp) - C++ API header file contains docs as code comments
* [C and C++ API reference docs](https://objectbox.io/docfiles/c/current/) - online HTML docs (Doxygen)
Current state / Changelog
Expand Down
2 changes: 1 addition & 1 deletion download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tty -s || quiet=true

# Note: optional arguments like "--quiet" shifts argument positions in the case block above

version=${1:-0.10.0}
version=${1:-0.11.0}
repoType=${2:-testing}
os=${3:-$(uname)}
arch=${4:-$(uname -m)}
Expand Down
17 changes: 17 additions & 0 deletions doxygen/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
ObjectBox C and C++ API Changelog
=================================

0.11.0 (2020-11-12)
------------------
* update CMakeLists.txt to simplify integration for users, e.g. with `FetchContent`,
see the updated [installation docs](https://cpp.objectbox.io/installation#objectbox-library)
* rename `objectbox-cpp.h` to `objectbox.hpp`
* change cursor and box read functions `get/first/current/next` `void**` argument to `const void**`
* change multiple Query and QueryBuilder functions `int count` argument to `size_t count`
* change observer signatures (`obx_err` return value and `size_t count` argument)
* change C++ Store Options to a "builder" pattern and expose all available options
* new obx_model_entity_flags()
* new obx_opt_async_*() to configure Async box behavior
* new C++ AsyncBox and Box::async() to expose asynchronous operations
* new QueryBuilder greater-or-equal/less-or-equal functions for integers and floats
* new obx_query_offset_limit() setter for offset and limit in a single call
* new obx_sync_available() to check whether the loaded runtime library supports [ObjectBox Sync](https://objectbox.io/sync)
* clean up linter warnings in the examples and `objectbox.h(pp)`

0.10.0 (2020-08-13)
------------------
C++ API queries and model classes for more feature-rich generated code.
Expand Down
2 changes: 1 addition & 1 deletion doxygen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "ObjectBox C and C++ API"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "0.10.0"
PROJECT_NUMBER = "0.11.0"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion doxygen/main-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ See [Installation docs](https://cpp.objectbox.io/installation) and check the [pr
Headers
-------------
* ObjectBox C99 support is provided by a single header file: **objectbox.h**
* ObjectBox C++11 support is available in an additional header: **objectbox-cpp.h**
* ObjectBox C++11 support is available in an additional header: **objectbox.hpp**

Basic concepts
--------------
Expand Down
31 changes: 14 additions & 17 deletions examples/c-cursor-no-gen/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
* limitations under the License.
*/

#include "objectbox.h"

// Flatbuffers builder
#include "task_builder.h"

#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
Expand All @@ -27,6 +22,9 @@
#include <string.h>
#include <time.h>

#include "objectbox.h"
#include "task_builder.h"

#if !defined(_MSC_VER)
#include <libgen.h>
#endif
Expand Down Expand Up @@ -149,12 +147,11 @@ void do_action_help(char* program_path) {
program_path = basename(program_path);
#endif
printf("usage: %s\n", program_path);
const char* format = " %-30s %s\n";
printf(format, "text of a new task", "create a new task with the given text");
printf(format, "", "(default) lists active tasks");
printf(format, "--list", "lists active and done tasks");
printf(format, "--done ID", "marks the task with the given ID as done");
printf(format, "--help", "displays this help");
printf(" %-30s %s\n", "text of a new task", "create a new task with the given text");
printf(" %-30s %s\n", "", "(default) lists active tasks");
printf(" %-30s %s\n", "--list", "lists active and done tasks");
printf(" %-30s %s\n", "--done ID", "marks the task with the given ID as done");
printf(" %-30s %s\n", "--help", "displays this help");
}

//--------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -233,15 +230,15 @@ int do_action_new(OBX_store* store, int argc, char* argv[]) {
//--------------------------------------------------------------------------------------------------------------------

int do_action_done(OBX_store* store, int argc, char* argv[]) {
void* old_data = NULL;
const void* old_data = NULL;
size_t old_size = 0;
void* new_data = NULL;
size_t new_size = 0;
OBX_txn* txn = NULL;
OBX_cursor* cursor = NULL;

// grab the id from the command line
obx_id id = atol(argv[2]);
obx_id id = (obx_id) atol(argv[2]);
if (!id) {
printf("Error parsing ID \"%s\" as a number\n", argv[2]);
return -1;
Expand Down Expand Up @@ -318,7 +315,7 @@ int do_action_list(OBX_store* store, bool list_open) {
printf("%3s %-19s %-19s %s\n", "ID", "Created", "Finished", "Text");

// grab the first entity from the cursor
void* data;
const void* data;
size_t size;
bool found = false;

Expand Down Expand Up @@ -398,7 +395,7 @@ int parse_text(int argc, char** argv, char** outText) {
return -1;
}

*outText = (char*) malloc(sizeof(char) * (size + 1));
*outText = (char*) malloc(sizeof(char) * (size_t)(size + 1));
if (!*outText) {
printf("Could not process task text\n");
return -1;
Expand Down Expand Up @@ -432,13 +429,13 @@ int task_build(void** out_buff, size_t* out_size, obx_id id, const char* text, u
void* buffer = flatcc_builder_get_direct_buffer(&builder, out_size);

if (!buffer) {
printf("%s error: (could not get direct buffer)\n", __FUNCTION__);
printf("%s error: (could not get direct buffer)\n", __func__);
return -1;
}

*out_buff = malloc(*out_size);
if (*out_buff == NULL) {
printf("%s error: (could not copy direct buffer)\n", __FUNCTION__);
printf("%s error: (could not copy direct buffer)\n", __func__);
return -1;
}

Expand Down
Loading

0 comments on commit eb7f96e

Please sign in to comment.