forked from loafle/openapi-generator-original
* [C] Deprecate *_create() to avoid *_free() confusion The behaviour of *_free() doesn't match *_create(), so the user should avoid using them together. But they still need *_free() to clean up library-allocated objects, so add a _library_owned flag to each struct as an attempt to tell them apart. This isn't perfect though, because the user may neglect to zero the field, but they would still see a warning once in a while so it serves its purpose. To prevent the new deprecation warnings (intended for the user) from showing up during the library build itself, define a new family of *_create_internal() functions, and turn *_create() into simple wrappers. * Update samples * add eafer to c technical committee --------- Co-authored-by: William Cheng <wing328hk@gmail.com>
41 lines
832 B
C
41 lines
832 B
C
/*
|
|
* mapped_model.h
|
|
*
|
|
* to test mapping features
|
|
*/
|
|
|
|
#ifndef _MappedModel_H_
|
|
#define _MappedModel_H_
|
|
|
|
#include <string.h>
|
|
#include "../external/cJSON.h"
|
|
#include "../include/list.h"
|
|
#include "../include/keyValuePair.h"
|
|
#include "../include/binary.h"
|
|
|
|
typedef struct MappedModel_t MappedModel_t;
|
|
|
|
|
|
|
|
|
|
typedef struct MappedModel_t {
|
|
int another_property; //numeric
|
|
char *uuid_property; // string
|
|
|
|
int _library_owned; // Is the library responsible for freeing this object?
|
|
} MappedModel_t;
|
|
|
|
__attribute__((deprecated)) MappedModel_t *MappedModel_create(
|
|
int another_property,
|
|
char *uuid_property
|
|
);
|
|
|
|
void MappedModel_free(MappedModel_t *MappedModel);
|
|
|
|
MappedModel_t *MappedModel_parseFromJSON(cJSON *MappedModelJSON);
|
|
|
|
cJSON *MappedModel_convertToJSON(MappedModel_t *MappedModel);
|
|
|
|
#endif /* _MappedModel_H_ */
|
|
|