本文整理汇总了C++中AnalysisResultPtr::getOutputPath方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalysisResultPtr::getOutputPath方法的具体用法?C++ AnalysisResultPtr::getOutputPath怎么用?C++ AnalysisResultPtr::getOutputPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnalysisResultPtr
的用法示例。
在下文中一共展示了AnalysisResultPtr::getOutputPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outputCPPImpl
//.........这里部分代码省略.........
clsName);
cg_indentEnd("}\n");
}
if (classScope->needLazyStaticInitializer()) {
cg_indentBegin("GlobalVariables *%s%s::lazy_initializer("
"GlobalVariables *g) {\n", Option::ClassPrefix, clsName);
cg_indentBegin("if (!g->%s%s) {\n",
Option::ClassStaticInitializerFlagPrefix, clsName);
cg_printf("g->%s%s = true;\n", Option::ClassStaticInitializerFlagPrefix,
clsName);
cg.setContext(CodeGenerator::CppLazyStaticInitializer);
if (m_stmt) m_stmt->outputCPP(cg, ar);
cg_indentEnd("}\n");
cg_printf("return g;\n");
cg_indentEnd("}\n");
}
cg.setContext(CodeGenerator::CppImplementation);
if (m_stmt) m_stmt->outputCPP(cg, ar);
break;
case CodeGenerator::CppFFIDecl:
case CodeGenerator::CppFFIImpl:
if (m_stmt) m_stmt->outputCPP(cg, ar);
break;
case CodeGenerator::JavaFFI:
{
if (classScope->isRedeclaring()) break;
// TODO support PHP namespaces, once HPHP supports it
string packageName = Option::JavaFFIRootPackage;
string packageDir = packageName;
Util::replaceAll(packageDir, ".", "/");
string outputDir = ar->getOutputPath() + "/" + Option::FFIFilePrefix +
packageDir + "/";
Util::mkdir(outputDir);
// uses a different cg to generate a separate file for each PHP class
// also, uses the original capitalized class name
string clsFile = outputDir + getOriginalName() + ".java";
ofstream fcls(clsFile.c_str());
CodeGenerator cgCls(&fcls, CodeGenerator::FileCPP);
cgCls.setContext(CodeGenerator::JavaFFI);
cgCls.printf("package %s;\n\n", packageName.c_str());
cgCls.printf("import hphp.*;\n\n");
printSource(cgCls);
string clsModifier;
switch (m_type) {
case T_CLASS:
break;
case T_ABSTRACT:
clsModifier = "abstract ";
break;
case T_FINAL:
clsModifier = "final ";
break;
}
cgCls.printf("public %sclass %s ", clsModifier.c_str(),
getOriginalName().c_str());
ClassScopePtr parCls;
if (!m_parent.empty()) parCls = ar->findClass(m_parent);
if (!m_parent.empty() && classScope->derivesDirectlyFrom(ar, m_parent)
示例2: outputCPPImpl
//.........这里部分代码省略.........
clsName);
cg_indentEnd("}\n");
}
if (classScope->needLazyStaticInitializer()) {
cg_indentBegin("GlobalVariables *%s%s::lazy_initializer("
"GlobalVariables *g) {\n", Option::ClassPrefix, clsName);
cg_indentBegin("if (!g->%s%s) {\n",
Option::ClassStaticInitializerFlagPrefix, clsName);
cg_printf("g->%s%s = true;\n", Option::ClassStaticInitializerFlagPrefix,
clsName);
cg.setContext(CodeGenerator::CppLazyStaticInitializer);
if (m_stmt) m_stmt->outputCPP(cg, ar);
cg_indentEnd("}\n");
cg_printf("return g;\n");
cg_indentEnd("}\n");
}
cg.setContext(CodeGenerator::CppImplementation);
if (m_stmt) m_stmt->outputCPP(cg, ar);
break;
case CodeGenerator::CppFFIDecl:
case CodeGenerator::CppFFIImpl:
if (m_stmt) m_stmt->outputCPP(cg, ar);
break;
case CodeGenerator::JavaFFI:
{
if (classScope->isRedeclaring()) break;
// TODO support PHP namespaces, once HPHP supports it
string packageName = Option::JavaFFIRootPackage;
string packageDir = packageName;
Util::replaceAll(packageDir, ".", "/");
string outputDir = ar->getOutputPath() + "/" + Option::FFIFilePrefix +
packageDir + "/";
Util::mkdir(outputDir);
// uses a different cg to generate a separate file for each PHP class
// also, uses the original capitalized class name
string clsFile = outputDir + getOriginalName() + ".java";
ofstream fcls(clsFile.c_str());
CodeGenerator cgCls(&fcls, CodeGenerator::FileCPP);
cgCls.setContext(CodeGenerator::JavaFFI);
cgCls.printf("package %s;\n\n", packageName.c_str());
cgCls.printf("import hphp.*;\n\n");
printSource(cgCls);
string clsModifier;
switch (m_type) {
case T_CLASS:
break;
case T_ABSTRACT:
clsModifier = "abstract ";
break;
case T_FINAL:
clsModifier = "final ";
break;
}
cgCls.printf("public %sclass %s ", clsModifier.c_str(),
getOriginalName().c_str());
ClassScopePtr parCls;
if (!m_parent.empty()) parCls = ar->findClass(m_parent);
if (!m_parent.empty() && classScope->derivesDirectlyFrom(m_parent)
示例3: outputCPPImpl
//.........这里部分代码省略.........
cg.printDeclareGlobals();
}
cg.setContext(CodeGenerator::CppInitializer);
if (m_stmt) m_stmt->outputCPP(cg, ar);
// This is lame. Exception base class needs to prepare stacktrace
// outside of its PHP constructor. Every subclass of exception also
// needs this stacktrace, so we're adding an artificial __init__ in
// exception.php and calling it here.
if (m_name == "exception") {
cg_printf("{CountableHelper h(this); t___init__();}\n");
}
cg_indentEnd("}\n");
}
cg.setContext(CodeGenerator::CppImplementation);
if (m_stmt) m_stmt->outputCPP(cg, ar);
}
break;
case CodeGenerator::CppFFIDecl:
case CodeGenerator::CppFFIImpl:
if (m_stmt) m_stmt->outputCPP(cg, ar);
break;
case CodeGenerator::JavaFFI:
{
if (classScope->isRedeclaring()) break;
// TODO support PHP namespaces, once HPHP supports it
string packageName = Option::JavaFFIRootPackage;
string packageDir = packageName;
Util::replaceAll(packageDir, ".", "/");
string outputDir = ar->getOutputPath() + "/" + Option::FFIFilePrefix +
packageDir + "/";
Util::mkdir(outputDir);
// uses a different cg to generate a separate file for each PHP class
// also, uses the original capitalized class name
string clsFile = outputDir + getOriginalName() + ".java";
std::ofstream fcls(clsFile.c_str());
CodeGenerator cgCls(&fcls, CodeGenerator::FileCPP);
cgCls.setContext(CodeGenerator::JavaFFI);
cgCls.printf("package %s;\n\n", packageName.c_str());
cgCls.printf("import hphp.*;\n\n");
printSource(cgCls);
string clsModifier;
switch (m_type) {
case T_CLASS:
break;
case T_ABSTRACT:
clsModifier = "abstract ";
break;
case T_FINAL:
clsModifier = "final ";
break;
}
cgCls.printf("public %sclass %s ", clsModifier.c_str(),
getOriginalName().c_str());
ClassScopePtr parCls;
if (!m_parent.empty()) parCls = ar->findClass(m_parent);
if (!m_parent.empty() && classScope->derivesDirectlyFrom(m_parent)
示例4: outputCPPImpl
void InterfaceStatement::outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar) {
ClassScopeRawPtr classScope = getClassScope();
if (cg.getContext() == CodeGenerator::NoContext) {
if (classScope->isVolatile()) {
cg_printf("g->CDEC(%s) = true;\n", cg.formatLabel(m_name).c_str());
}
return;
}
string clsNameStr = classScope->getId(cg);
const char *clsName = clsNameStr.c_str();
switch (cg.getContext()) {
case CodeGenerator::CppForwardDeclaration:
if (Option::GenerateCPPMacros) {
if (!Option::UseVirtualDispatch ||
classScope->isRedeclaring()) {
cg_printf("FORWARD_DECLARE_GENERIC_INTERFACE(%s);\n", clsName);
} else {
cg_printf("FORWARD_DECLARE_INTERFACE(%s);\n", clsName);
}
}
break;
case CodeGenerator::CppDeclaration:
{
printSource(cg);
cg_printf("class %s%s", Option::ClassPrefix, clsName);
if (m_base && Option::UseVirtualDispatch &&
!classScope->isRedeclaring()) {
const char *sep = " :";
for (int i = 0; i < m_base->getCount(); i++) {
ScalarExpressionPtr exp =
dynamic_pointer_cast<ScalarExpression>((*m_base)[i]);
const char *intf = exp->getString().c_str();
ClassScopePtr intfClassScope = ar->findClass(intf);
if (intfClassScope && !intfClassScope->isRedeclaring() &&
classScope->derivesDirectlyFrom(ar, intf)) {
string id = intfClassScope->getId(cg);
cg_printf("%s public %s%s", sep, Option::ClassPrefix, id.c_str());
sep = ",";
}
}
}
cg_indentBegin(" {\n");
if (m_stmt) m_stmt->outputCPP(cg, ar);
cg_indentEnd("};\n");
}
break;
case CodeGenerator::CppImplementation:
// do nothing
break;
case CodeGenerator::CppFFIDecl:
case CodeGenerator::CppFFIImpl:
// do nothing
break;
case CodeGenerator::JavaFFI:
{
// TODO support PHP namespaces, once HPHP supports it
string packageName = Option::JavaFFIRootPackage;
string packageDir = packageName;
Util::replaceAll(packageDir, ".", "/");
string outputDir = ar->getOutputPath() + "/" + Option::FFIFilePrefix +
packageDir + "/";
Util::mkdir(outputDir);
// uses a different cg to generate a separate file for each PHP class
string clsFile = outputDir + getOriginalName() + ".java";
ofstream fcls(clsFile.c_str());
CodeGenerator cgCls(&fcls, CodeGenerator::FileCPP);
cgCls.setContext(CodeGenerator::JavaFFIInterface);
cgCls.printf("package %s;\n\n", packageName.c_str());
cgCls.printf("import hphp.*;\n\n");
cgCls.printf("public interface %s", getOriginalName().c_str());
if (m_base) {
bool first = true;
for (int i = 0; i < m_base->getCount(); i++) {
ScalarExpressionPtr exp =
dynamic_pointer_cast<ScalarExpression>((*m_base)[i]);
const char *intf = exp->getString().c_str();
ClassScopePtr intfClassScope = ar->findClass(intf);
if (intfClassScope && classScope->derivesFrom(ar, intf, false, false)
&& intfClassScope->isUserClass()) {
if (first) {
cgCls.printf(" extends ");
first = false;
}
else {
cgCls.printf(", ");
}
cgCls.printf(intfClassScope->getOriginalName().c_str());
}
}
}
cgCls.indentBegin(" {\n");
if (m_stmt) m_stmt->outputCPP(cgCls, ar);
cgCls.indentEnd("}\n");
//.........这里部分代码省略.........
示例5: outputCPPImpl
//.........这里部分代码省略.........
}
}
}
cg_indentBegin(" {\n");
if (m_stmt) m_stmt->outputCPP(cg, ar);
bool hasPropTable = classScope->checkHasPropTable(ar);
if (hasPropTable) {
cg_printf("public: static const ClassPropTable %sprop_table;\n",
Option::ObjectStaticPrefix);
}
cg_indentEnd("};\n");
if (hasPropTable) {
classScope->outputCPPGlobalTableWrappersDecl(cg, ar);
}
if (m_stmt) {
cg.setContext(CodeGenerator::CppClassConstantsDecl);
m_stmt->outputCPP(cg, ar);
cg.setContext(CodeGenerator::CppDeclaration);
}
}
break;
case CodeGenerator::CppImplementation:
{
if (m_stmt) {
cg.setContext(CodeGenerator::CppClassConstantsImpl);
m_stmt->outputCPP(cg, ar);
cg.setContext(CodeGenerator::CppImplementation);
}
cg.addClass(getClassScope()->getName(), getClassScope());
if (classScope->isRedeclaring() || classScope->checkHasPropTable(ar)) {
classScope->outputCPPGlobalTableWrappersImpl(cg, ar);
}
}
break;
case CodeGenerator::CppFFIDecl:
case CodeGenerator::CppFFIImpl:
// do nothing
break;
case CodeGenerator::JavaFFI:
{
// TODO support PHP namespaces, once HPHP supports it
string packageName = Option::JavaFFIRootPackage;
string packageDir = packageName;
Util::replaceAll(packageDir, ".", "/");
string outputDir = ar->getOutputPath() + "/" + Option::FFIFilePrefix +
packageDir + "/";
Util::mkdir(outputDir);
// uses a different cg to generate a separate file for each PHP class
string clsFile = outputDir + getOriginalName() + ".java";
std::ofstream fcls(clsFile.c_str());
CodeGenerator cgCls(&fcls, CodeGenerator::FileCPP);
cgCls.setContext(CodeGenerator::JavaFFIInterface);
cgCls.printf("package %s;\n\n", packageName.c_str());
cgCls.printf("import hphp.*;\n\n");
cgCls.printf("public interface %s", getOriginalName().c_str());
if (m_base) {
bool first = true;
for (int i = 0; i < m_base->getCount(); i++) {
ScalarExpressionPtr exp =
dynamic_pointer_cast<ScalarExpression>((*m_base)[i]);
const char *intf = exp->getString().c_str();
ClassScopePtr intfClassScope = ar->findClass(intf);
if (intfClassScope && classScope->derivesFrom(ar, intf, false, false)
&& intfClassScope->isUserClass()) {
if (first) {
cgCls.printf(" extends ");
first = false;
}
else {
cgCls.printf(", ");
}
cgCls.printf(intfClassScope->getOriginalName().c_str());
}
}
}
cgCls.indentBegin(" {\n");
if (m_stmt) m_stmt->outputCPP(cgCls, ar);
cgCls.indentEnd("}\n");
fcls.close();
}
break;
case CodeGenerator::JavaFFICppDecl:
case CodeGenerator::JavaFFICppImpl:
// do nothing
break;
default:
ASSERT(false);
break;
}
}
示例6: outputCPP
//.........这里部分代码省略.........
clsName);
cg.indentEnd("}\n");
}
if (classScope->needLazyStaticInitializer()) {
cg.indentBegin("GlobalVariables *%s%s::lazy_initializer("
"GlobalVariables *g) {\n", Option::ClassPrefix, clsName);
cg.indentBegin("if (!g->%s%s) {\n",
Option::ClassStaticInitializerFlagPrefix, clsName);
cg.printf("g->%s%s = true;\n", Option::ClassStaticInitializerFlagPrefix,
clsName);
cg.setContext(CodeGenerator::CppLazyStaticInitializer);
if (m_stmt) m_stmt->outputCPP(cg, ar);
cg.indentEnd("}\n");
cg.printf("return g;\n");
cg.indentEnd("}\n");
}
cg.setContext(CodeGenerator::CppImplementation);
if (m_stmt) m_stmt->outputCPP(cg, ar);
break;
case CodeGenerator::CppFFIDecl:
case CodeGenerator::CppFFIImpl:
if (m_stmt) m_stmt->outputCPP(cg, ar);
break;
case CodeGenerator::JavaFFI:
{
if (classScope->isRedeclaring()) break;
// TODO support PHP namespaces, once HPHP supports it
string packageName = Option::JavaFFIRootPackage;
string packageDir = packageName;
Util::replaceAll(packageDir, ".", "/");
string outputDir = ar->getOutputPath() + "/" + Option::FFIFilePrefix +
packageDir + "/";
Util::mkdir(outputDir);
// uses a different cg to generate a separate file for each PHP class
// also, uses the original capitalized class name
string clsFile = outputDir + getOriginalName() + ".java";
ofstream fcls(clsFile.c_str());
CodeGenerator cgCls(&fcls, CodeGenerator::FileCPP);
cgCls.setContext(CodeGenerator::JavaFFI);
cgCls.printf("package %s;\n\n", packageName.c_str());
cgCls.printf("import hphp.*;\n\n");
printSource(cgCls);
string clsModifier;
switch (m_type) {
case T_CLASS:
break;
case T_ABSTRACT:
clsModifier = "abstract ";
break;
case T_FINAL:
clsModifier = "final ";
break;
}
cgCls.printf("public %sclass %s ", clsModifier.c_str(),
getOriginalName().c_str());
ClassScopePtr parCls;
if (!m_parent.empty()) parCls = ar->findClass(m_parent);
if (!m_parent.empty() && classScope->derivesFrom(ar, m_parent)