Esempio n. 1
0
static void test(void)
{
	company com;
	com.name = "263";
	com.addr = "beijing";

	group g;

	g.name = "dev1";
	g.users.emplace_back("zsx11", 11, true);
	g.users.emplace_back("zsx12", 12, false);
	g.users.emplace_back("zsx13", 13, true);
	com.groups.emplace_back(g);

	g.name = "dev2";
	g.users.clear();
	g.users.emplace_back("zsx21", 11, true);
	g.users.emplace_back("zsx22", 12, false);
	g.users.emplace_back("zsx23", 13, true);
	com.groups.emplace_back(g);

	g.name = "dev3";
	g.users.clear();
	g.users.emplace_back("zsx31", 11, true);
	g.users.emplace_back("zsx32", 12, false);
	g.users.emplace_back("zsx33", 13, true);
	com.groups.emplace_back(g);

	g = {"dev4", {{"zsx41", 11, true}, {"zsx42", 11, true}}};
	com.groups.emplace_back(g);

	acl::json json;
	acl::json_node& node = acl::gson(json, com);

	printf("------------------------------------------------------\r\n");
	printf("node  to_string: %s\r\n", node.to_string().c_str());
	printf("------------------------------------------------------\r\n");

	company com1;
	acl::json json1;
	json1.update(node.to_string());

	printf("json1 to_string: %s\r\n", json1.to_string().c_str());
	printf("------------------------------------------------------\r\n");

	std::pair<bool, std::string> ret = acl::gson(json1.get_root(), com1);
	if (ret.first == false)
		printf("error: %s\r\n", ret.second.c_str());
	else
	{
		printf("==================== All OK ===================\r\n");
		print_company(com1);
	}
}
Esempio n. 2
0
int main(int argc, char ** argv) {

        school_t ** s = school;
		job_t ** j = jobs;
		lang_t ** l = langs;
		honor_t ** h = hon;

        puts("");
        printf("%s\n%s\n%s\n\n", name, email, address);

		puts("-Education-\n");
		while (*s) {
			print_company(*s);
			s++;
		}
 
        puts("-Employment-\n");

		while (*j) {
			print_company(*j);
			j++;
		}

		puts("-Languages-\n");

		while (*l) {
			print_blurb(*l);
			l++;
		}

		puts("\n-Honors-\n");

		while (*h) {
			print_blurb(*h);
			h++;
		}
}