• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ HelpMessage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中HelpMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ HelpMessage函数的具体用法?C++ HelpMessage怎么用?C++ HelpMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了HelpMessage函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: AppInit

//////////////////////////////////////////////////////////////////////////////
//
// Start
//
bool AppInit(int argc, char* argv[])
{
    boost::thread_group threadGroup;
    CScheduler scheduler;

    bool fRet = false;

    //
    // Parameters
    //
    // If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
    ParseParameters(argc, argv);

    // Process help and version before taking care about datadir
    if (mapArgs.count("-?") || mapArgs.count("-h") ||  mapArgs.count("-help") || mapArgs.count("-version"))
    {
        std::string strUsage = strprintf(_("%s Daemon"), _(PACKAGE_NAME)) + " " + _("version") + " " + FormatFullVersion() + "\n";

        if (mapArgs.count("-version"))
        {
            strUsage += FormatParagraph(LicenseInfo());
        }
        else
        {
            strUsage += "\n" + _("Usage:") + "\n" +
                  "  bitcoind [options]                     " + strprintf(_("Start %s Daemon"), _(PACKAGE_NAME)) + "\n";

            strUsage += "\n" + HelpMessage(HMM_BITCOIND);
        }

        fprintf(stdout, "%s", strUsage.c_str());
        return false;
    }

    try
    {
        if (!boost::filesystem::is_directory(GetDataDir(false)))
        {
            fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
            return false;
        }
        try
        {
            ReadConfigFile(mapArgs, mapMultiArgs);
        } catch (const std::exception& e) {
            fprintf(stderr,"Error reading configuration file: %s\n", e.what());
            return false;
        }
        // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
        try {
            SelectParams(ChainNameFromCommandLine());
        } catch (const std::exception& e) {
            fprintf(stderr, "Error: %s\n", e.what());
            return false;
        }

        // Command-line RPC
        bool fCommandLine = false;
        for (int i = 1; i < argc; i++)
            if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "bitcoin:"))
                fCommandLine = true;

        if (fCommandLine)
        {
            fprintf(stderr, "Error: There is no RPC client functionality in bitcoind anymore. Use the bitcoin-cli utility instead.\n");
            exit(1);
        }
#ifndef WIN32
        fDaemon = GetBoolArg("-daemon", false);
        if (fDaemon)
        {
            fprintf(stdout, "Bitcoin server starting\n");

            // Daemonize
            pid_t pid = fork();
            if (pid < 0)
            {
                fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
                return false;
            }
            if (pid > 0) // Parent process, pid is child process id
            {
                return true;
            }
            // Child process falls through to rest of initialization

            pid_t sid = setsid();
            if (sid < 0)
                fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno);
        }
#endif
        SoftSetBoolArg("-server", true);

        // Set this early so that parameter interactions go to console
        InitLogging();
        InitParameterInteraction();
//.........这里部分代码省略.........
开发者ID:1000000000001,项目名称:bitcoin,代码行数:101,代码来源:bitcoind.cpp


示例2: QDialog

/** "Help message" or "About" dialog box */
HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
    QDialog(parent),
    ui(new Ui::HelpMessageDialog)
{
    ui->setupUi(this);

    QString version = tr("CryptoMailCoin Core") + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion());
    /* On x86 add a bit specifier to the version so that users can distinguish between
     * 32 and 64 bit builds. On other architectures, 32/64 bit may be more ambigious.
     */
#if defined(__x86_64__)
    version += " " + tr("(%1-bit)").arg(64);
#elif defined(__i386__ )
    version += " " + tr("(%1-bit)").arg(32);
#endif

    if (about)
    {
        setWindowTitle(tr("About CryptoMailCoin Core"));

        /// HTML-format the license message from the core
        QString licenseInfo = QString::fromStdString(LicenseInfo());
        QString licenseInfoHTML = licenseInfo;
        // Make URLs clickable
        QRegExp uri("<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2);
        uri.setMinimal(true); // use non-greedy matching
        licenseInfoHTML.replace(uri, "<a href=\"\\1\">\\1</a>");
        // Replace newlines with HTML breaks
        licenseInfoHTML.replace("\n\n", "<br><br>");

        ui->aboutMessage->setTextFormat(Qt::RichText);
        ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
        text = version + "\n" + licenseInfo;
        ui->aboutMessage->setText(version + "<br><br>" + licenseInfoHTML);
        ui->aboutMessage->setWordWrap(true);
        ui->helpMessage->setVisible(false);
    } else {
        setWindowTitle(tr("Command-line options"));
        QString header = tr("Usage:") + "\n" +
            "  cryptomailcoin-qt [" + tr("command-line options") + "]                     " + "\n";
        QTextCursor cursor(ui->helpMessage->document());
        cursor.insertText(version);
        cursor.insertBlock();
        cursor.insertText(header);
        cursor.insertBlock();

        QString coreOptions = QString::fromStdString(HelpMessage(HMM_CRYPTOMAILCOIN_QT));
        text = version + "\n" + header + "\n" + coreOptions;

        QTextTableFormat tf;
        tf.setBorderStyle(QTextFrameFormat::BorderStyle_None);
        tf.setCellPadding(2);
        QVector<QTextLength> widths;
        widths << QTextLength(QTextLength::PercentageLength, 35);
        widths << QTextLength(QTextLength::PercentageLength, 65);
        tf.setColumnWidthConstraints(widths);

        QTextCharFormat bold;
        bold.setFontWeight(QFont::Bold);

        Q_FOREACH (const QString &line, coreOptions.split("\n")) {
            if (line.startsWith("  -"))
            {
                cursor.currentTable()->appendRows(1);
                cursor.movePosition(QTextCursor::PreviousCell);
                cursor.movePosition(QTextCursor::NextRow);
                cursor.insertText(line.trimmed());
                cursor.movePosition(QTextCursor::NextCell);
            } else if (line.startsWith("   ")) {
                cursor.insertText(line.trimmed()+' ');
            } else if (line.size() > 0) {
                //Title of a group
                if (cursor.currentTable())
                    cursor.currentTable()->appendRows(1);
                cursor.movePosition(QTextCursor::Down);
                cursor.insertText(line.trimmed(), bold);
                cursor.insertTable(1, 2, tf);
            }
        }

        ui->helpMessage->moveCursor(QTextCursor::Start);
        ui->scrollArea->setVisible(false);
        ui->aboutLogo->setVisible(false);
    }
}
开发者ID:sudosurootdev,项目名称:CryptoMailCoin,代码行数:86,代码来源:utilitydialog.cpp


