Ninja
Public Member Functions | Private Attributes | List of all members
Explanations Struct Reference

A class used to record a list of explanation strings associated with a given 'item' pointer. More...

#include <explanations.h>

Public Member Functions

void LookupAndAppend (const void *item, std::vector< std::string > *out)
 Lookup the explanations recorded for |item|, and append them to |*out|, if any. More...
 
void Record (const void *item, const char *fmt,...)
 Record an explanation for |item| if this instance is enabled. More...
 
void RecordArgs (const void *item, const char *fmt, va_list args)
 Same as Record(), but uses a va_list to pass formatting arguments. More...
 

Private Attributes

std::unordered_map< const void *, std::vector< std::string > > map_
 

Detailed Description

A class used to record a list of explanation strings associated with a given 'item' pointer.

This is used to implement the -d explain feature.

Definition at line 27 of file explanations.h.

Member Function Documentation

◆ LookupAndAppend()

void Explanations::LookupAndAppend ( const void *  item,
std::vector< std::string > *  out 
)
inline

Lookup the explanations recorded for |item|, and append them to |*out|, if any.

Definition at line 46 of file explanations.h.

References map_.

Referenced by OptionalExplanations::LookupAndAppend(), StatusPrinter::PrintStatus(), and TEST().

◆ Record()

void Explanations::Record ( const void *  item,
const char *  fmt,
  ... 
)
inline

Record an explanation for |item| if this instance is enabled.

Definition at line 30 of file explanations.h.

References RecordArgs().

Referenced by TEST().

◆ RecordArgs()

void Explanations::RecordArgs ( const void *  item,
const char *  fmt,
va_list  args 
)
inline

Same as Record(), but uses a va_list to pass formatting arguments.

Definition at line 38 of file explanations.h.

References map_.

Referenced by Record(), OptionalExplanations::Record(), and OptionalExplanations::RecordArgs().

Member Data Documentation

◆ map_

std::unordered_map<const void*, std::vector<std::string> > Explanations::map_
private

Definition at line 56 of file explanations.h.

Referenced by LookupAndAppend(), and RecordArgs().


The documentation for this struct was generated from the following file: