Skip to content

Commit 3b02021

Browse files
committed
0.10.0
1 parent 8c0b447 commit 3b02021

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+13424
-553
lines changed

CHANGELOG.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,72 @@
1+
ObjectBox C and C++ API Changelog
2+
=================================
3+
4+
0.10.0 (2020-08-13)
5+
------------------
6+
C++ API queries and model classes for more feature-rich generated code.
7+
C-API cleanup & docs updates, including the following changes (some of them breaking due to renames):
8+
9+
##### Misc
10+
* new property type: DateNano for datetime with nanosecond precision
11+
* new store options obx_opt_*()
12+
* validate_on_open - to validate the database during openining
13+
* put_padding_mode - configure the padding used by your flatbuffers implementation
14+
* use_previous_commit - roll-back the database to the previously committed version
15+
* read_only - open the database in the read only mode
16+
* debug_flags - configure debug logging
17+
18+
##### Cursor
19+
* remove obx_cursor2(), use obx_cursor() in combination with obx_store_entity_id()
20+
* rename obx_cursor_put_mode() to obx_cursor_put4()
21+
* obx_cursor_put() drops the last parameter `checkForPreviousValue` and introduced a complementary obx_cursor_put_new()
22+
* remove obx_cursor_put_padded()
23+
* rename obx_cursor_backlink_bytes() to obx_cursor_backlinks()
24+
* rename obx_cursor_ts_limits() to obx_cursor_ts_min_max()
25+
* rename obx_cursor_ts_limits_range() to obx_cursor_ts_min_max_range()
26+
27+
##### Box
28+
* rename obx_box_put() to obx_box_put5()
29+
* rename obx_box_put_object() to obx_box_put_object4()
30+
* change obx_box_put_many to fail when any of the individual inserts/updates fails and new obx_box_put_many5() to override this behavior
31+
* new obx_box_store() to get access to OBX_store* owning the given box
32+
* new obx_box_insert() obx_box_update() for for insert and update semantics, same as put mode arg in obx_box_put5()
33+
* new obx_box_put() without a mode argument (defaults to PUT)
34+
* new obx_box_put_object() without a mode argument (defaults to PUT)
35+
* new obx_box_ts_min_max() for time-series databases
36+
* new obx_box_ts_min_max_range() for time-series databases
37+
38+
##### Async
39+
* rename obx_async_put_mode() to obx_async_put5()
40+
* rename obx_async_id_put() to obx_async_put_object()
41+
* rename obx_async_id_insert() to obx_async_insert_object()
42+
43+
##### Query builder
44+
* obx_qb_{type}_{operation}() function naming changes to obx_qb_{operation}_{type}(), e.g. obx_qb_int_equal() becomes obx_qb_equals_int()
45+
* obx_qb_{operation}_{type}() functions taking multiple arguments have an "s" at the end, indicating plural, e.g. obx_qb_in_int64s()
46+
* operation `equal` becomes `equals`, `greater` becomes `greater_than`, `less` becomes `less_than`
47+
* obx_qb_greater_than_string() drops `with_equal` argument in favor of the new obx_qb_greater_or_equal_string() function
48+
* obx_qb_less_than_string() drops `with_equal` argument in favor of the new obx_qb_less_or_equal_string() function
49+
* change obx_qb_in_strings() argument `const char* values[]` changes to `const char* const values[]`,
50+
i.e. const array of const char pointers
51+
* obx_qb_greater_than_bytes() drops `with_equal` argument in favor of the new obx_qb_greater_or_equal_bytes() function
52+
* obx_qb_less_than_bytes() drops `with_equal` argument in favor of the new obx_qb_less_or_equal_bytes() function
53+
54+
##### Query
55+
Limit and offset are now part of the query state instead of function arguments, therefore:
56+
* new obx_query_offset() and obx_query_limit() set persistent offset/limit for all future calls to other query functions
57+
* obx_query_find(), obx_query_visit(), obx_query_find_ids(), as well as the cursor alternatives,
58+
all drop `offset` and `limit` arguments
59+
* note: some query functions, such as count/remove don't support non-zero offset/limit yet.
60+
* obx_query_{type}_param() function naming changes to obx_query_param_{type}(), e.g. obx_query_string_param()
61+
becomes obx_query_param_string() or obx_query_param_strings() for the plural variant
62+
* obx_query_{type}_param_alias() function naming changes to obx_query_param_alias_{type}(), e.g. obx_query_string_param_alias()
63+
becomes obx_query_param_alias_string()
64+
* obx_query_param_strings() and obx_query_param_alias_strings() argument `const char* values[]`
65+
changes to `const char* const values[]`, i.e. const array of const char pointers
66+
* obx_query_prop_{type}_find() function naming changes to obx_query_prop_find_{type}s(), with an "s" indicating the return
67+
type is plural, e.g. obx_query_prop_find_strings
68+
* remove deprecated obx_query_prop_distinct_string()
69+
170
0.9.2 (2020-06-30)
271
------------------
372
* Rename obx_cursor_ts_limits() to obx_cursor_ts_min_max()

