Exemplo n.º 1
0
int Msg_Define::setAttr(Xml &xml, TiXmlNode *node){
	std::string type, value, comt, sub1, sub2, key;
	std::string label = xml.get_key(node);
	if(label == "arg"){
		type = trans_to_base_name(xml.get_attr_str(node, "type"));
	}
	else if(label == "struct"){
		type = trans_to_base_name(xml.get_attr_str(node, "type"));
	}
	else if(label == "vector"){
		type = trans_to_base_name(label);
		sub1 = trans_to_base_name(xml.get_attr_str(node, "type"));
	}
	else if(label == "map"){
		type = trans_to_base_name(label);
		sub1 = trans_to_base_name(xml.get_attr_str(node, "key_type"));
		sub2 = trans_to_base_name(xml.get_attr_str(node, "type"));
		key = xml.get_attr_str(node, "key_name");
		
	}
	else if(label == "unordered_map"){
		type = trans_to_base_name(label);
		sub1 = trans_to_base_name(xml.get_attr_str(node, "key_type"));
		sub2 = trans_to_base_name(xml.get_attr_str(node, "type"));
		key = xml.get_attr_str(node, "key_name");
	}
	value = xml.get_attr_str(node, "name");
	if((comt = xml.get_attr_str(node, "desc")) != "" )
		comt = "//" + comt;
	typeName_.push_back(type);
	subType1_.push_back(sub1);
	subType2_.push_back(sub2);
	keyName_.push_back(key);
	valueName_.push_back(value);
	comment_.push_back(comt);
	return 0;
}