示例3: AppInit

//////////////////////////////////////////////////////////////////////////////
//
// Start
//
bool AppInit(int argc, char* argv[])
{
    boost::thread_group threadGroup;
    boost::thread* detectShutdownThread = NULL;

    bool fRet = false;

    //
    // Parameters
    //
    // If Qt is used, parameters/darknet.conf are parsed in qt/darknet.cpp's main()
    ParseParameters(argc, argv);

    // Process help and version before taking care about datadir
    if (mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version"))
    {
        std::string strUsage = _("Darknet Core Daemon") + " " + _("version") + " " + FormatFullVersion() + "\n";

        if (mapArgs.count("-version"))
        {
            strUsage += LicenseInfo();
        }
        else
        {
            strUsage += "\n" + _("Usage:") + "\n" +
                  "  darknetd [options]                     " + _("Start Darknet Core Daemon") + "\n";

            strUsage += "\n" + HelpMessage(HMM_BITCOIND);
        }

        fprintf(stdout, "%s", strUsage.c_str());
        return false;
    }

    try
    {
        if (!boost::filesystem::is_directory(GetDataDir(false)))
        {
            fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
            return false;
        }
        try
        {
            ReadConfigFile(mapArgs, mapMultiArgs);
        } catch(std::exception &e) {
            fprintf(stderr,"Error reading configuration file: %s\n", e.what());
            return false;
        }
        // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
        if (!SelectParamsFromCommandLine()) {
            fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n");
            return false;
        }

        // parse masternode.conf
        std::string strErr;
        if(!masternodeConfig.read(strErr)) {
            fprintf(stderr,"Error reading masternode configuration file: %s\n", strErr.c_str());
            return false;
        }

        // Command-line RPC
        bool fCommandLine = false;
        for (int i = 1; i < argc; i++)
            if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "darknet:"))
                fCommandLine = true;

        if (fCommandLine)
        {
            fprintf(stderr, "Error: There is no RPC client functionality in darknetd anymore. Use the darknet-cli utility instead.\n");
            exit(1);
        }
#ifndef WIN32
        fDaemon = GetBoolArg("-daemon", false);
        if (fDaemon)
        {
            fprintf(stdout, "DarkNet server starting\n");

            // Daemonize
            pid_t pid = fork();
            if (pid < 0)
            {
                fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
                return false;
            }
            if (pid > 0) // Parent process, pid is child process id
            {
                return true;
            }
            // Child process falls through to rest of initialization

            pid_t sid = setsid();
            if (sid < 0)
                fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno);
        }
#endif
//.........这里部分代码省略.........
开发者ID:Darknet-Crypto,项目名称:Darknet,代码行数:101,代码来源:darknetd.cpp


示例4: AslCommandLine


