-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Action manager registration and dispatch
- Loading branch information
Showing
8 changed files
with
130 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -12,6 +12,7 @@ extern "C" { | |
|
||
#define EVENT_HANDLER_ARG_TYPE void* | ||
|
||
const char* EVT_ALL; | ||
EVENTS(EVENT_DECL); | ||
|
||
/** | ||
|
This file contains 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,16 @@ | ||
#ifndef __util__strcase_h | ||
#define __util__strcase_h | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <stddef.h> | ||
|
||
size_t str_to_camel_case(char* out, size_t out_len, const char* in); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains 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 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 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 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,32 @@ | ||
#include "util/strcase.h" | ||
#include <ctype.h> | ||
#include <string.h> | ||
|
||
size_t str_to_camel_case(char* out, size_t out_len, const char* in) { | ||
if (in == NULL) return -1; | ||
|
||
size_t len = strlen(in); | ||
size_t final = 0; | ||
int uc_next = 0; | ||
|
||
for (int i = 0; i < len; i++) { | ||
if (out != NULL && i >= out_len) break; | ||
if (in[i] == '_' || in[i] == '-') { | ||
uc_next = 1; | ||
continue; | ||
} | ||
|
||
if (out != NULL) { | ||
out[final] = uc_next ? toupper(in[i]) : tolower(in[i]); | ||
} | ||
|
||
uc_next = 0; | ||
final++; | ||
} | ||
|
||
if (out != NULL) { | ||
out[final] = '\0'; | ||
} | ||
|
||
return final; | ||
} |