-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Add c bindings for FlagNotifier. #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
eb51c19
feat: Add c bindings for FlagNotifier.
kinyoklion 09c6188
Add basic test.
kinyoklion 1a81a0c
Disconnet connection.
kinyoklion 70eb5a6
Revert apps
kinyoklion 107c7d2
Add extra newline.
kinyoklion fe7a59c
Cleanup CMakeLists.txt.
kinyoklion 234bc5d
Correct comments.
kinyoklion 71123b0
PR Feedback.
kinyoklion e66601e
Merge branch 'main' into rlamb/sc-204435/flag-notifier-bindings
kinyoklion 46b4687
Merge branch 'main' into rlamb/sc-204435/flag-notifier-bindings
kinyoklion 594ee37
Update tests for latest changes from main.
kinyoklion 67b3191
Struct init for MSVC
kinyoklion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
libs/common/include/launchdarkly/bindings/c/listener_connection.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // NOLINTBEGIN modernize-use-using | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <launchdarkly/bindings/c/export.h> | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { // only need to export C interface if | ||
| // used by C++ source code | ||
| #endif | ||
|
|
||
| /** | ||
| * Handle that represents a listener connection. | ||
| * | ||
| * To stop unregister a listener call LDListenerConnection_Disconnect. | ||
| * To free a connection listener call LDListenerConnection_Free. | ||
| * | ||
| * Freeing an LDListenerConnection does not disconnect the connection. If it is | ||
| * deleted, without being disconnected, then the listener will remain active | ||
| * until the associated SDK is freed. | ||
| */ | ||
| typedef struct _LDListenerConnection* LDListenerConnection; | ||
|
|
||
| /** | ||
| * Disconnect a listener. | ||
| * | ||
| * @param connection The connection for the listener to disconnect. | ||
| * Must not be NULL. | ||
| */ | ||
| LD_EXPORT(void) LDListenerConnection_Disconnect(LDListenerConnection connection); | ||
|
|
||
| /** | ||
| * Free a listener connection. | ||
| * | ||
| * @param connection The LDListenerConnection to free. | ||
| */ | ||
| LD_EXPORT(void) LDListenerConnection_Free(LDListenerConnection connection); | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| #pragma once | ||
|
|
||
| namespace launchdarkly::client_side { | ||
| namespace launchdarkly { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was moved to common, but client_side was not removed. |
||
|
|
||
| /** | ||
| * Represents the connection of a listener. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #include <launchdarkly/bindings/c/listener_connection.h> | ||
| #include <launchdarkly/detail/c_binding_helpers.hpp> | ||
|
|
||
| #include <launchdarkly/connection.hpp> | ||
|
|
||
| #include <memory> | ||
|
|
||
| #define TO_LC(ptr) (reinterpret_cast<launchdarkly::IConnection*>(ptr)) | ||
|
|
||
| LD_EXPORT(void) | ||
| LDListenerConnection_Disconnect(LDListenerConnection connection) { | ||
| LD_ASSERT_NOT_NULL(connection); | ||
| TO_LC(connection)->Disconnect(); | ||
| } | ||
|
|
||
| LD_EXPORT(void) LDListenerConnection_Free(LDListenerConnection connection) { | ||
| delete TO_LC(connection); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we do TestData for the server possibly we can add something similar to the client. It would make legitimate testing of these much simpler.
On the C++ side it is better tested because we can directly make the updater.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did test this a number of ways in the hello-c app.