本文整理汇总了C++中Flags::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ Flags::toString方法的具体用法?C++ Flags::toString怎么用?C++ Flags::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flags
的用法示例。
在下文中一共展示了Flags::toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
setsid();
switch (fork()) {
case -1:
fprintf(stderr, "Failed to fork (%d) %s\n", errno, strerror(errno));
return 1;
case 0:
break;
default:
return 0;
}
break;
default:
return 0;
}
}
if (serverOpts.headerErrorJobCount == -1) {
serverOpts.headerErrorJobCount = std::max(1, serverOpts.jobCount / 2);
} else {
serverOpts.headerErrorJobCount = std::min(serverOpts.headerErrorJobCount, serverOpts.jobCount);
}
if (sigHandler) {
signal(SIGSEGV, sigSegvHandler);
signal(SIGILL, sigSegvHandler);
signal(SIGABRT, sigSegvHandler);
}
// Shell-expand logFile
Path logPath(logFile); logPath.resolve();
if (!initLogging(argv[0], LogStderr, logLevel, logPath.constData(), logFlags, logFileLogLevel)) {
fprintf(stderr, "Can't initialize logging with %d %s %s\n",
logLevel.toInt(), logFile ? logFile : "", logFlags.toString().constData());
return 1;
}
#ifdef OS_Darwin
if (serverOpts.options & Server::Launchd) {
// Clamp inactivity timeout. launchd starts to worry if the
// process runs for less than 10 seconds.
static const int MIN_INACTIVITY_TIMEOUT = 15; // includes
// fudge factor.
if (inactivityTimeout < MIN_INACTIVITY_TIMEOUT) {
inactivityTimeout = MIN_INACTIVITY_TIMEOUT;
fprintf(stderr, "launchd mode - clamped inactivity timeout to %d to avoid launchd warnings.\n", inactivityTimeout);
}
}
#endif
EventLoop::SharedPtr loop(new EventLoop);
loop->init(EventLoop::MainEventLoop|EventLoop::EnableSigIntHandler|EventLoop::EnableSigTermHandler);
std::shared_ptr<Server> server(new Server);
if (!serverOpts.tests.isEmpty()) {
char buf[1024];
Path path;
while (true) {
strcpy(buf, "/tmp/rtags-test-XXXXXX");
if (!mkdtemp(buf)) {
fprintf(stderr, "Failed to mkdtemp (%d)\n", errno);
return 1;
}
path = buf;
示例2: main
//.........这里部分代码省略.........
fprintf(stderr, "Failed to fork (%d) %s\n", errno, strerror(errno));
return 1;
case 0:
break;
default:
return 0;
}
break;
default:
return 0;
}
}
if (serverOpts.excludeFilters.isEmpty())
serverOpts.excludeFilters = String(DEFAULT_EXCLUDEFILTER).split(';');
if (serverOpts.compilerWrappers.isEmpty())
serverOpts.compilerWrappers = String(DEFAULT_COMPILER_WRAPPERS).split(';').toSet();
if (!serverOpts.headerErrorJobCount) {
serverOpts.headerErrorJobCount = std::max<size_t>(1, serverOpts.jobCount / 2);
} else {
serverOpts.headerErrorJobCount = std::min(serverOpts.headerErrorJobCount, serverOpts.jobCount);
}
if (sigHandler) {
signal(SIGSEGV, signalHandler);
signal(SIGBUS, signalHandler);
signal(SIGILL, signalHandler);
signal(SIGABRT, signalHandler);
}
if (!initLogging(argv[0], logFlags, logLevel, logFile, logFileLogLevel)) {
fprintf(stderr, "Can't initialize logging with %d %s %s\n",
logLevel.toInt(), logFile.constData(), logFlags.toString().constData());
return 1;
}
#ifdef RTAGS_HAS_LAUNCHD
if (serverOpts.options & Server::Launchd) {
// Clamp inactivity timeout. launchd starts to worry if the
// process runs for less than 10 seconds.
static const int MIN_INACTIVITY_TIMEOUT = 15; // includes
// fudge factor.
if (inactivityTimeout < MIN_INACTIVITY_TIMEOUT) {
inactivityTimeout = MIN_INACTIVITY_TIMEOUT;
fprintf(stderr, "launchd mode - clamped inactivity timeout to %d to avoid launchd warnings.\n", inactivityTimeout);
}
}
#endif
EventLoop::SharedPtr loop(new EventLoop);
loop->init(EventLoop::MainEventLoop|EventLoop::EnableSigIntHandler|EventLoop::EnableSigTermHandler);
auto server = std::make_shared<Server>();
if (!serverOpts.tests.isEmpty()) {
char buf[1024];
Path path;
while (true) {
strcpy(buf, "/tmp/rtags-test-XXXXXX");
if (!mkdtemp(buf)) {
fprintf(stderr, "Failed to mkdtemp (%d)\n", errno);
return 1;
}
path = buf;
示例3: parse
//.........这里部分代码省略.........
addQuery(type, p, extraQueryFlags);
break; }
case AllDependencies: {
String encoded;
List<String> args;
while (optind < argc && argv[optind][0] != '-') {
args.append(argv[optind++]);
}
Serializer s(encoded);
s << Path() << args;
addQuery(QueryMessage::Dependencies, encoded);
break; }
case DumpFileMaps:
case Dependencies: {
Path p = optarg;
if (!p.isFile()) {
fprintf(stderr, "%s is not a file\n", optarg);
return Parse_Error;
}
p.resolve();
List<String> args;
while (optind < argc && argv[optind][0] != '-') {
args.append(argv[optind++]);
}
String encoded;
Serializer s(encoded);
s << p << args;
addQuery(opt->option == DumpFileMaps ? QueryMessage::DumpFileMaps : QueryMessage::Dependencies, encoded);
break; }
case PreprocessFile: {
Path p = optarg;
p.resolve(Path::MakeAbsolute);
if (!p.isFile()) {
fprintf(stderr, "%s is not a file\n", optarg);
return Parse_Error;
}
addQuery(QueryMessage::PreprocessFile, p);
break; }
case RemoveFile: {
const Path p = Path::resolved(optarg, Path::MakeAbsolute);
if (!p.exists()) {
addQuery(QueryMessage::RemoveFile, p);
} else {
addQuery(QueryMessage::RemoveFile, optarg);
}
break; }
case ReferenceName:
addQuery(QueryMessage::ReferencesName, optarg);
break;
}
}
if (state == Error) {
help(stderr, argv[0]);
return Parse_Error;
}
if (optind < argc) {
fprintf(stderr, "rc: unexpected option -- '%s'\n", argv[optind]);
return Parse_Error;
}
if (!initLogging(argv[0], LogStderr, mLogLevel, logFile, logFlags)) {
fprintf(stderr, "Can't initialize logging with %d %s %s\n",
mLogLevel.toInt(), logFile.constData(), logFlags.toString().constData());
return Parse_Error;
}
if (mCommands.isEmpty()) {
help(stderr, argv[0]);
return Parse_Error;
}
if (mCommands.size() > projectCommands.size()) {
// If there's more than one command one likely does not want output from
// the queryCommand (unless there's no arg specified for it). This is so
// we don't have to pass a different flag for auto-updating project
// using the current buffer but rather piggy-back on --project
const int count = projectCommands.size();
for (int i=0; i<count; ++i) {
std::shared_ptr<QueryCommand> &cmd = projectCommands[i];
if (!cmd->query.isEmpty()) {
cmd->extraQueryFlags |= QueryMessage::Silent;
}
}
}
if (!logFile.isEmpty() || mLogLevel > LogLevel::Error) {
Log l(LogLevel::Warning);
l << argc;
for (int i = 0; i < argc; ++i)
l << " " << argv[i];
}
mArgc = argc;
mArgv = argv;
return Parse_Exec;
}