README.md

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ ObjectBox C and C++ APIs
33
[ObjectBox](https://objectbox.io) is a superfast database for objects.
44
This is the **ObjectBox runtime library** to run ObjectBox as an embedded database in your C or C++ application.
55

6-
**Latest version: 0.9.2** (2020-06-30). See [changelog](CHANGELOG.md) for more details.
6+
**Latest version: 0.10.0** (2020-08-13). See [changelog](CHANGELOG.md) for more details.
77

8-
In most cases you want to use the C and C++ APIs in combination with the **companion project [ObjectBox Generator](https://github.com/objectbox/objectbox-generator)**.
9-
Like this, you get a convenient API which requires minimal code on your side to work with the database.
8+
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**.
9+
This way, you get a convenient C or C++ API which requires minimal code on your side to work with the database.
1010

1111
Here's a C++ code example that inserts a `Task` data object into the database:
12+
```c++
13+
obx::Box<Task> box(store);
14+
box.put({.text = "Buy milk"});
15+
```
1216
13-
obx::Box<Task> box(store);
14-
box.put({.text = "Buy milk"});
15-
16-
Note: `Task` is a `struct` representing a user defined data model - see [ObjectBox Generator](https://github.com/objectbox/objectbox-generator) for details.
17+
Note: `Task` is a `struct` representing a user defined data model - see [ObjectBox C and C++ docs](https://cpp.objectbox.io/) for details.
1718
1819
Some features
1920
-------------
@@ -38,45 +39,35 @@ The APIs come as single header file for C and C++:
3839
* C++: [include/objectbox-cpp.h](include/objectbox-cpp.h) (depends on objectbox.h)
3940
4041
Compile your code against it and use the binary library (.so, .dylib, .dll depending on the platform) to link against.
41-
42-
There are a couple of ways to get the library:
43-
44-
* Using the download.sh script (on Windows, use something like Git Bash to run it)
45-
* Either clone the repo and run `./download.sh`
46-
* ... or download [download.sh](download.sh) and run it in a terminal:<br>
47-
`wget https://raw.githubusercontent.com/objectbox/objectbox-c/master/download.sh`<br>
48-
`chmod +x download.sh`<br>
49-
`./download.sh`
50-
* Conan (wip, details coming later): https://bintray.com/objectbox/conan/objectbox-c%3Aobjectbox
51-
52-
Details on the download.sh script:
53-
54-
* It creates a "download" directory and a version dependent sub directory named like "libobjectbox-0.1-some-hex-hash"
55-
* Inside the version dependent sub directory, you will find the directories "include" and "lib"
56-
* The "lib" directory contains the binary library
57-
* On systems supporting 'sudo', the download.sh script also asks you to install the library in /usr/local/lib.
42+
Head over to [ObjectBox C and C++ installation docs](https://cpp.objectbox.io/installation) for step-by-step instructions.
5843
5944
C++ API
6045
-------
6146
The C++ API is built on top of the C API exposed by the library (e.g. you still need objectbox.h).
62-
You can also use both APIs from your code if need be.
47+
You can also use both APIs from your code if necessary.
6348
For example, you use the C++ `obx::Box` class for most database operations, but "break out" into the C API for a special function you need.
6449
Note that to use the `obx::Box` class, you also need the [ObjectBox Generator](https://github.com/objectbox/objectbox-generator) to generate binding code.
65-
In short, it generates "boiler plate" source code and maintains some metadata around the data model.
50+
Find more details how to use it the [Getting started](https://cpp.objectbox.io/getting-started) section of the docs.
51+
52+
Examples
53+
--------
54+
Have a look at the following TaskList example apps, depending on your programming language and preference:
6655
67-
Examples & API Documentation
68-
----------------------------
69-
Documentation is still on-going work.
70-
For now, please refer to the [ObjectBox Generator](https://github.com/objectbox/objectbox-generator) for more details.
56+
* [C, cursor, no generated code](examples/c-cursor-no-gen) - plain C; using flatcc directly; without any generated code
57+
* [C, with generated code](examples/cpp-gen) - plain C, using code generated by `objectbox-generator`
58+
* [C++, with generated code](examples/cpp-gen) - C++, using code generated by `objectbox-generator`
7159
72-
For an API reference check one of those:
7360
74-
* [include/objectbox.h](include/objectbox.h): single header file
75-
* [API reference docs](https://objectbox.io/docfiles/c/current/): online HTML docs (Doxygen)
61+
Documentation
62+
-------------
63+
* [C and C++ docs](https://cpp.objectbox.io/) - official ObjectBox C and C++ documentation
64+
* [include/objectbox.h](include/objectbox.h) - C-API header file contains docs in as code comments
65+
* [include/objectbox-cpp.h](include/objectbox-cpp.h) - C-API header file contains docs in as code comments
66+
* [C and C++ API reference docs](https://objectbox.io/docfiles/c/current/) - online HTML docs (Doxygen)
7667
7768
Current state / Changelog
7869
-------------------------
79-
The C API is a thin wrapper around a robust DB core, which is version 2.x and already used on million of devices.
70+
The C API is a thin wrapper around a robust DB core, which is version 2.x and already used on millions of devices.
8071
8172
**Beta notice:** the C API will become stable starting from version 1.0.
8273
Until then, API improvements may result in breaking changes. For example, functions may still be renamed.
@@ -88,7 +79,7 @@ C API as the Foundation for Higher Languages
8879
--------------------------------------------
8980
The plain C API (without the Generator) also serves as a basis for ObjectBox bindings in higher languages.
9081
For example, the official APIs for [Go](https://github.com/objectbox/objectbox-go), [Swift](https://github.com/objectbox/objectbox-swift), [Dart/Flutter](https://github.com/objectbox/objectbox-dart) and [Python](https://github.com/objectbox/objectbox-python) rely on the C API.
91-
In the same way, you could create a ObjectBox API for another programming language, e.g. for JavaScript.
82+
In the same way, you could create an ObjectBox API for another programming language, e.g. for JavaScript.
9283
For the C API, data consists of bytes representing FlatBuffers tables, which you can build and read in your language of choice.
9384
9485
License

download.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ tty -s || quiet=true
3939

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

42-
version=${1:-0.9.2}
42+
version=${1:-0.10.0}
4343
repoType=${2:-testing}
4444
os=${3:-$(uname)}
4545
arch=${4:-$(uname -m)}

doxygen/Changelog.md

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,73 @@
11
[TOC]
22

3-
ObjectBox C API Changelog
4-
=========================
3+
ObjectBox C and C++ API Changelog
4+
=================================
5+
6+
0.10.0 (2020-08-13)
7+
------------------
8+
C++ API queries and model classes for more feature-rich generated code.
9+
C-API cleanup & docs updates, including the following changes (some of them breaking due to renames):
10+
11+
##### Misc
12+
* new property type: DateNano for datetime with nanosecond precision
13+
* new store options obx_opt_*()
14+
* validate_on_open - to validate the database during openining
15+
* put_padding_mode - configure the padding used by your flatbuffers implementation
16+
* use_previous_commit - roll-back the database to the previously committed version
17+
* read_only - open the database in the read only mode
18+
* debug_flags - configure debug logging
19+
20+
##### Cursor
21+
* remove obx_cursor2(), use obx_cursor() in combination with obx_store_entity_id()
22+
* rename obx_cursor_put_mode() to obx_cursor_put4()
23+
* obx_cursor_put() drops the last parameter `checkForPreviousValue` and introduced a complementary obx_cursor_put_new()
24+
* remove obx_cursor_put_padded()
25+
* rename obx_cursor_backlink_bytes() to obx_cursor_backlinks()
26+
* rename obx_cursor_ts_limits() to obx_cursor_ts_min_max()
27+
* rename obx_cursor_ts_limits_range() to obx_cursor_ts_min_max_range()
28+
29+
##### Box
30+
* rename obx_box_put() to obx_box_put5()
31+
* rename obx_box_put_object() to obx_box_put_object4()
32+
* change obx_box_put_many to fail when any of the individual inserts/updates fails and new obx_box_put_many5() to override this behavior
33+
* new obx_box_store() to get access to OBX_store* owning the given box
34+
* new obx_box_insert() obx_box_update() for for insert and update semantics, same as put mode arg in obx_box_put5()
35+
* new obx_box_put() without a mode argument (defaults to PUT)
36+
* new obx_box_put_object() without a mode argument (defaults to PUT)
37+
* new obx_box_ts_min_max() for time-series databases
38+
* new obx_box_ts_min_max_range() for time-series databases
39+
40+
##### Async
41+
* rename obx_async_put_mode() to obx_async_put5()
42+
* rename obx_async_id_put() to obx_async_put_object()
43+
* rename obx_async_id_insert() to obx_async_insert_object()
44+
45+
##### Query builder
46+
* obx_qb_{type}_{operation}() function naming changes to obx_qb_{operation}_{type}(), e.g. obx_qb_int_equal() becomes obx_qb_equals_int()
47+
* obx_qb_{operation}_{type}() functions taking multiple arguments have an "s" at the end, indicating plural, e.g. obx_qb_in_int64s()
48+
* operation `equal` becomes `equals`, `greater` becomes `greater_than`, `less` becomes `less_than`
49+
* obx_qb_greater_than_string() drops `with_equal` argument in favor of the new obx_qb_greater_or_equal_string() function
50+
* obx_qb_less_than_string() drops `with_equal` argument in favor of the new obx_qb_less_or_equal_string() function
51+
* change obx_qb_in_strings() argument `const char* values[]` changes to `const char* const values[]`,
52+
i.e. const array of const char pointers
53+
* obx_qb_greater_than_bytes() drops `with_equal` argument in favor of the new obx_qb_greater_or_equal_bytes() function
54+
* obx_qb_less_than_bytes() drops `with_equal` argument in favor of the new obx_qb_less_or_equal_bytes() function
55+
56+
##### Query
57+
Limit and offset are now part of the query state instead of function arguments, therefore:
58+
* new obx_query_offset() and obx_query_limit() set persistent offset/limit for all future calls to other query functions
59+
* obx_query_find(), obx_query_visit(), obx_query_find_ids(), as well as the cursor alternatives,
60+
all drop `offset` and `limit` arguments
61+
* note: some query functions, such as count/remove don't support non-zero offset/limit yet.
62+
* obx_query_{type}_param() function naming changes to obx_query_param_{type}(), e.g. obx_query_string_param()
63+
becomes obx_query_param_string() or obx_query_param_strings() for the plural variant
64+
* obx_query_{type}_param_alias() function naming changes to obx_query_param_alias_{type}(), e.g. obx_query_string_param_alias()
65+
becomes obx_query_param_alias_string()
66+
* obx_query_param_strings() and obx_query_param_alias_strings() argument `const char* values[]`
67+
changes to `const char* const values[]`, i.e. const array of const char pointers
68+
* obx_query_prop_{type}_find() function naming changes to obx_query_prop_find_{type}s(), with an "s" indicating the return
69+
type is plural, e.g. obx_query_prop_find_strings
70+
* remove deprecated obx_query_prop_distinct_string()
571

672
0.9.2 (2020-06-30)
773
------------------

doxygen/Doxyfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "ObjectBox C API"
35+
PROJECT_NAME = "ObjectBox C and C++ API"
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = "0.9.2"
41+
PROJECT_NUMBER = "0.10.0"
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a
@@ -790,7 +790,7 @@ WARN_LOGFILE =
790790
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
791791
# Note: If this tag is empty the current directory is searched.
792792

793-
INPUT = ../include/objectbox.h
793+
INPUT = ../include
794794
INPUT += main-page.md
795795
# Doxygen seems buggy with our standard CHANGELOG.md: it does not show headers.
796796
# To work-around those problems, we have a special version for Doxygen:

doxygen/main-page.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ Introduction
66

77
Installation and examples
88
-------------------------
9-
Check the [ObjectBox C repository](https://github.com/objectbox/objectbox-c) for additional info and examples including the usage of flatcc.
9+
See [Installation docs](https://cpp.objectbox.io/installation) and check the [project's GitHub repository](https://github.com/objectbox/objectbox-c) for additional info and examples including the usage of flatcc.
1010

11-
Single header
11+
Headers
1212
-------------
13-
The entire ObjectBox C API is defined in a single header file:
14-
15-
**objectbox.h**
13+
* ObjectBox C99 support is provided by a single header file: **objectbox.h**
14+
* ObjectBox C++11 support is available in an additional header: **objectbox-cpp.h**
1615

1716
Basic concepts
1817
--------------
@@ -22,22 +21,26 @@ Basic concepts
2221
* Objects are addressed using a 64 bit integer ID (`obx_id`)
2322
* There is no query language; queries are build using a [query builder](\ref OBX_query_builder)
2423

24+
See [docs](https://cpp.objectbox.io) for more information on how to use ObjectBox in C and C++
25+
2526
API Naming conventions
2627
----------------------
27-
* methods: obx_thing_action()
28-
* structs: OBX_thing {}
29-
* error codes: OBX_ERROR_REASON
28+
* C methods: obx_thing_action()
29+
* C structs: OBX_thing {}
30+
* C error codes: OBX_ERROR_REASON
31+
* C++ namespace: obx::
3032

3133
Essential types
3234
-----------------
3335
Check the docs for the following types:
3436

35-
* [OBX_store](\ref OBX_store): the "database"; "opens" data files in a given directory
36-
* [OBX_box](\ref OBX_box): object operations like put and get
37-
* [OBX_query_builder](\ref OBX_query_builder): used to construct queries using "query conditions"
38-
* [OBX_query](\ref OBX_query): the product of a query builder can be executed to find objects matching the previously defined conditions
37+
* [OBX_store](\ref OBX_store) and [obx::Store](\ref obx::Store): the "database"; "opens" data files in a given directory
38+
* [OBX_box](\ref OBX_box) and [obx::Box](\ref obx::Box): object operations like put and get
39+
* [OBX_query_builder](\ref OBX_query_builder) and [obx::QueryBuilder](\ref obx::QueryBuilder): used to construct queries using "query conditions"
40+
* [OBX_query](\ref OBX_query) and [obx::Query](\ref obx::Query): the product of a query builder can be executed to find objects matching the previously defined conditions
3941

4042
Essential Links/Readings
4143
------------------------
44+
* High-level docs and examples: https://cpp.objectbox.io
4245
* Entity (object) IDs: https://docs.objectbox.io/advanced/object-ids
4346
* Meta model and UIDs: https://docs.objectbox.io/advanced/meta-model-ids-and-uids

examples/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
add_subdirectory(tasks)
1+
add_subdirectory(c-cursor-no-gen)
2+
add_subdirectory(c-gen)
3+
add_subdirectory(cpp-gen)
File renamed without changes.

0 commit comments

Comments
 (0)