From b8e7bd4aff4793f47c671fb25e61f040ac6b0f60 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Thu, 20 Aug 2009 10:37:52 -0700 Subject: [PATCH] Bug 505599 - [HTML5] GenerateNamedCharactersCpp.java should generate static member declarations for VALUES and WINDOWS_1252 as well as NAMES. r=hsivonen sr=mrbkap --- .../generator/GenerateNamedCharactersCpp.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/parser/html/java/translator/src/nu/validator/htmlparser/generator/GenerateNamedCharactersCpp.java b/parser/html/java/translator/src/nu/validator/htmlparser/generator/GenerateNamedCharactersCpp.java index 14f110e2359..ef968780c21 100644 --- a/parser/html/java/translator/src/nu/validator/htmlparser/generator/GenerateNamedCharactersCpp.java +++ b/parser/html/java/translator/src/nu/validator/htmlparser/generator/GenerateNamedCharactersCpp.java @@ -135,6 +135,14 @@ public class GenerateNamedCharactersCpp { out.close(); } + private static void writeStaticMemberDeclaration(Writer out, + CppTypes cppTypes, String type, String name) + throws IOException + { + out.write(type + " " + cppTypes.classPrefix() + "NamedCharacters::" + + name + ";\n"); + } + private static void generateCpp(File targetDirectory, CppTypes cppTypes, Map entities) throws IOException { File hFile = new File(targetDirectory, cppTypes.classPrefix() @@ -156,10 +164,17 @@ public class GenerateNamedCharactersCpp { + "NamedCharacters.h\"\n"); out.write("\n"); - out.write("" + cppTypes.arrayTemplate() + "<" + String staticMemberType = cppTypes.arrayTemplate() + "<" + cppTypes.arrayTemplate() + "<" + cppTypes.charType() + "," - + cppTypes.intType() + ">," + cppTypes.intType() + "> " - + cppTypes.classPrefix() + "NamedCharacters::NAMES;\n"); + + cppTypes.intType() + ">," + cppTypes.intType() + ">"; + writeStaticMemberDeclaration(out, cppTypes, staticMemberType, "NAMES"); + + staticMemberType = cppTypes.arrayTemplate() + "<" + + cppTypes.charType() + "," + cppTypes.intType() + ">*"; + writeStaticMemberDeclaration(out, cppTypes, staticMemberType, "VALUES"); + + staticMemberType = cppTypes.charType() + "**"; + writeStaticMemberDeclaration(out, cppTypes, staticMemberType, "WINDOWS_1252"); out.write("static " + cppTypes.charType() + " const WINDOWS_1252_DATA[] = {\n"); out.write(" 0x20AC,\n");