本文整理汇总了C++中InputConfig::append_event方法的典型用法代码示例。如果您正苦于以下问题:C++ InputConfig::append_event方法的具体用法?C++ InputConfig::append_event怎么用?C++ InputConfig::append_event使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputConfig
的用法示例。
在下文中一共展示了InputConfig::append_event方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseInputFile
//.........这里部分代码省略.........
token = _tcstok(NULL, _T(" "));
}
}
// Clear all data.
some_data = false;
_tcscpy(d_mode, _T(""));
_tcscpy(d_type, _T(""));
_tcscpy(d_data, _T(""));
event_id = 0;
_tcscpy(d_label, _T(""));
d_location = 0;
new_label = NULL;
} else if (string_is_empty(buffer) || buffer[0] == _T('#')) {
// Do nothing - we probably just have a comment line
// JG removed "void;" - causes warning (void is declaration and needs variable)
// NOTE: Do NOT display buffer to user as it may contain an invalid stirng !
} else if (parse_assignment(buffer, key, value)) {
if (_tcscmp(key, _T("mode")) == 0) {
if (_tcslen(value) < 1024) {
some_data = true; // Success, we have a real entry
_tcscpy(d_mode, value);
}
} else if (_tcscmp(key, _T("type")) == 0) {
if (_tcslen(value) < 256)
_tcscpy(d_type, value);
} else if (_tcscmp(key, _T("data")) == 0) {
if (_tcslen(value) < 256)
_tcscpy(d_data, value);
} else if (_tcscmp(key, _T("event")) == 0) {
if (_tcslen(value) < 256) {
_tcscpy(d_event, _T(""));
_tcscpy(d_misc, _T(""));
int ef;
#if defined(__BORLANDC__)
memset(d_event, 0, sizeof(d_event));
memset(d_misc, 0, sizeof(d_event));
if (_tcschr(value, ' ') == NULL) {
_tcscpy(d_event, value);
} else {
#endif
ef = _stscanf(value, _T("%[^ ] %[A-Za-z0-9 \\/().,]"), d_event,
d_misc);
#if defined(__BORLANDC__)
}
#endif
// TODO code: Can't use token here - breaks
// other token - damn C - how about
// C++ String class ?
// TCHAR *eventtoken;
// eventtoken = _tcstok(value, _T(" "));
// d_event = token;
// eventtoken = _tcstok(value, _T(" "));
if ((ef == 1) || (ef == 2)) {
// TODO code: Consider reusing existing identical events
pt2Event event = InputEvents::findEvent(d_event);
if (event) {
TCHAR *allocated = StringMallocParse(d_misc);
event_id = config.append_event(event, allocated, event_id);
/* not freeing the string, because
InputConfig::append_event() stores the string point
without duplicating it; strictly speaking, this is a
memory leak, but the input file is only loaded once
at startup, so this is acceptable; in return, we
don't have to duplicate the hard-coded defaults,
which saves some memory */
//free(allocated);
} else {
LogStartUp(_T("Invalid event type: %s at %i"), d_event, line);
}
} else {
LogStartUp(_T("Invalid event type at %i"), line);
}
}
} else if (_tcscmp(key, _T("label")) == 0) {
_tcscpy(d_label, value);
} else if (_tcscmp(key, _T("location")) == 0) {
d_location = _ttoi(value);
} else {
LogStartUp(_T("Invalid key/value pair %s=%s at %i"), key, value, line);
}
} else {
LogStartUp(_T("Invalid line at %i"), line);
}
} // end while
}