+/// EmitForwardOptionPropertyHandlingCode - Helper function used to
+/// implement EmitOptionPropertyHandlingCode(). Emits code for
+/// handling the (forward) option property.
+void EmitForwardOptionPropertyHandlingCode (const ToolOptionDescription& D,
+ std::ostream& O) {
+ switch (D.Type) {
+ case OptionType::Switch:
+ O << Indent3 << "vec.push_back(\"-" << D.Name << "\");\n";
+ break;
+ case OptionType::Parameter:
+ O << Indent3 << "vec.push_back(\"-" << D.Name << "\");\n";
+ O << Indent3 << "vec.push_back(" << D.GenVariableName() << ");\n";
+ break;
+ case OptionType::Prefix:
+ O << Indent3 << "vec.push_back(\"-" << D.Name << "\" + "
+ << D.GenVariableName() << ");\n";
+ break;
+ case OptionType::PrefixList:
+ O << Indent3 << "for (" << D.GenTypeDeclaration()
+ << "::iterator B = " << D.GenVariableName() << ".begin(),\n"
+ << Indent3 << "E = " << D.GenVariableName() << ".end(); B != E; ++B)\n"
+ << Indent4 << "vec.push_back(\"-" << D.Name << "\" + "
+ << "*B);\n";
+ break;
+ case OptionType::ParameterList:
+ O << Indent3 << "for (" << D.GenTypeDeclaration()
+ << "::iterator B = " << D.GenVariableName() << ".begin(),\n"
+ << Indent3 << "E = " << D.GenVariableName()
+ << ".end() ; B != E; ++B) {\n"
+ << Indent4 << "vec.push_back(\"-" << D.Name << "\");\n"
+ << Indent4 << "vec.push_back(*B);\n"
+ << Indent3 << "}\n";
+ break;
+ }
+}
+
+/// EmitOptionPropertyHandlingCode - Helper function used by
+/// EmitGenerateActionMethod(). Emits code that handles option
+/// properties.