MCPcopy Create free account
hub / github.com/acl-dev/acl / list_print

Function list_print

lib_acl_cpp/samples/json/json2/json.cpp:12–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace std;
11
12static void list_print(const vector<acl::json_node*>& nodes)
13{
14 vector<acl::json_node*>::const_iterator cit = nodes.begin();
15 for (; cit != nodes.end(); ++cit)
16 {
17 printf(">>>json node to string: %s\r\n", (*cit)->to_string().c_str());
18 const char* name = (*cit)->tag_name();
19 const char* text = (*cit)->get_text();
20 acl::json_node* node1 = (*cit)->first_child();
21 printf("tag: %s, value: %s\r\n", name ? name : "null",
22 node1 ? "obj" : (text ? text : "null"));
23
24 if (node1 == NULL)
25 continue;
26
27 // ��һ���ӽ��
28 while (node1)
29 {
30 name = node1->tag_name();
31 text = node1->get_text();
32 acl::json_node* node2 = node1->first_child();
33 printf("\ttag: %s, value: %s\r\n",
34 name ? name : "null",
35 node2 ? "obj" : (text ? text : "null"));
36
37 if (node2 == NULL)
38 {
39 node1 = (*cit)->next_child();
40 continue;
41 }
42
43 // �ڶ����ӽ��
44 while (node2)
45 {
46 name = node2->tag_name();
47 text = node2->get_text();
48 acl::json_node* node3 = node2->first_child();
49
50 printf("\t\ttag: %s, value: %s\r\n",
51 name ? name : "null",
52 node3 ? "obj" : (text ? text : "null"));
53
54 if (node3 == NULL)
55 {
56 node2 = node1->next_child();
57 continue;
58 }
59
60 // �������ӽ��
61 while (node3)
62 {
63 name = node3->tag_name();
64 text = node3->get_text();
65 acl::json_node* node4 = node3->first_child();
66
67 printf("\t\t\ttag: %s, value: %s\r\n",
68 name ? name : "null",
69 node4 ? "obj" : (text ? text : "null"));

Callers 1

testFunction · 0.85

Calls 8

beginMethod · 0.80
get_textMethod · 0.80
endMethod · 0.45
c_strMethod · 0.45
to_stringMethod · 0.45
tag_nameMethod · 0.45
first_childMethod · 0.45
next_childMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…