Exemplo n.º 1
0
AttributePtr toAttribute(char* name,
			 int nameLen,
			 ValuePtr value)
{
  AttributePtr attribute = new Attribute();
  attribute->set_name(name, nameLen);
  attribute->set_type(value->type());
  if (value->has_scalar())
    *attribute->mutable_scalar() = *value->mutable_scalar();
  if (value->has_ranges())
    *attribute->mutable_ranges() = *value->mutable_ranges();
  if (value->has_set())
    *attribute->mutable_set() = *value->mutable_set();
  if (value->has_text())
    *attribute->mutable_text() = *value->mutable_text();
  return attribute;
}