You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-35Lines changed: 26 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -3,17 +3,18 @@ ObjectBox C and C++ APIs
3
3
[ObjectBox](https://objectbox.io) is a superfast database for objects.
4
4
This is the **ObjectBox runtime library** to run ObjectBox as an embedded database in your C or C++ application.
5
5
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.
7
7
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.
10
10
11
11
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
+
```
12
16
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.
17
18
18
19
Some features
19
20
-------------
@@ -38,45 +39,35 @@ The APIs come as single header file for C and C++:
38
39
* C++: [include/objectbox-cpp.h](include/objectbox-cpp.h) (depends on objectbox.h)
39
40
40
41
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>
* 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.
58
43
59
44
C++ API
60
45
-------
61
46
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.
63
48
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.
64
49
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:
66
55
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`
71
59
72
-
For an API reference check one of those:
73
60
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)
76
67
77
68
Current state / Changelog
78
69
-------------------------
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.
80
71
81
72
**Beta notice:** the C API will become stable starting from version 1.0.
82
73
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
88
79
--------------------------------------------
89
80
The plain C API (without the Generator) also serves as a basis for ObjectBox bindings in higher languages.
90
81
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.
92
83
For the C API, data consists of bytes representing FlatBuffers tables, which you can build and read in your language of choice.
Copy file name to clipboardExpand all lines: doxygen/main-page.md
+15-12Lines changed: 15 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,12 @@ Introduction
6
6
7
7
Installation and examples
8
8
-------------------------
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.
10
10
11
-
Single header
11
+
Headers
12
12
-------------
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**
16
15
17
16
Basic concepts
18
17
--------------
@@ -22,22 +21,26 @@ Basic concepts
22
21
* Objects are addressed using a 64 bit integer ID (`obx_id`)
23
22
* There is no query language; queries are build using a [query builder](\ref OBX_query_builder)
24
23
24
+
See [docs](https://cpp.objectbox.io) for more information on how to use ObjectBox in C and C++
25
+
25
26
API Naming conventions
26
27
----------------------
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::
30
32
31
33
Essential types
32
34
-----------------
33
35
Check the docs for the following types:
34
36
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
39
41
40
42
Essential Links/Readings
41
43
------------------------
44
+
* High-level docs and examples: https://cpp.objectbox.io
0 commit comments