//.........这里部分代码省略.........
        }

        Gbl_DisasmFlag = TRUE;
        break;


    case 'e':
        Gbl_ExternalFilename = AcpiGbl_Optarg;
        break;


    case 'f':

        /* Ignore errors and force creation of aml file */

        Gbl_IgnoreErrors = TRUE;
        break;


    case 'g':

        /* Get all ACPI tables */

        Gbl_GetAllTables = TRUE;
        Gbl_DoCompile = FALSE;
        break;


    case 'h':

        switch (AcpiGbl_Optarg[0])
        {
        case '^':
            HelpMessage ();
            exit (0);

        case 'c':
            UtDisplayConstantOpcodes ();
            exit (0);

        case 'r':
            /* reserved names */

            MpDisplayReservedNames ();
            exit (0);

        default:
            printf ("Unknown option: -h%s\n", AcpiGbl_Optarg);
            BadCommandLine = TRUE;
            break;
        }
        break;


    case 'i':

        switch (AcpiGbl_Optarg[0])
        {
        case 'a':

            /* Produce assembly code include file */

            Gbl_AsmIncludeOutputFlag = TRUE;
            break;

        case 'c':
开发者ID:samueldotj,项目名称:AceOS,代码行数:67,代码来源:aslmain.c


示例5: main

   ############################################################################################################################ */

int main (int argc, char **argv)
{

/* **************************************************************************************************************************** */

 	/* Pointeurs vers l'application */
	glutInit(&argc, argv);         

  	/*  Activation des buffers :   
     	Double buffer 
     	RGBA color
     	Depth buffer */               
	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); 

  	/* Création de la fenêtre */
	glutInitWindowSize(1024, 768);

	/* Positionnement de la fenêtre */
	glutInitWindowPosition(100, 100);

	/* Ouverture de la fenêtre */  
	glutCreateWindow("TD_Animation_3D");

	/* Spécification de la fontion de dessin */
	glutDisplayFunc(display);

  	/* Spécification de la fontion de redimensionnement */
	glutReshapeFunc(reshape);

  	/* Spécification des fontions de gestion du clavier */
	glutKeyboardFunc(keyboardDown);
	glutKeyboardUpFunc(keyboardUp);
	glutSpecialFunc(keyboardSpecDown);
	glutSpecialUpFunc(keyboardSpecUp);

 	/* Spécification des fontions de gestion de la souris */
	glutMouseFunc(mouse);
	glutMotionFunc(motion);

 	/* Spécification de la fonction de mise-à-jour */
	glutIdleFunc(timeTick);

/* **************************************************************************************************************************** */

	/* Affichage des fonctions clavier */
	HelpMessage();

/* **************************************************************************************************************************** */

	/* Intitialisation des paramètres de l'affichage et de la fenêtre */
	GLInit();

	/* Intitialisation des paramètres du squelette */ 
	SkeletInit();

	/* Intitialisation de la scène cinématique */
	IKInit();

/* **************************************************************************************************************************** */

  	/* Lancement de la boucle OpenGL */  
	glutMainLoop();

/* **************************************************************************************************************************** */

	return 0;
开发者ID:NassimAMGHAR,项目名称:Interactive,代码行数:68,代码来源:TD_animation_3D.cpp


示例6: AslDoOptions


//.........这里部分代码省略.........
        }

        Gbl_DisasmFlag = TRUE;
        break;


    case 'e':
        Gbl_ExternalFilename = AcpiGbl_Optarg;
        break;


    case 'f':

        /* Ignore errors and force creation of aml file */

        Gbl_IgnoreErrors = TRUE;
        break;


    case 'g':

        /* Get all ACPI tables */

        Gbl_GetAllTables = TRUE;
        Gbl_DoCompile = FALSE;
        break;


    case 'h':

        switch (AcpiGbl_Optarg[0])
        {
        case '^':
            HelpMessage ();
            exit (0);

        case 'c':
            UtDisplayConstantOpcodes ();
            exit (0);

        case 'r':
            /* reserved names */

            ApDisplayReservedNames ();
            exit (0);

        default:
            printf ("Unknown option: -h%s\n", AcpiGbl_Optarg);
            return (-1);
        }
        break;


    case 'I': /* Add an include file search directory */

        FlAddIncludeDirectory (AcpiGbl_Optarg);
        break;


    case 'i':

        switch (AcpiGbl_Optarg[0])
        {
        case 'a':

            /* Produce assembly code include file */
开发者ID:luciang,项目名称:haiku,代码行数:67,代码来源:aslmain.c


示例7: QDialog

/** "Help message" or "About" dialog box */
HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
    QDialog(parent),
    ui(new Ui::HelpMessageDialog)
{
    ui->setupUi(this);
    this->setWindowModality(Qt::NonModal);
            
    GUIUtil::restoreWindowGeometry("nHelpMessageDialogWindow", this->size(), this);

    QString version = tr("Bitcredit Core") + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion());
    /* On x86 add a bit specifier to the version so that users can distinguish between
     * 32 and 64 bit builds. On other architectures, 32/64 bit may be more ambigious.
     */
#if defined(__x86_64__)
    version += " " + tr("(%1-bit)").arg(64);
#elif defined(__i386__ )
    version += " " + tr("(%1-bit)").arg(32);
#endif

    if (about)
    {
        setWindowTitle(tr("About Bitcredit Core"));

        /// HTML-format the license message from the core
        QString licenseInfo = QString::fromStdString(LicenseInfo());
        QString licenseInfoHTML = licenseInfo;
        // Make URLs clickable
        QRegExp uri("<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2);
        uri.setMinimal(true); // use non-greedy matching
        licenseInfoHTML.replace(uri, "<a href=\"\\1\">\\1</a>");
        // Replace newlines with HTML breaks
        licenseInfoHTML.replace("\n\n", "<br><br>");

        //ui->helpMessage->setTextFormat(Qt::RichText);
        //ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
        text = version + "\n" + licenseInfo;
        ui->helpMessage->setText(version + "<br><br>" + licenseInfoHTML);
        //ui->helpMessage->setWordWrap(true);
        
        connect(ui->pushButtonBCT, SIGNAL(clicked()), this, SLOT(BCT()));
        connect(ui->pushButtonForum, SIGNAL(clicked()), this, SLOT(Forum()));
        connect(ui->pushButtonWiki, SIGNAL(clicked()), this, SLOT(Wiki()));
        connect(ui->pushButtonExplorer, SIGNAL(clicked()), this, SLOT(Explorer()));
       
        
        
        
    } else {
        setWindowTitle(tr("Command-line options"));
        QString header = tr("Usage:") + "\n" +
            "  bitcredit-qt [" + tr("command-line options") + "]                     " + "\n";

        QString coreOptions = QString::fromStdString(HelpMessage(HMM_BITCREDIT_QT));

        QString uiOptions = tr("UI options") + ":\n" +
            "  -choosedatadir            " + tr("Choose data directory on startup (default: 0)") + "\n" +
            "  -lang=<lang>              " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" +
            "  -min                      " + tr("Start minimized") + "\n" +
            "  -rootcertificates=<file>  " + tr("Set SSL root certificates for payment request (default: -system-)") + "\n" +
            "  -splash                   " + tr("Show splash screen on startup (default: 1)");

        ui->helpMessage->setFont(GUIUtil::bitcreditAddressFont());
        text = version + "\n" + header + "\n" + coreOptions + "\n" + uiOptions;
        ui->helpMessage->setText(text);
    }
}
开发者ID:zebbra2014,项目名称:bitcredit,代码行数:67,代码来源:utilitydialog.cpp


示例8: AppInit

//////////////////////////////////////////////////////////////////////////////
//
// Start
//
bool AppInit(int argc, char* argv[])
{
    boost::thread_group threadGroup;
    boost::thread* detectShutdownThread = NULL;

    bool fRet = false;
    try
    {
        //
        // Parameters
        //
        // If Qt is used, parameters/tinege.conf are parsed in qt/bitcoin.cpp's main()
        ParseParameters(argc, argv);
        if (!boost::filesystem::is_directory(GetDataDir(false)))
        {
            fprintf(stderr, "Error: Specified directory does not exist\n");
            Shutdown();
        }
        ReadConfigFile(mapArgs, mapMultiArgs);

        if (mapArgs.count("-?") || mapArgs.count("--help"))
        {
            // First part of help message is specific to tineged / RPC client
            std::string strUsage = _("Tinege version") + " " + FormatFullVersion() + "\n\n" +
                _("Usage:") + "\n" +
                  "  tineged [options]                     " + "\n" +
                  "  tineged [options] <command> [params]  " + _("Send command to -server or tineged") + "\n" +
                  "  tineged [options] help                " + _("List commands") + "\n" +
                  "  tineged [options] help <command>      " + _("Get help for a command") + "\n";

            strUsage += "\n" + HelpMessage();

            fprintf(stdout, "%s", strUsage.c_str());
            return false;
        }

        // Command-line RPC
        for (int i = 1; i < argc; i++)
            if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "tinege:"))
                fCommandLine = true;

        if (fCommandLine)
        {
            if (!SelectParamsFromCommandLine()) {
                fprintf(stderr, "Error: invalid combination of -regtest and -testnet.\n");
                return false;
            }
            int ret = CommandLineRPC(argc, argv);
            exit(ret);
        }
#if !defined(WIN32)
        fDaemon = GetBoolArg("-daemon", false);
        if (fDaemon)
        {
            // Daemonize
            pid_t pid = fork();
            if (pid < 0)
            {
                fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
                return false;
            }
            if (pid > 0) // Parent process, pid is child process id
            {
                CreatePidFile(GetPidFile(), pid);
                return true;
            }
            // Child process falls through to rest of initialization

            pid_t sid = setsid();
            if (sid < 0)
                fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno);
        }
