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


C++ LogMessage::HasCategory方法代码示例

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


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

示例1: DoesMatch

bool LogFilterExactMatch::DoesMatch(const LogMessage &message) const {
  switch (m_filter_target) {
  case eFilterTargetActivity:
    // Empty fields never match a condition.
    if (!message.HasActivity())
      return false;
    return m_match_text == message.GetActivity();
  case eFilterTargetActivityChain:
    // Empty fields never match a condition.
    if (!message.HasActivity())
      return false;
    return m_match_text == message.GetActivityChain();
  case eFilterTargetCategory:
    // Empty fields never match a condition.
    if (!message.HasCategory())
      return false;
    return m_match_text == message.GetCategory();
  case eFilterTargetMessage: {
    const char *message_text = message.GetMessage();
    return (message_text != nullptr) && (m_match_text == message_text);
  }
  case eFilterTargetSubsystem:
    // Empty fields never match a condition.
    if (!message.HasSubsystem())
      return false;
    return m_match_text == message.GetSubsystem();
  default:
    // We don't know this type.
    return false;
  }
}
开发者ID:llvm-project,项目名称:lldb,代码行数:31,代码来源:LogFilterExactMatch.cpp

示例2: DoesMatch

bool LogFilterRegex::DoesMatch(const LogMessage &message) const {
  switch (m_filter_target) {
  case eFilterTargetActivity:
    // Empty fields never match a condition.
    if (!message.HasActivity())
      return false;
    return ::regexec(&m_regex, message.GetActivity(), 0, nullptr, 0) == 0;
  case eFilterTargetActivityChain:
    // Empty fields never match a condition.
    if (!message.HasActivity())
      return false;
    return ::regexec(&m_regex, message.GetActivityChain().c_str(), 0, nullptr,
                     0) == 0;
  case eFilterTargetCategory:
    // Empty fields never match a condition.
    if (!message.HasCategory())
      return false;
    return ::regexec(&m_regex, message.GetCategory(), 0, nullptr, 0) == 0;
  case eFilterTargetMessage: {
    const char *message_text = message.GetMessage();
    if (!message_text) {
      DNBLogThreadedIf(LOG_DARWIN_LOG,
                       "LogFilterRegex: regex "
                       "\"%s\" no match due to nullptr message.",
                       m_regex_text.c_str());
      return false;
    }

    bool match = ::regexec(&m_regex, message_text, 0, nullptr, 0) == 0;
    DNBLogThreadedIf(LOG_DARWIN_LOG, "LogFilterRegex: regex "
                                     "\"%s\" %s message \"%s\".",
                     m_regex_text.c_str(), match ? "matches" : "does not match",
                     message_text);
    return match;
  }
  case eFilterTargetSubsystem:
    // Empty fields never match a condition.
    if (!message.HasSubsystem())
      return false;
    return ::regexec(&m_regex, message.GetSubsystem(), 0, nullptr, 0) == 0;
  default:
    // We don't know this type.
    return false;
  }
}
开发者ID:llvm-project,项目名称:lldb,代码行数:45,代码来源:LogFilterRegex.cpp


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