Changeset 4154 for proto


Ignore:
Timestamp:
Sep 12, 2014, 11:45:32 AM (5 years ago)
Author:
cameron
Message:

Generate property value information using constant initializers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/charsetcompiler/UCD/UCD_properties.py

    r4153 r4154  
    6161    %s
    6262  };
    63   std::string[] property_full_name;
    64 %s
    65 
    66   std::map<std::string, property> alias_map;
    67 %s
    68 
     63  const std::string[] property_full_name = {
     64  %s
     65  };
     66  const std::unordered_map<std::string, property> alias_map = {
     67  %s
     68  };
    6969}
    7070"""
     
    8181   full_name_text = ""
    8282   for e in property_enum_name_list:
    83      full_name_text += '  property_full_name[%s] = "%s";\n' % (e, full_name_map[e])
     83     full_name_text += '  "%s",\n' % (full_name_map[e])
    8484   map_text = ""
    8585   for k in sorted(property_lookup_map.keys()):
    86      map_text += '  alias_map.insert(make_pair("%s", %s));\n' % (k, property_lookup_map[k])
     86     map_text += '  {"%s", %s},\n' % (k, property_lookup_map[k])
    8787   f.write(PropertyAliases_template % (enum_text, full_name_text, map_text))
    8888   f.close()
     
    146146
    147147
     148
     149
     150
    148151#
    149152#  UCD Property File Format 3:  codepoint -> name maps
Note: See TracChangeset for help on using the changeset viewer.