@@ -24,10 +24,10 @@ See the test project in test directory for a bit more details.
24
24
25
25
Usage
26
26
======
27
- Improting JSON to your class's instance!
28
- ===
29
- // Importing json into your custom instance
30
- QByteArray jsonInput = "\" {\"address\": {"
27
+ Improting JSON to your class's instance!
28
+ === ===
29
+ // Importing json into your custom instance
30
+ QByteArray jsonInput = "{\"address\": {"
31
31
"\"city\": \"Rajshahi\","
32
32
"\"country\": \"Bangladesh\","
33
33
"\"zip\": \"6402\"},"
@@ -49,35 +49,37 @@ Usage
49
49
"\"name\": \"Mirza Alam\","
50
50
"\"speciality\": ["
51
51
"\"C/C++\","
52
- "\"Algorithms\"]}]}\" ";
52
+ "\"Algorithms\"]}]}";
53
53
54
- School* school = new School(&a);
55
- school->importFromJson(jsonInput);
56
- qDebug() <<"School name: " << school->name();
57
- qDebug() <<"School address's city: " << school->address()->city();
54
+ School school;
55
+ school.importFromJson(jsonInput);
56
+ qDebug() <<"School name: " << school.name();
57
+ qDebug() <<"School address's city: " << school.address()->city();
58
+ qDebug() <<"Teacer name: " << school.itemTeacherAt(0)->name();
59
+ qDebug() <<"Student name: " << school.itemStudentAt(0)->name();
58
60
59
61
60
- Exporting JSON from your class's instance!
61
- ===
62
- School* school = new School(&a) ;
63
- school-> name("Kernel Coders Lab --- www.kernelcoderslab.com");
64
- Address* address = new Address(school);
65
- address->country("Bangladesh");address->city("Rajshahi");address->zip("6402");
66
- school-> address(address);
62
+ Exporting JSON from your class's instance!
63
+ === ===
64
+ School school;
65
+ school. name("Kernel Coders Lab --- www.kernelcoderslab.com");
66
+ Address* address = new Address(& school);
67
+ address->country("Bangladesh");address->city("Rajshahi");address->zip("6402");
68
+ school. address(address);
67
69
68
- Teacher* teacher = new Teacher(school);
69
- teacher->name("Mirza Alam");teacher->speciality(QStringList() << "C/C++" << "Algorithms");
70
- address = new Address(teacher);
71
- address->country("Bangladesh");address->city("Dhaka");address->zip("1000");
72
- teacher->address(address);
73
- school-> appendTeacher(teacher);
70
+ Teacher* teacher = new Teacher(& school);
71
+ teacher->name("Mirza Alam");teacher->speciality(QStringList() << "C/C++" << "Algorithms");
72
+ address = new Address(teacher);
73
+ address->country("Bangladesh");address->city("Dhaka");address->zip("1000");
74
+ teacher->address(address);
75
+ school. appendTeacher(teacher);
74
76
75
- Student* student = new Student(school);
76
- student->name("Shahazan Ali");student->courses(QStringList() << "C/C++" << "Algorithms");
77
- address = new Address(student);
78
- address->country("Bangladesh");address->city("Natore");address->zip("6200");
79
- student->address(address);
80
- school-> appendStudent(student);
77
+ Student* student = new Student(& school);
78
+ student->name("Shahazan Ali");student->courses(QStringList() << "C/C++" << "Algorithms");
79
+ address = new Address(student);
80
+ address->country("Bangladesh");address->city("Natore");address->zip("6200");
81
+ student->address(address);
82
+ school. appendStudent(student);
81
83
82
- QByteArray json = school-> exportToJson();
83
- qDebug() << json;
84
+ QByteArray json = school. exportToJson();
85
+ qDebug() << json;
0 commit comments