#endif

        detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup));
        fRet = AppInit2(threadGroup);
    }
    catch (std::exception& e) {
        PrintExceptionContinue(&e, "AppInit()");
    } catch (...) {
        PrintExceptionContinue(NULL, "AppInit()");
    }
    if (!fRet) {
        if (detectShutdownThread)
            detectShutdownThread->interrupt();
        threadGroup.interrupt_all();
    }

    if (detectShutdownThread)
    {
        detectShutdownThread->join();
        delete detectShutdownThread;
        detectShutdownThread = NULL;
    }
    Shutdown();

//.........这里部分代码省略.........
开发者ID:Tinege,项目名称:Tinege,代码行数:101,代码来源:bitcoind.cpp


示例9: ProcessArgs


//.........这里部分代码省略.........
	  return 0;
	}
	has_dash_arg = 1;
	trim_leading_char << dash_arg;
	InsertEscapeSeq(trim_leading_char);
      }

      if(dash_option == "TrimTrailing") {
	if(dash_option.is_null()) {
	  GXSTD::cerr << "\n";
	  GXSTD::cerr << "Error you must supply a string with the --TrimTrialing argument" 
		      << "\n";
	  GXSTD::cerr << "Exiting..." << "\n";
	  GXSTD::cerr << "\n";
	  return 0;
	}
	has_dash_arg = 1;


	trim_trailing_char << dash_arg;
	InsertEscapeSeq(trim_trailing_char);
      }

      if(dash_option == "ReplaceSection") {
	replace_section = 1;
	has_dash_arg = 1;
	if(!dash_arg.is_null()) {
	  replace_file_name = dash_arg;
	  if(!replace_file_name.is_null()) {
	    infile.df_Open(replace_file_name.c_str());
	    if(infile.df_CheckError()) {
	      GXSTD::cerr << "\n";
	      GXSTD::cerr << "Error opening replace section file " << replace_file_name.c_str() << "\n";
	      GXSTD::cerr << "Exiting..." << "\n";
	      GXSTD::cerr << "\n";
	      return 0;
	    }
	    string_to_replace.Clear();
	    while(!infile.df_EOF()) {
	      memset(line_buf, 0, sizeof(line_buf));
	      infile.df_Read(line_buf, sizeof(line_buf));
	      if(infile.df_GetError() != DiskFileB::df_NO_ERROR) {
		if(infile.df_GetError() != DiskFileB::df_EOF_ERROR) {
		  GXSTD::cerr << "Error reading from the text file" << "\n";
		  GXSTD::cerr << infile.df_ExceptionMessage() << "\n";
		  GXSTD::cerr << "\n";
		  GXSTD::cerr << "Error reading replace section file " << replace_file_name.c_str() << "\n";
		  GXSTD::cerr << "Exiting..." << "\n";
		  GXSTD::cerr << "\n";
		}
	      }
	      string_to_replace.Cat(line_buf, infile.df_gcount());
	    } 
	    infile.df_Close();
	    string_to_replace.ReplaceString("\r\n", "\n");
	    InsertEscapeSeq(string_to_replace);
	  }
	}
      }

      if(dash_arg == "version") {
	VersionMessage();
	return 0;
      }

      if(dash_arg == "help") {
	HelpMessage();
	return 0;
      }

      if(dash_arg == "ReplaceOnce") {
	replace_once = 1;
	has_dash_arg = 1;
      }

      if(dash_arg == "NoEscapeSeq") {
	no_escape_seq = 1;
	has_dash_arg = 1;
      }

      if(!has_dash_arg) {
	GXSTD::cerr << "\n";
	GXSTD::cerr << "Invalid option and -- argument " << "\n";
	GXSTD::cerr << arg << "\n";
	GXSTD::cerr << "Exiting..." << "\n";
	GXSTD::cerr << "\n";
	return 0;
      }
      break;

    default:
      GXSTD::cerr << "\n";
      GXSTD::cerr << "Unknown switch " << arg << "\n";
      GXSTD::cerr << "Exiting..." << "\n";
      GXSTD::cerr << "\n";
      return 0;
  }
  arg[0] = '\0';
  return 1; // All command line arguments were valid
}
开发者ID:datareel,项目名称:datareel,代码行数:101,代码来源:ffind.cpp


