src/RecfileHandler.h
branchv_0
changeset 3 b0fe316e1201
parent 2 db029ce62ec5
child 7 d59f31fa7009
equal deleted inserted replaced
2:db029ce62ec5 3:b0fe316e1201
    56 
    56 
    57 	const std::string toRecfileType(const TypeId& type) {
    57 	const std::string toRecfileType(const TypeId& type) {
    58 		switch (type) {
    58 		switch (type) {
    59 			case TypeId::BOOLEAN: return "bool";
    59 			case TypeId::BOOLEAN: return "bool";
    60 			case TypeId::INTEGER: return "int";
    60 			case TypeId::INTEGER: return "int";
    61 			case TypeId::STRING: return ""; // TODO: string type?
    61 			case TypeId::STRING: return "";
    62 			default: throw RelpipeReaderException(L"Unsupported type – unable to convert to a Recfile type");
    62 			default: throw RelpipeReaderException(L"Unsupported type – unable to convert to a Recfile type");
    63 		}
    63 		}
    64 	}
    64 	}
    65 
    65 
    66 	void writeAttributeMetadata(const handlers::AttributeMetadata& attribute) {
    66 	void writeAttributeMetadata(const handlers::AttributeMetadata& attribute) {
    67 		// FIXME: escaping/filtering
    67 		// FIXME: escaping/filtering
    68 		// FIXME: translate to recfile types
    68 		std::string recfileType = toRecfileType(attribute.getTypeId());
    69 		output << "%type: " << convertor.to_bytes(attribute.getAttributeName()) << " " << toRecfileType(attribute.getTypeId()) << std::endl;
    69 		if (recfileType.size()) output << "%type: " << convertor.to_bytes(attribute.getAttributeName()) << " " << recfileType << std::endl;
    70 	}
    70 	}
    71 
    71 
    72 	void writeSeparator() {
    72 	void writeSeparator() {
    73 		output << std::endl;
    73 		output << std::endl;
    74 	}
    74 	}