#include #include #include template class Generoi { static const unsigned SWITCH_LIMIT = 3; typedef std::map Map; typedef std::pair Pair; typedef std::vector Vector; unsigned indent; std::ostream& o; public: Generoi(const Map& kartta, std::ostream& out): indent(0), o(out) { Vector values; for(typename Map::const_iterator i = kartta.begin(); i != kartta.end(); ++i) { values.push_back(*i); } Recurse(values, 0, values.size()); } private: void Indent() { for(unsigned n=0; n SWITCH_LIMIT) || (lmax-min <= 1); StartBlock(need_angles); Recurse(values, min, lmax); EndBlock(need_angles); CompareElse(); need_angles = (max-gmin > SWITCH_LIMIT) || (max-gmin <= 0); StartBlock(need_angles); Recurse(values, gmin, max); EndBlock(need_angles); EndIf(); } }; #include int main(int argc, const char *const *argv) { std::map testi; testi[0x00C6] = "AElig"; testi[0x0386] = "Aacgr"; testi[0x00C1] = "Aacute"; testi[0x0102] = "Abreve"; testi[0x00C2] = "Acirc"; testi[0x0410] = "Acy"; testi[0x0391] = "Agr"; testi[0x00C7] = "Ccedil"; testi[0x0108] = "Ccirc"; testi[0x0402] = "DJcy"; testi[0x0112] = "Emacr"; testi[0x0118] = "Eogon"; testi[0x0395] = "Epsilon"; testi[0x0397] = "Eta"; testi[0x00CB] = "Euml"; testi[0x0424] = "Fcy"; testi[0x0403] = "GJcy"; testi[0x0393] = "Gamma"; testi[0x011E] = "Gbreve"; testi[0x0122] = "Gcedil"; testi[0x011C] = "Gcirc"; Generoi (testi, std::cout); return 0; }