示例10: AppInit

//////////////////////////////////////////////////////////////////////////////
//
// Start
//
bool AppInit(int argc, char *argv[])
{
    shutdown_threads.store(false);
    thread_group threadGroup(&shutdown_threads);

    bool fRet = false;

    //
    // Parameters
    //
    gArgs.ParseParameters(argc, argv);

    // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
    try
    {
        CheckParams(ChainNameFromCommandLine());
    }
    catch (const std::exception &e)
    {
        fprintf(stderr, "Error: %s\n", e.what());
        return false;
    }
    try
    {
        gArgs.ReadConfigFile();
    }
    catch (const std::exception &e)
    {
        fprintf(stderr, "Error reading configuration file: %s\n", e.what());
        return false;
    }

    GenerateNetworkTemplates();

    // Process help and version before taking care about datadir
    if (gArgs.IsArgSet("-?") || gArgs.IsArgSet("-h") || gArgs.IsArgSet("-help") || gArgs.IsArgSet("-version"))
    {
        std::string strUsage = "Eccoind version " + FormatFullVersion() + "\n";

        if (gArgs.IsArgSet("-version"))
        {
            strUsage += LicenseInfo();
        }
        else
        {
            strUsage += "\nUsage:\neccoind [options]                     Start Eccoind\n";

            strUsage += "\n" + HelpMessage();
        }

        fprintf(stdout, "%s", strUsage.c_str());
        return false;
    }

    try
    {
        if (!fs::is_directory(GetDataDir(false)))
        {
            fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n",
                gArgs.GetArg("-datadir", "").c_str());
            return false;
        }
        // Command-line RPC
        bool fCommandLine = false;
        for (int i = 1; i < argc; i++)
        {
            if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "ECC:"))
            {
                fCommandLine = true;
            }
        }
        if (fCommandLine)
        {
            int ret = CommandLineRPC(argc, argv);
            exit(ret);
        }
