| 35 | enum JavaFileType {JCLASS, JINTERFACE, JABSTRACT_CLASS, JFINAL_CLASS}; |
| 36 | |
| 37 | struct JavaName { |
| 38 | vector<string> pkg_; |
| 39 | string clazz_; |
| 40 | |
| 41 | explicit JavaName(UTL_ScopedName *name) { |
| 42 | for (UTL_ScopedName *sn(name); sn; |
| 43 | sn = static_cast<UTL_ScopedName *>(sn->tail())) { |
| 44 | string sname((sn->head()->escaped()) ? "_" : ""); |
| 45 | sname += sn->head()->get_string(); |
| 46 | |
| 47 | if (!sname.empty()) { |
| 48 | if (sn->tail()) pkg_.push_back(sname); |
| 49 | |
| 50 | else clazz_ = sname; |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | JavaName(const JavaName& base, const char *suffix, bool escape = false) |
| 56 | : pkg_(base.pkg_) |
| 57 | , clazz_(base.clazz_) { |
| 58 | clazz_ += suffix; |
| 59 | size_t zero = 0; //explicit type to avoid SunCC thinking this is a char* |
| 60 | |
| 61 | if (escape) clazz_.insert(zero, 1, '_'); |
| 62 | } |
| 63 | }; |
| 64 | |
| 65 | struct concat { |
| 66 | concat(string &str, char sep) : str_(str), sep_(sep) {} |