String RichPara::Number::AsText(const RichPara::NumberFormat& format) const { String result; for(int i = 0; i < 8; i++) if(format.number[i]) { if(result.GetLength()) result.Cat('.'); int q = n[i]; switch(format.number[i]) { case NUMBER_1: result << AsString(q); break; case NUMBER_0: result << AsString(q - 1); break; case NUMBER_a: result << FormatIntAlpha(q, false); break; case NUMBER_A: result << FormatIntAlpha(q, true); break; case NUMBER_i: result << FormatIntRoman(q, false); break; case NUMBER_I: result << FormatIntRoman(q, true); break; } } return format.before_number + result + format.after_number; }
String DocDir::GetAddFileName(const String& package, const DocKey& key, int type) { Entry& w = dir.GetAdd(package).GetAdd(key); String& fn = w.text; w.type = type; if(!IsEmpty(fn)) return fn; String nm = key.nameing + '_' + key.nesting + '_' + key.item; String n; const char *s = nm; while(*s && n.GetLength() < 30) if(iscid(*s)) n.Cat(*s++); else { n.Cat('_'); while(*s && !iscid(*s)) s++; } n << '_' << LNGAsText(key.lang); int i = 0; for(;;) { fn = n + FormatIntAlpha(i) + ".dpp"; if(!FindFile(DocFile(package, fn))) return fn; i++; } }