当前位置: 首页>>代码示例>>C++>>正文


C++ SystemInfo::isUserAdmin方法代码示例

本文整理汇总了C++中SystemInfo::isUserAdmin方法的典型用法代码示例。如果您正苦于以下问题:C++ SystemInfo::isUserAdmin方法的具体用法?C++ SystemInfo::isUserAdmin怎么用?C++ SystemInfo::isUserAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SystemInfo的用法示例。


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

示例1: xTMAIN


//.........这里部分代码省略.........
            << xTRACE_VAR(application.name())            << xT("\n")
            << xTRACE_VAR(application.decription())      << xT("\n")
            << xTRACE_VAR(application.usage())           << xT("\n")
            << xTRACE_VAR(application.help())            << xT("\n")
            << xTRACE_VAR(application.copyrightYears())  << xT("\n")
            << xTRACE_VAR(application.versionMajor())    << xT("\n")
            << xTRACE_VAR(application.versionMinor())    << xT("\n")
            << xTRACE_VAR(application.versionPatch())    << xT("\n")
            << xTRACE_VAR(application.versionType())     << xT("\n")
            << xTRACE_VAR(application.versionRevision()) << xT("\n")
            << xTRACE_VAR(application.vendorName())      << xT("\n")
            << xTRACE_VAR(application.vendorDomain())    << xT("\n")
            << xTRACE_VAR(application.vendorAuthor())    << xT("\n")
            << xTRACE_VAR(application.vendorUrl())       << xT("\n")
            << xTRACE_VAR(application.vendorEmail())     << xT("\n")
            << xTRACE_VAR(application.vendorSkype());
    #endif

        application.setOnSignals(signalNums, SignalFunctor::onSignals);
        application.setOnTerminate(SignalFunctor::onTerminate);
        application.setOnExit(SignalFunctor::onExit);

        // test error
        TestFail testFail;
        testFail.foo3();
    #endif
    }

#if xOPTION_TESTS
    // checks
    {
    #if xENV_UNIX
        SystemInfo info;
        xCHECK_MSG_RET(info.isUserAdmin(), xT("xLib_test: Can't run as root"), EXIT_FAILURE);
    #endif
    }

    // options (default)
    bool_t      isUseTracing = true;
    ulonglong_t allLoops     = 1ULL;
    ulonglong_t unitLoops    = 1ULL;
    ulonglong_t caseLoops    = 1ULL;
    {
        std::vec_tstring_t args;

        ProcessInfo info;
        info.setProcessId(Process::currentId());
        info.commandLine(&args);

        if (a_argsNum == 1) {
            // OK, run tests with default params
        }
        else if (a_argsNum == 2) {
            // usage
            bool_t bRv = StringCI::compare(xT("-h"),     args.at(1)) ||
                         StringCI::compare(xT("--help"), args.at(1));
            if (!bRv) {
                std::tcout << xT("\nxLib_test: unknown switches\n") << std::endl;
            } else {
                std::tcout << xT("\nUsage: ./xLib_test [is_tracing] [all_loops] [unit_loops]\n")
                              xT("  - xLib_test  (binary file path)\n")
                              xT("  - is_tracing (is tracing)\n")
                              xT("  - all_loops  (loops for all tests)\n")
                              xT("  - unit_loops (loops for unit test)\n")
                              xT("  - case_loops (loops for case test)\n") << std::endl;
            }
开发者ID:,项目名称:,代码行数:67,代码来源:


注:本文中的SystemInfo::isUserAdmin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。