Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Short README description. Removed Console debug messages

  • Loading branch information...
commit f01bb0fdf550f2b42a9c08eb9919a71c8b1f7610 1 parent 399d105
Bruno Martins authored
Showing with 32 additions and 7 deletions.
  1. +2 −0  .gitignore
  2. +21 −0 README
  3. +6 −6 clever_models.c
  4. +3 −1 main.c
2  .gitignore
View
@@ -0,0 +1,2 @@
+*.o
+*.d
21 README
View
@@ -0,0 +1,21 @@
+Clever Models
+
+Small tool to generate model classes from Restful Feeds. ( JSON & XML (planned) ) .
+
+Current initial Support, Java models from JSON Feeds.
+
+Install :
+
+git clone git@github.com:BrunoAlexandreMendesMartins/CleverModels.git
+
+cd CleverModels/Release
+
+make install
+
+Usage :
+
+./cm -n [Name of Initial Class Model] -p [folder path to where to write the models] -l [programming language] -u [Feed URL]
+
+Others:
+
+-h [string to write to headers]. - For example: package com.somepackage.name
12 clever_models.c
View
@@ -15,7 +15,7 @@
unsigned int write_json_class_model(char name[], char json[], int language_code, char path[], char* class_headers, int multiple_objects)
{
- printf("entering for class : %s \n", name);
+ //printf("entering for class : %s \n", name);
int opening_tag = 0;
int closing_tag = 0;
int opening_square_brackets = 0;
@@ -67,7 +67,7 @@ unsigned int write_json_class_model(char name[], char json[], int language_code,
strncpy(attribute_name, json + key_first_quote + 1, length_attr_name);
attribute_name[length_attr_name] = '\0';
- printf("Class : %s -> Attribute name : %s, length : %d \n", name, attribute_name, length_attr_name);
+ //printf("Class : %s -> Attribute name : %s, length : %d \n", name, attribute_name, length_attr_name);
int attr_type = get_attribute_type(json, i);
if (0 == already_wrote_attribute(attribute_name, attributes, nr_attributes) && strcmp(":", attribute_name) != 0) {
@@ -95,7 +95,7 @@ unsigned int write_json_class_model(char name[], char json[], int language_code,
free(partial_json);
- printf("# # back from class : %s rest json : %s, class name : %s, position : %d \n",attribute_name ,json+i, name, i);
+ //printf("# # back from class : %s rest json : %s, class name : %s, position : %d \n",attribute_name ,json+i, name, i);
}
}
@@ -109,7 +109,7 @@ unsigned int write_json_class_model(char name[], char json[], int language_code,
case '}': {
closing_tag++;
if (opening_tag == closing_tag) {
- printf("# end of object ! rest json : %s, class name : %s, position : %d \n", json+i, name, i);
+ //printf("# end of object ! rest json : %s, class name : %s, position : %d \n", json+i, name, i);
if (opening_square_brackets > closing_square_brackets) {
//find position of the end of the list of objects of this type
@@ -125,7 +125,7 @@ unsigned int write_json_class_model(char name[], char json[], int language_code,
case ']': {
closing_square_brackets++;
if (opening_tag == closing_tag && closing_square_brackets == opening_square_brackets) {
- printf("# end ] rest json : %s, class name : %s, position : %d \n", json+i, name, i);
+ //printf("# end ] rest json : %s, class name : %s, position : %d \n", json+i, name, i);
i++;
goto close_class;
}
@@ -203,7 +203,7 @@ int get_attribute_type(char json[], int colon_pos) {
attr_type = TYPE_OBJECT;
}
- printf("value : %s length : %d \n", value, value_length);
+ //printf("value : %s length : %d \n", value, value_length);
free(value);
}
4 main.c
View
@@ -116,7 +116,7 @@ int main(int argc, char * argv[]) {
//fclose(feed_file_stream);
}
//
- printf("json : %s \n", json);
+ //printf("json : %s \n", json);
//json = clean_spaces(json);
@@ -127,6 +127,8 @@ int main(int argc, char * argv[]) {
write_json_class_model(name, json, language_code, models_path, class_headers, 0);
free(json);
+ printf("done!");
+
return 0;
}
Please sign in to comment.
Something went wrong with that request. Please try again.