string is the default type in recfile, so there is no need for %type metadata for string attributes v_0 v0.11
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 07 Apr 2019 12:49:38 +0200
branchv_0
changeset 3 b0fe316e1201
parent 2 db029ce62ec5
child 4 cd81cdaa4869
string is the default type in recfile, so there is no need for %type metadata for string attributes and recfix will also stop complaining about: stdin:2: error: invalid type specification
src/RecfileHandler.h
--- a/src/RecfileHandler.h	Sat Mar 30 16:14:41 2019 +0100
+++ b/src/RecfileHandler.h	Sun Apr 07 12:49:38 2019 +0200
@@ -58,15 +58,15 @@
 		switch (type) {
 			case TypeId::BOOLEAN: return "bool";
 			case TypeId::INTEGER: return "int";
-			case TypeId::STRING: return ""; // TODO: string type?
+			case TypeId::STRING: return "";
 			default: throw RelpipeReaderException(L"Unsupported type – unable to convert to a Recfile type");
 		}
 	}
 
 	void writeAttributeMetadata(const handlers::AttributeMetadata& attribute) {
 		// FIXME: escaping/filtering
-		// FIXME: translate to recfile types
-		output << "%type: " << convertor.to_bytes(attribute.getAttributeName()) << " " << toRecfileType(attribute.getTypeId()) << std::endl;
+		std::string recfileType = toRecfileType(attribute.getTypeId());
+		if (recfileType.size()) output << "%type: " << convertor.to_bytes(attribute.getAttributeName()) << " " << recfileType << std::endl;
 	}
 
 	void writeSeparator() {