示例#1
0
int main(int argc, char ** argv)
{
  int port_index;
  
  if (argc == 2)
    port_index = 1;
  else if (argc == 3) {
    if (argv[1][1] == 'v')
      set_verbose();
    else
      set_preserve();
    port_index = 2;
  }
  else if (argc == 4) {
    set_verbose();
    set_preserve();
    port_index = 3;
  }
  else
    return 0;
  
  if (UmlCom::connect(QCString(argv[port_index]).toUInt())) {
    try {
      UmlCom::trace("<b>Php generator</b> release 1.10.1<br>");
      UmlCom::traceAutoRaise(FALSE);
      
      UmlCom::targetItem()->generate();
      
      QCString s;
      
      s.sprintf("<hr><font face=helvetica>Generation done : %d warnings, %d errors</font><br>",
		n_warnings(), n_errors());
      UmlCom::trace(s);

      UmlCom::showTrace();
      UmlCom::message("");
    
      UmlCom::bye(n_errors());
    }
    catch (...) {
    }
  }
  
  UmlCom::close();
  return 0;
}
示例#2
0
文件: main.cpp 项目: harmegnies/douml
int main(int argc, char ** argv)
{
    int port_index;

    if (argc == 2)
        port_index = 1;
    else if (argc == 3) {
        if (argv[1][1] == 'v')
            set_verbose();
        else
            set_preserve();

        port_index = 2;
    }
    else if (argc == 4) {
        set_verbose();
        set_preserve();
        port_index = 3;
    }
    else
        return 0;

    if (UmlCom::connect(WrapperStr(argv[port_index]).operator QString().toUInt())) {
        try {
            UmlCom::trace("<b>Java generator</b> release 2.22<br>");
            UmlCom::traceAutoRaise(FALSE);

            UmlCom::targetItem()->generate();

            QString s("<hr><font face=helvetica>Generation done : %1 warnings, %2 errors</font><br>");
            s=s.arg(QString::number(n_warnings())).arg(QString::number(n_errors()));
            UmlCom::trace(s);

            UmlCom::showTrace();
            UmlCom::message("");

            UmlCom::bye(n_errors());
        }
        catch (...) {
        }
    }

    UmlCom::close();
    return 0;
}
示例#3
0
int main(int argc, char ** argv)
{
#ifdef DEBUG
    QsLogging::Logger & logger = QsLogging::Logger::instance();
    logger.setLoggingLevel(QsLogging::TraceLevel);
    QDir dir;
    dir.setPath(qApp->applicationDirPath());
    dir.remove(QString("cpp_utils") + QString(".log"));
    const QString sLogPath(QDir(qApp->applicationDirPath()).filePath(QString("cpp_generator") + QString(".log")));
    QsLogging::DestinationPtr fileDestination(QsLogging::DestinationFactory::MakeFileDestination(sLogPath));
    QsLogging::DestinationPtr debugDestination(QsLogging::DestinationFactory::MakeDebugOutputDestination());
    logger.addDestination(debugDestination.get());
    logger.addDestination(fileDestination.get());

    QSettings settings(QSettings::IniFormat, QSettings::UserScope, "DoUML", "settings");
    settings.setIniCodec(QTextCodec::codecForName("UTF-8"));
    QString locale = settings.value("Main/encoding").toString();
    QTextCodec* codec = QTextCodec::codecForName(locale.toLatin1().constData());
    QTextCodec::setCodecForLocale(codec);

    QLOG_INFO() << " STARTING CPP_GENERATOR";

#endif
    //QTest::qSleep(7000);
    int port_index;
#ifndef _RUN_PLUGOUT_EXTERNAL_
    if (argc == 2) {
        port_index = 1;
        QLOG_INFO() << "Got two arguments from Douml as argv";
        QLOG_INFO() << "Using first port index mode";
    }
    else if (argc == 3) {
        QLOG_INFO() << "Got three arguments from Douml as argv";
        if (argv[1][1] == 'v') {
            QLOG_INFO() << "Using verbose mode";
            set_verbose();
        }
        else {
            QLOG_INFO() << "Using preserve mode";
            set_preserve();
        }
        QLOG_INFO() << "Using second port index mode";
        port_index = 2;
    }
    else if (argc == 4) {
        QLOG_INFO() << "Got four arguments from Douml as argv";
        QLOG_INFO() << "Using preserve mode";
        QLOG_INFO() << "Using verbose mode";
        QLOG_INFO() << "Using third port index mode";
        set_verbose();
        set_preserve();
        port_index = 3;
    }
    else {
        QLOG_INFO() << "Got too little or too much arguments from Douml, exiting";
        return 0;
    }
    if (UmlCom::connect(QString(argv[port_index]).toUInt())) {
#else
    port_index = 1;
    if (UmlCom::connect(5000)) {
#endif
        try {

            UmlCom::trace("<b>C++ generator</b> release 2.18<br>");
            UmlCom::traceAutoRaise(FALSE);
            UmlCom::targetItem()->generate();

            QString s;

            s = "<hr><font face=helvetica>Generation done : %1 warnings, %2 errors</font><br>";
            s=s.arg(QString::number(n_warnings())).arg(QString::number(n_errors()));

            UmlCom::trace(s.toLatin1().constData());

            UmlCom::showTrace();
            UmlCom::message("");

            UmlCom::bye(n_errors());
        }
        catch (...) {
            QLOG_INFO() << "unhandled exception caught";
        }
    }

    UmlCom::close();
    return 0;
}