#ifndef WIN32
        fDaemon = gArgs.GetBoolArg("-daemon", false);
        if (fDaemon)
        {
            fprintf(stdout, "Eccoind server starting\n");

            // Daemonize
            pid_t pid = fork();
            if (pid < 0)
            {
                fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
                return false;
            }
            if (pid > 0) // Parent process, pid is child process id
            {
                return true;
            }
            // Child process falls through to rest of initialization

            pid_t sid = setsid();
//.........这里部分代码省略.........
开发者ID:AltJ,项目名称:ECCoin,代码行数:101,代码来源:eccoind.cpp


示例11: main

// Program's main thread of execution.
// ----------------------------------------------------------- 
int main(int argc,   // Number of strings in array argv.
	 char *argv[], // Array of command-line argument strings.
	 char *envp[]) // Array of environment variable strings.
// NOTE: None of the MSVC compilers will expand wildcard characters
// used in command-line arguments unless linked with the setargv.obj
// library. All the UNIX compliers will expand wildcard characters
// by default.
{
#ifdef __MSVC_DEBUG__
  InitLeakTest();
#endif

  // If no arguments are given print usage message to the screen 
  if(argc < 2) {
    HelpMessage();
    return 0;
  }

  // Process command ling arguments and files 
  int narg;
  char *arg = argv[narg = 1];
  while (narg < argc) {
    if (arg[0] != '\0') {
      if (arg[0] == '-') { // Look for command line arguments
	if(!ProcessArgs(arg)) return 0; // Exit if argument is not valid
      }
      else { 
	if(futils_isdirectory((const char *)arg)) {
	  // Do not process directories
	  arg = argv[++narg];
	  continue;
	}
	open_file = arg; // Update the open file name pointer
	DiskFileB iofile(open_file);
	if(!iofile) { // Skip over directory names
	  if(narg < argc) {
	    arg = argv[++narg];
	    iofile.df_Close();
	    continue; 
	  }
	  else { // Cannot open the specified file
	    GXSTD::cerr << "\n";
	    GXSTD::cerr << "Cannot open file: " << open_file << "\n";
	    GXSTD::cerr << "Exiting..." << "\n";
	    GXSTD::cerr << "\n";
	    return 0;
	  }
	}
	num_files++;

	if(replace_section) {
	  num_matches = 0; num_replaced = 0; num_processed = 0;
	  if(!ReplaceBySection(iofile, GXSTD::cout)) return 0;
	  arg = argv[++narg];
	  if(num_files) iofile.df_Close();
	  continue;
	}

	// Echo the name of the file and search operation
	// ----------------------------------------------------------- 
	if(replacing_string == 1) {
	  if(string_to_insert.is_null()) {
	    GXSTD::cerr << "\n";
	    GXSTD::cerr << "The -R option must be used with the -W option." 
			<< "\n";
	    GXSTD::cerr << "Usage: -R\"string\" -W\"replacement\"" << "\n";
	    GXSTD::cerr << "\n";
	    return 0;
	  }
	  num_processed = 0; // Number of string processed for this file
	  GXSTD::cout << "\n";
	  GXSTD::cout << "Opening file: " << open_file << "\n";
	  GXSTD::cout << "Replacing: " << string_to_replace.c_str() << "\n";
	  GXSTD::cout << "With: " << string_to_insert.c_str() << "\n";
	}

	if(replacing_line) {
	  if(string_to_insert.is_null()) {
	    GXSTD::cerr << "\n";
	    GXSTD::cerr << "The -L option must be used with the -W option." 
			<< "\n";
	    GXSTD::cerr << "Usage: -L\"string\" -W\"replacement\"" << "\n";
	    return 0;
	  }
	  num_processed = 0; // Number of string processed for this file
	  GXSTD::cout << "\n";
	  GXSTD::cout << "Opening file: " << open_file << "\n";
	  GXSTD::cout << "Replacing line after: " << string_to_replace.c_str() << "\n";
	  GXSTD::cout << "With: " << string_to_insert.c_str() << "\n";
	}

	if(inserting_string ) {
	  if(string_to_insert.is_null()) {
	    GXSTD::cerr << "\n";
	    GXSTD::cerr << "The -I option must be used with the -W option." 
			<< "\n";
	    GXSTD::cerr << "Usage: -I\"string\" -W\"insert\"" << "\n";
	    GXSTD::cerr << "\n";
//.........这里部分代码省略.........
开发者ID:datareel,项目名称:datareel,代码行数:101,代码来源:ffind.cpp


示例12: main

int main(int argc, char **argv)
{
	int c;
	std::string server_name = "localhost";
	int server_port = 9090;
	std::string root_file_name = "";
	std::string module_file_name = "";

	while ((c = getopt(argc, argv, "hH:p:i:M:")) != -1)
	{
		switch (c)
		{
			case 'h':
				HelpMessage();
				return 0;
			case 'H':
				server_name = optarg;
				break;
			case 'p':
				server_port = atoi(optarg);
				break;
			case 'i':
				root_file_name = optarg;
				break;
			case 'M':
				module_file_name = optarg;
				break;
			default:
				break;
		}
	}

  int fake_argc = 1;
  char fake_arg_str[256];
  sprintf(fake_arg_str,"./online-display");
  char *fake_argv[] = {fake_arg_str};
  
  TApplication theApp("RMidas", &fake_argc, fake_argv);
  
  if (gROOT->IsBatch()) {
    printf("%s: cannot run in batch mode\n", argv[0]);
    return 1;
  }

 std::cout<<module_file_name<<std::endl;
  TOnlineFrame *onlineFrame = new TOnlineFrame(gClient->GetRoot(),module_file_name);   
	
	if (root_file_name.length() != 0)
		onlineFrame->OpenRootFile(root_file_name.c_str());
	else
	{
		onlineFrame->setServerName(server_name.c_str());
		onlineFrame->setServerPort(server_port);
		onlineFrame->ConnectToServer();
		onlineFrame->Print();

#if 0
		// Get list of all histograms, then copy them to the current directory
		std::vector<TString> vHistTitles = onlineFrame->GetHistTitles();
		for (unsigned int i = 0; i < vHistTitles.size(); ++i)
		{
			//printf("%d: %s\n", i, vHistTitles.at(i).Data());
			TH1 *hist = onlineFrame->GetHist(vHistTitles.at(i).Data());
			if(hist)
			{
				//hist->Draw();
				hist->Clone(vHistTitles.at(i).Data());
			}
		}
#endif
	}

	//onlineFrame->runMacro("modules/common/root_init.C");

  /*
    TThread *ct = new TThread(cycleThread, onlineFrame);
    ct->Run();
  */
  
  //theApp.SetIdleTimer(1,".q");

		onlineFrame->UpdateDisplay();
		theApp.Run(1);
#if 0
  time_t lastCycleTime = 0;//time(NULL);
  while(true) 
	{
		theApp.Run(1);
		if(time(NULL) > lastCycleTime + onlineFrame->getAutoUpdateTime()) 
		{
			//printf("Considering cycling\n");
			onlineFrame->ConsiderCycling(); 
			onlineFrame->ConsiderAutoupdate(); 
			lastCycleTime = time(NULL);
		}
		else 
		{
			usleep(10000);
		}
	}
//.........这里部分代码省略.........
开发者ID:alcap-org,项目名称:AlcapDAQ,代码行数:101,代码来源:mainWindow.cpp


示例13: HelpCommand


//.........这里部分代码省略.........
                {
                    found = TRUE;
                    WRMSG( HHC01603, "I", "" );
                    WRMSG( HHC01602, "I", "Command", ' ', "Description" );
                    WRMSG( HHC01602, "I", "-------", ' ', "-----------------------------------------------" );
                }
                WRMSG( HHC01602, "I", pCmdTab->statement, longflag, pCmdTab->shortdesc );
            }
        }

        /* Prefix given but no matches found? */
        if (pfxlen > 0 && !found)
        {
            // "No help available for mask '%s'"
            WRMSG( HHC01609, "E", argv[1] );
            rc = -1;
        }
        else
        {
            WRMSG( HHC01603, "I", "" );
            if (didlong)
            {
                // " (*)  More help available."
                WRMSG( HHC01610, "I" );
                WRMSG( HHC01603, "I", "" );
            }
            rc = 0;
        }
    }
    else /* (argc == 2 && pfxlen < 0) "help cmd": Show help for given command */
    {
        char longflag;
        size_t cmdlen, matchlen;

        for (pCmdTab = cmdtab; pCmdTab->statement; pCmdTab++)
        {
            cmdlen = pCmdTab->mincmdlen ? pCmdTab->mincmdlen : strlen( pCmdTab->statement );
            matchlen = MAX( strlen(argv[1]), cmdlen );

            if (1
                && (pCmdTab->shortdesc)
                && (pCmdTab->type & sysblk.sysgroup)
                && !strncasecmp( argv[1], pCmdTab->statement, matchlen )
            )
            {
                longflag = (pCmdTab->longdesc) ? '*' : ' ';

                WRMSG( HHC01603, "I", "" );
                WRMSG( HHC01602, "I", "Command", ' ', "Description" );
                WRMSG( HHC01602, "I", "-------", ' ', "-------------------------------------------------------" );
                WRMSG( HHC01602, "I", pCmdTab->statement, longflag, pCmdTab->shortdesc);

                if (pCmdTab->longdesc)
                {
                    char buf[257];
                    int i = 0;
                    int j;

                    WRMSG( HHC01603, "I", "" );
                    while(pCmdTab->longdesc[i])
                    {
                        for(j = 0; j < (int)sizeof(buf)      &&
                                   pCmdTab->longdesc[i] &&
                                   pCmdTab->longdesc[i] != '\n'; i++, j++)
                        {
                            buf[j] = pCmdTab->longdesc[i];
                        }

                        buf[j] = '\0';
                        if(pCmdTab->longdesc[i] == '\n')
                            i++;
                        WRMSG( HHC01603, "I", buf );
                    }
                }
                WRMSG( HHC01603, "I", "" );
                rc = 0;
                break;
            }
        }

        /* If command not found, check if message help (e.g. "help HHCnnnnn[s]") */
        if (rc == 1)  /* (not found?) */
        {
            /* "help HHCnnnnn" or "help HHCnnnnns" */
            if (strncasecmp( argv[1], "HHC", 3 ) == 0
                && (strlen( argv[1] ) == 8 ||
                    strlen( argv[1] ) == 9))
            {
                rc = HelpMessage( argv[1] );
            }
            else
            {
                // "Unknown herc command '%s', no help available"
                WRMSG( HHC01604, "I", argv[1] );
                rc = -1;
            }
        }
    }
    return rc;
}
开发者ID:pfg504,项目名称:hercules-plus,代码行数:101,代码来源:cmdtab.c


示例14: QDialog

/** "Help message" or "About" dialog box */
HelpMessageDialog::HelpMessageDialog(QWidget *parent, HelpMode helpMode) :
    QDialog(parent),
    ui(new Ui::HelpMessageDialog)
{
    ui->setupUi(this);

    QString version = tr("Terracoin Core") + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion());
    /* On x86 add a bit specifier to the version so that users can distinguish between
     * 32 and 64 bit builds. On other architectures, 32/64 bit may be more ambigious.
     */
#if defined(__x86_64__)
    version += " " + tr("(%1-bit)").arg(64);
#elif defined(__i386__ )
    version += " " + tr("(%1-bit)").arg(32);
#endif

    if (helpMode == about)
    {
        setWindowTitle(tr("About Terracoin Core"));

        /// HTML-format the license message from the core
        QString licenseInfo = QString::fromStdString(LicenseInfo());
        QString licenseInfoHTML = licenseInfo;

        // Make URLs clickable
        QRegExp uri("<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2);
        uri.setMinimal(true); // use non-greedy matching
        licenseInfoHTML.replace(uri, "<a href=\"\\1\">\\1</a>");
        // Replace newlines with HTML breaks
        licenseInfoHTML.replace("\n\n", "<br><br>");

        ui->aboutMessage->setTextFormat(Qt::RichText);
        ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
        text = version + "\n" + licenseInfo;
        ui->aboutMessage->setText(version + "<br><br>" + licenseInfoHTML);
        ui->aboutMessage->setWordWrap(true);
        ui->helpMessage->setVisible(false);
    } else if (helpMode == cmdline) {
        setWindowTitle(tr("Command-line options"));
        QString header = tr("Usage:") + "\n" +
            "  terracoin-qt [" + tr("command-line options") + "]                     " + "\n";
        QTextCursor cursor(ui->helpMessage->document());
        cursor.insertText(version);
        cursor.insertBlock();
        cursor.insertText(header);
        cursor.insertBlock();

        std::string strUsage = HelpMessage(HMM_BITCOIN_QT);
        const bool showDebug = GetBoolArg("-help-debug", false);
        strUsage += HelpMessageGroup(tr("UI Options:").toStdString());
        if (showDebug) {
            strUsage += HelpMessageOpt("-allowselfsignedrootcertificates", strprintf("Allow self signed root certificates (default: %u)", DEFAULT_SELFSIGNED_ROOTCERTS));
        }
        strUsage += HelpMessageOpt("-choosedatadir", strprintf(tr("Choose data directory on startup (default: %u)").toStdString(), DEFAULT_CHOOSE_DATADIR));
        strUsage += HelpMessageOpt("-lang=<lang>", tr("Set language, for example \"de_DE\" (default: system locale)").toStdString());
        strUsage += HelpMessageOpt("-min", tr("Start minimized").toStdString());
        strUsage += HelpMessageOpt("-rootcertificates=<file>", tr("Set SSL root certificates for payment request (default: -system-)").toStdString());
        strUsage += HelpMessageOpt("-splash", strprintf(tr("Show splash screen on startup (default: %u)").toStdString(), DEFAULT_SPLASHSCREEN));
        strUsage += HelpMessageOpt("-resetguisettings", tr("Reset all settings changed in the GUI").toStdString());
        if (showDebug) {
            strUsage += HelpMessageOpt("-uiplatform", strprintf("Select platform to customize UI for (one of windows, macosx, other; default: %s)", BitcoinGUI::DEFAULT_UIPLATFORM));
        }
        QString coreOptions = QString::fromStdString(strUsage);
        text = version + "\n" + header + "\n" + coreOptions;

        QTextTableFormat tf;
        tf.setBorderStyle(QTextFrameFormat::BorderStyle_None);
        tf.setCellPadding(2);
        QVector<QTextLength> widths;
        widths << QTextLength(QTextLength::PercentageLength, 35);
        widths << QTextLength(QTextLength::PercentageLength, 65);
        tf.setColumnWidthConstraints(widths);

        QTextCharFormat bold;
        bold.setFontWeight(QFont::Bold);

        Q_FOREACH (const QString &line, coreOptions.split("\n")) {
            if (line.startsWith("  -"))
            {
                cursor.currentTable()->appendRows(1);
                cursor.movePosition(QTextCursor::PreviousCell);
                cursor.movePosition(QTextCursor::NextRow);
                cursor.insertText(line.trimmed());
                cursor.movePosition(QTextCursor::NextCell);
            } else if (line.startsWith("   ")) {
                cursor.insertText(line.trimmed()+' ');
            } else if (line.size() > 0) {
                //Title of a group
                if (cursor.currentTable()) 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Helper_Get_EA函数代码示例发布时间:2022-05-30
下一篇:
C++ HeightOfScreen函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap