libcsdbg  1.28
C++ exception (and generic) stack trace debug library
style * csdbg::parser::get_style ( const i8 nm) const
virtual

Get a style, indexed by name.

Parameters
[in]nmthe style name
Returns
the style or parser::m_fallback if no such style is registered

Definition at line 514 of file parser.cpp.

References __D_ASSERT, likely, m_fallback, m_styles, csdbg::style::name(), and unlikely.

Referenced by highlight().

515 {
516  __D_ASSERT(nm != NULL);
517  if ( unlikely(nm == NULL) )
518  return m_fallback;
519 
520  for (u32 i = 0, sz = m_styles->size(); likely(i < sz); i++) {
521  style *stl = m_styles->at(i);
522  if ( unlikely(strcmp(stl->name(), nm) == 0) )
523  return stl;
524  }
525 
526  return m_fallback;
527 }
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
Definition: config.hpp:344
unsigned int u32
32-bit unsigned integer
Definition: config.hpp:102
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349
static style * m_fallback
Shared fallback style.
Definition: parser.hpp:37
#define __D_ASSERT(x)
Assertion macro.
Definition: config.hpp:268
chain< style > * m_styles
VT100 style collection.
Definition: parser.hpp:44

+ Here is the call graph for this function:

+ Here is the caller graph for this function: