Add cppumaker -nD "no dependent types are generated"

...just like javamaker.

Change-Id: I7634a65a948ca7abdb7ad75d0aeca8becb38ab87
This commit is contained in:
Stephan Bergmann 2013-09-12 15:28:11 +02:00
parent 6667caef24
commit 54dd4ae0dd
3 changed files with 33 additions and 13 deletions

View file

@ -78,13 +78,19 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
} else {
produce("", typeMgr, generated, options);
}
// C++ header files generated for the following UNO types are included
// in header files in cppu/inc/com/sun/star/uno (Any.hxx, Reference.hxx,
// Type.h), so it seems best to always generate those C++ header files:
produce(
"com.sun.star.uno.RuntimeException", typeMgr, generated, options);
produce("com.sun.star.uno.TypeClass", typeMgr, generated, options);
produce("com.sun.star.uno.XInterface", typeMgr, generated, options);
if (!options.isValid("-nD")) {
// C++ header files generated for the following UNO types are
// included in header files in cppu/inc/com/sun/star/uno (Any.hxx,
// Reference.hxx, Type.h), so it seems best to always generate those
// C++ header files:
produce(
"com.sun.star.uno.RuntimeException", typeMgr, generated,
options);
produce(
"com.sun.star.uno.TypeClass", typeMgr, generated, options);
produce(
"com.sun.star.uno.XInterface", typeMgr, generated, options);
}
} catch (CannotDumpException & e) {
std::cerr << "ERROR: " << e.getMessage() << '\n';
return EXIT_FAILURE;

View file

@ -94,6 +94,16 @@ sal_Bool CppuOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile)
m_options["-O"] = OString(s);
break;
case 'n':
if (av[i][2] != 'D' || av[i][3] != '\0')
{
OString tmp("'-nD', please check");
tmp += " your input '" + OString(av[i]) + "'";
throw IllegalArgument(tmp);
}
m_options["-nD"] = OString("");
break;
case 'T':
if (av[i][2] == '\0')
{
@ -321,6 +331,7 @@ OString CppuOptions::prepareHelp()
help += " '-L' should be the default for external components.\n";
help += " -C = UNO type functions are generated comprehensive that means all\n";
help += " necessary information is available for bridging the type in UNO.\n";
help += " -nD = no dependent types are generated.\n";
help += " -G = generate only target files which does not exists.\n";
help += " -Gc = generate only target files which content will be changed.\n";
help += " -X<file> = extra types which will not be taken into account for generation.\n\n";

View file

@ -409,12 +409,15 @@ void CppuType::dumpFile(
void CppuType::dumpDependedTypes(
codemaker::GeneratedTypeSet & generated, CppuOptions const & options)
{
codemaker::cppumaker::Dependencies::Map const & map
= m_dependencies.getMap();
for (codemaker::cppumaker::Dependencies::Map::const_iterator i(map.begin());
i != map.end(); ++i)
{
produce(i->first, m_typeMgr, generated, options);
if (!options.isValid("-nD")) {
codemaker::cppumaker::Dependencies::Map const & map
= m_dependencies.getMap();
for (codemaker::cppumaker::Dependencies::Map::const_iterator i(
map.begin());
i != map.end(); ++i)
{
produce(i->first, m_typeMgr, generated, options);
}
}
}