Skip to content

Commit bdbe53c

Browse files
committed
rebased
1 parent 2c93d4a commit bdbe53c

71 files changed

Lines changed: 2029 additions & 7059 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef _keyValuePair_H_
2+
#define _keyValuePair_H_
3+
4+
#include<string.h>
5+
6+
typedef struct keyValuePair_t {
7+
char* key;
8+
void* value;
9+
} keyValuePair_t;
10+
11+
keyValuePair_t *keyValuePair_create(char *key, void *value);
12+
13+
keyValuePair_t* keyValuePair_create_allocate(char* key, double value);
14+
15+
void keyValuePair_free(keyValuePair_t *keyValuePair);
16+
17+
#endif /* _keyValuePair_H_ */
Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +0,0 @@
1-
#include <stdlib.h>
2-
#include <string.h>
3-
#include <stdio.h>
4-
#include "object.h"
5-
6-
object_t *object_create() {
7-
object_t *object = calloc(1, sizeof(object_t));
8-
9-
return object;
10-
}
11-
12-
void object_free(object_t *object) {
13-
if (!object) {
14-
return ;
15-
}
16-
17-
if (object->temporary) {
18-
free(object->temporary);
19-
object->temporary = NULL;
20-
}
21-
22-
free (object);
23-
}
24-
25-
cJSON *object_convertToJSON(object_t *object) {
26-
if (!object) {
27-
return NULL;
28-
}
29-
30-
if (!object->temporary) {
31-
return cJSON_Parse("null");
32-
}
33-
34-
return cJSON_Parse(object->temporary);
35-
}
36-
37-
object_t *object_parseFromJSON(cJSON *json){
38-
if (!json) {
39-
goto end;
40-
}
41-
42-
object_t *object = object_create();
43-
if (!object) {
44-
goto end;
45-
}
46-
object->temporary = cJSON_Print(json);
47-
return object;
48-
49-
end:
50-
return NULL;
51-
}
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
#include <stddef.h>
2+
#include <stdlib.h>
3+
#include <stdio.h>
4+
#include <string.h>
5+
6+
#include "../include/list.h"
7+
static listEntry_t *listEntry_create(void *data) {
8+
listEntry_t *createdListEntry = malloc(sizeof(listEntry_t));
9+
if(createdListEntry == NULL) {
10+
// TODO Malloc Failure
11+
return NULL;
12+
}
13+
createdListEntry->data = data;
14+
15+
return createdListEntry;
16+
}
17+
18+
void listEntry_free(listEntry_t *listEntry, void *additionalData) {
19+
free(listEntry);
20+
}
21+
22+
void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) {
23+
printf("%i\n", *(int *)listEntry->data);
24+
}
25+
26+
list_t *list_createList() {
27+
list_t *createdList = malloc(sizeof(list_t));
28+
if(createdList == NULL) {
29+
// TODO Malloc Failure
30+
return NULL;
31+
}
32+
createdList->firstEntry = NULL;
33+
createdList->lastEntry = NULL;
34+
createdList->count = 0;
35+
36+
return createdList;
37+
}
38+
39+
void list_iterateThroughListForward(list_t *list,
40+
void (*operationToPerform)(
41+
listEntry_t *,
42+
void *callbackFunctionUsedData),
43+
void *additionalDataNeededForCallbackFunction)
44+
{
45+
listEntry_t *currentListEntry = list->firstEntry;
46+
listEntry_t *nextListEntry;
47+
48+
if(currentListEntry == NULL) {
49+
return;
50+
}
51+
52+
nextListEntry = currentListEntry->nextListEntry;
53+
54+
operationToPerform(currentListEntry,
55+
additionalDataNeededForCallbackFunction);
56+
currentListEntry = nextListEntry;
57+
58+
while(currentListEntry != NULL) {
59+
nextListEntry = currentListEntry->nextListEntry;
60+
operationToPerform(currentListEntry,
61+
additionalDataNeededForCallbackFunction);
62+
currentListEntry = nextListEntry;
63+
}
64+
}
65+
66+
void list_iterateThroughListBackward(list_t *list,
67+
void (*operationToPerform)(
68+
listEntry_t *,
69+
void *callbackFunctionUsedData),
70+
void *additionalDataNeededForCallbackFunction)
71+
{
72+
listEntry_t *currentListEntry = list->lastEntry;
73+
listEntry_t *nextListEntry = currentListEntry->prevListEntry;
74+
75+
if(currentListEntry == NULL) {
76+
return;
77+
}
78+
79+
operationToPerform(currentListEntry,
80+
additionalDataNeededForCallbackFunction);
81+
currentListEntry = nextListEntry;
82+
83+
while(currentListEntry != NULL) {
84+
nextListEntry = currentListEntry->prevListEntry;
85+
operationToPerform(currentListEntry,
86+
additionalDataNeededForCallbackFunction);
87+
currentListEntry = nextListEntry;
88+
}
89+
}
90+
91+
void list_freeList(list_t *list) {
92+
if(list){
93+
list_iterateThroughListForward(list, listEntry_free, NULL);
94+
free(list);
95+
}
96+
}
97+
98+
void list_addElement(list_t *list, void *dataToAddInList) {
99+
listEntry_t *newListEntry = listEntry_create(dataToAddInList);
100+
if(newListEntry == NULL) {
101+
// TODO Malloc Failure
102+
return;
103+
}
104+
if(list->firstEntry == NULL) {
105+
list->firstEntry = newListEntry;
106+
list->lastEntry = newListEntry;
107+
108+
newListEntry->prevListEntry = NULL;
109+
newListEntry->nextListEntry = NULL;
110+
111+
list->count++;
112+
113+
return;
114+
}
115+
116+
list->lastEntry->nextListEntry = newListEntry;
117+
newListEntry->prevListEntry = list->lastEntry;
118+
newListEntry->nextListEntry = NULL;
119+
list->lastEntry = newListEntry;
120+
121+
list->count++;
122+
}
123+
124+
void list_removeElement(list_t *list, listEntry_t *elementToRemove) {
125+
listEntry_t *elementBeforeElementToRemove =
126+
elementToRemove->prevListEntry;
127+
listEntry_t *elementAfterElementToRemove =
128+
elementToRemove->nextListEntry;
129+
130+
if(elementBeforeElementToRemove != NULL) {
131+
elementBeforeElementToRemove->nextListEntry =
132+
elementAfterElementToRemove;
133+
} else {
134+
list->firstEntry = elementAfterElementToRemove;
135+
}
136+
137+
if(elementAfterElementToRemove != NULL) {
138+
elementAfterElementToRemove->prevListEntry =
139+
elementBeforeElementToRemove;
140+
} else {
141+
list->lastEntry = elementBeforeElementToRemove;
142+
}
143+
144+
listEntry_free(elementToRemove, NULL);
145+
146+
list->count--;
147+
}
148+
149+
listEntry_t *list_getElementAt(list_t *list, long indexOfElement) {
150+
listEntry_t *currentListEntry;
151+
152+
if((list->count / 2) > indexOfElement) {
153+
currentListEntry = list->firstEntry;
154+
155+
for(int i = 0; i < indexOfElement; i++) {
156+
currentListEntry = currentListEntry->nextListEntry;
157+
}
158+
159+
return currentListEntry;
160+
} else {
161+
currentListEntry = list->lastEntry;
162+
163+
for(int i = 1; i < (list->count - indexOfElement); i++) {
164+
currentListEntry = currentListEntry->prevListEntry;
165+
}
166+
167+
return currentListEntry;
168+
}
169+
}
170+
171+
char* findStrInStrList(list_t *strList, const char *str)
172+
{
173+
if (!strList || !str) {
174+
return NULL;
175+
}
176+
177+
listEntry_t* listEntry = NULL;
178+
list_ForEach(listEntry, strList) {
179+
if (strstr(listEntry->data, str) != NULL) {
180+
return listEntry->data;
181+
}
182+
}
183+
184+
return NULL;
185+
}
186+
187+
void clear_and_free_string_list(list_t *list)
188+
{
189+
if (!list) {
190+
return;
191+
}
192+
193+
listEntry_t *listEntry = NULL;
194+
list_ForEach(listEntry, list) {
195+
char *list_item = listEntry->data;
196+
free(list_item);
197+
list_item = NULL;
198+
}
199+
list_freeList(list);
200+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"orgName": "muenzpraeger - René Winkelmeyer",
3+
"edition": "Developer",
4+
"orgPreferences": {
5+
"enabled": ["S1DesktopEnabled"],
6+
"disabled": ["S1EncryptedStoragePref2"]
7+
}
8+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Enum_Test
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**enumUnderscorestring** | **string** | | [optional] [default to null]
7+
**enumUnderscorestringUnderscorerequired** | **string** | | [default to null]
8+
**enumUnderscoreinteger** | **integer** | | [optional] [default to null]
9+
**enumUnderscorenumber** | **float** | | [optional] [default to null]
10+
**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] [default to null]
11+
12+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
13+
14+
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +0,0 @@
1-
# MapTest
2-
3-
## Properties
4-
Name | Type | Description | Notes
5-
------------ | ------------- | ------------- | -------------
6-
**mapUnderscoremapUnderscoreofUnderscorestring** | **map[String, map[String, string]]** | | [optional] [default to null]
7-
**mapUnderscoreofUnderscoreenumUnderscorestring** | **map[String, string]** | | [optional] [default to null]
8-
**directUnderscoremap** | **map[String, boolean]** | | [optional] [default to null]
9-
**indirectUnderscoremap** | **map[String, boolean]** | | [optional] [default to null]
10-
11-
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
12-
13-
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* model_with_set_propertes.h
3+
*
4+
* to test set properties
5+
*/
6+
7+
#ifndef _model_with_set_propertes_H_
8+
#define _model_with_set_propertes_H_
9+
10+
#include <string.h>
11+
#include "../external/cJSON.h"
12+
#include "../include/list.h"
13+
#include "../include/keyValuePair.h"
14+
#include "../include/binary.h"
15+
16+
typedef struct model_with_set_propertes_t model_with_set_propertes_t;
17+
18+
#include "tag.h"
19+
20+
21+
22+
typedef struct model_with_set_propertes_t {
23+
list_t *tag_set; //nonprimitive container
24+
list_t *string_set; //primitive container
25+
26+
int _library_owned; // Is the library responsible for freeing this object?
27+
} model_with_set_propertes_t;
28+
29+
__attribute__((deprecated)) model_with_set_propertes_t *model_with_set_propertes_create(
30+
list_t *tag_set,
31+
list_t *string_set
32+
);
33+
34+
void model_with_set_propertes_free(model_with_set_propertes_t *model_with_set_propertes);
35+
36+
model_with_set_propertes_t *model_with_set_propertes_parseFromJSON(cJSON *model_with_set_propertesJSON);
37+
38+
cJSON *model_with_set_propertes_convertToJSON(model_with_set_propertes_t *model_with_set_propertes);
39+
40+
#endif /* _model_with_set_propertes_H_ */
41+

0 commit comments

Comments
 (0)