- cout << "Finished writing " ICU_TZ_RESOURCE ".txt" << endl;
- } else {
- cerr << "Error: Unable to open/write to " ICU_TZ_RESOURCE ".txt" << endl;
- return 1;
- }
-
-#define ICU4J_TZ_CLASS "ZoneMetaData"
-
- // Write out a Java source file containing only a few pieces of
- // meta-data missing from the core JDK: the equivalency lists and
- // the country map.
- ofstream java(ICU4J_TZ_CLASS ".java");
- if (java) {
- java << "//---------------------------------------------------------" << endl
- << "// Copyright (C) 2003";
- if (thisYear > 2003) {
- java << "-" << thisYear;
- }
- java << ", International Business Machines" << endl
- << "// Corporation and others. All Rights Reserved." << endl
- << "//---------------------------------------------------------" << endl
- << "// Build tool: tz2icu" << endl
- << "// Build date: " << asctime(now) /* << endl -- asctime emits CR */
- << "// Olson source: ftp://elsie.nci.nih.gov/pub/" << endl
- << "// Olson version: " << version << endl
- << "// ICU version: " << U_ICU_VERSION << endl
- << "//---------------------------------------------------------" << endl
- << "// >> !!! >> THIS IS A MACHINE-GENERATED FILE << !!! <<" << endl
- << "// >> !!! >>> DO NOT EDIT <<< !!! <<" << endl
- << "//---------------------------------------------------------" << endl
- << endl
- << "package com.ibm.icu.impl;" << endl
- << endl
- << "public final class " ICU4J_TZ_CLASS " {" << endl;
-
- // Emit equivalency lists
- bool first1 = true;
- java << " public static final String VERSION = \"" + version + "\";" << endl;
- java << " public static final String[][] EQUIV = {" << endl;
- for (ZoneMap::const_iterator i=ZONEINFO.begin(); i!=ZONEINFO.end(); ++i) {
- if (i->second.isAlias() || i->second.getAliases().size() == 0) {
- continue;
- }
- if (!first1) java << "," << endl;
- first1 = false;
- // The ID of this zone (the canonical zone, to which the
- // aliases point) will be sorted into the list, so it
- // won't be at position 0. If we want to know which is
- // the canonical zone, we should move it to position 0.
- java << " { ";
- bool first2 = true;
- const set<int>& s = i->second.getAliases();
- for (set<int>::const_iterator j=s.begin(); j!=s.end(); ++j) {
- if (!first2) java << ", ";
- java << '"' << zoneIDlist[*j] << '"';
- first2 = false;
- }
- java << " }";
- }
- java << endl
- << " };" << endl;
-
- // Emit country map.
- first1 = true;
- java << " public static final String[][] COUNTRY = {" << endl;
- for (map<string, set<string> >::const_iterator i=countryMap.begin();
- i != countryMap.end(); ++i) {
- if (!first1) java << "," << endl;
- first1 = false;
- string country = i->first;
- const set<string>& zones(i->second);
- java << " { \"" << country << '"';
- for (set<string>::const_iterator j=zones.begin();
- j != zones.end(); ++j) {
- java << ", \"" << *j << '"';
- }
- java << " }";
- }
- java << endl
- << " };" << endl;
-
- java << "}" << endl;
- }
-
- java.close();
-
- if (java) { // recheck error bit
- cout << "Finished writing " ICU4J_TZ_CLASS ".java" << endl;