示例#1
0
static void writeClass(std::ostream& out, const PhpClass& cls) {
  auto flags = (cls.flags() & CLASS_FLAG_MASK) | IsSystem | IsNothing;

  out << "  " << castLong(flags, true) << ", "
      << "\"" << escapeCpp(cls.name()) << "\", "
      << "\"" << escapeCpp(strtolower(cls.parent())) << "\", "
      << "\"\", "
      << castLong(0) << ", "
      << castLong(0) << ",\n";

  if (flags & HasDocComment) {
    out << "  \"" << escapeCpp(genDocComment(cls)) << "\",\n";
  }

  out << "  ";
  for (auto &iface : cls.ifaces()) {
    out << "\"" << escapeCpp(strtolower(iface)) << "\", ";
  }
  out << "NULL,\n";

  for (auto &method : cls.methods()) {
    writeFunction(out, method);
  }
  out << "  NULL,\n";

  for (auto &prop : cls.properties()) {
    auto propflag = (prop.flags() & PROP_FLAG_MASK) | IsNothing;
    if (!(propflag & VISIBILITY_MASK)) {
      propflag |= IsPublic;
    }
    out << "  " << castLong(propflag, true) << ", "
        << "\"" << escapeCpp(prop.name()) << "\", "
        << castLong((int)prop.kindOf(), true) << ",\n";
  }
  out << "  NULL,\n";

  for (auto &cns : cls.constants()) {
    writeConstant(out, cns);
  }
  out << "  NULL,\n";

  out << "  NULL,\n"; // no attributes
}
示例#2
0
static fbstring genDocComment(const PhpClass& cls) {
  return formatDocComment(
           genDocCommentPreamble(cls.name(), cls.getDesc(), cls.flags(), "")
         );
}