Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
KODI::GUILIB::GUIINFO::CGUIInfoLabel Class Reference

#include <GUIInfoLabel.h>

Public Types

typedef std::function< std::string(const std::string &)> StringReplacerFunc
 

Public Member Functions

 CGUIInfoLabel ()=default
 
 CGUIInfoLabel (const std::string &label, const std::string &fallback="", int context=INFO::DEFAULT_CONTEXT)
 
void SetLabel (const std::string &label, const std::string &fallback, int context=INFO::DEFAULT_CONTEXT)
 
const std::string & GetLabel (int contextWindow, bool preferImage=false, std::string *fallback=NULL) const
 Gets a label (or image) for a given window context from the info manager.
 
int GetIntValue (int contextWindow) const
 Gets the label and returns it as an int value.
 
const std::string & GetItemLabel (const CGUIListItem *item, bool preferImage=false, std::string *fallback=nullptr) const
 Gets a label (or image) for a given listitem from the info manager.
 
bool IsConstant () const
 
bool IsEmpty () const
 
const std::string & GetFallback () const
 

Static Public Member Functions

static std::string GetLabel (const std::string &label, int contextWindow, bool preferImage=false)
 
static std::string GetItemLabel (const std::string &label, const CGUIListItem *item, bool preferImage=false)
 
static std::string ReplaceLocalize (const std::string &label)
 Replaces instances of $LOCALIZE[number] with the appropriate localized string.
 
static std::string ReplaceAddonStrings (std::string &&label)
 Replaces instances of $ADDON[id number] with the appropriate localized addon string.
 
static std::string ReplaceControllerStrings (std::string &&label)
 Replaces instances of $FEATURE[feature name, controller ID] with the appropriate localized controller string.
 
static bool ReplaceSpecialKeywordReferences (const std::string &strInput, const std::string &strKeyword, const StringReplacerFunc &func, std::string &strOutput)
 Replaces instances of $strKeyword[value] with the appropriate resolved string.
 
static bool ReplaceSpecialKeywordReferences (std::string &work, const std::string &strKeyword, const StringReplacerFunc &func)
 Replaces instances of $strKeyword[value] with the appropriate resolved string in-place.
 

Member Typedef Documentation

◆ StringReplacerFunc

std::function<std::string(const std::string&)> KODI::GUILIB::GUIINFO::CGUIInfoLabel::StringReplacerFunc

Constructor & Destructor Documentation

◆ CGUIInfoLabel() [1/2]

KODI::GUILIB::GUIINFO::CGUIInfoLabel::CGUIInfoLabel ( )
default

◆ CGUIInfoLabel() [2/2]

CGUIInfoLabel::CGUIInfoLabel ( const std::string & label,
const std::string & fallback = "",
int context = INFO::DEFAULT_CONTEXT )
explicit

Member Function Documentation

◆ GetFallback()

const std::string & KODI::GUILIB::GUIINFO::CGUIInfoLabel::GetFallback ( ) const
inline

◆ GetIntValue()

int CGUIInfoLabel::GetIntValue ( int contextWindow) const

Gets the label and returns it as an int value.

Parameters
contextWindowthe context in which to evaluate the expression.
Returns
int value.
See also
GetLabel

◆ GetItemLabel() [1/2]

const std::string & CGUIInfoLabel::GetItemLabel ( const CGUIListItem * item,
bool preferImage = false,
std::string * fallback = nullptr ) const

Gets a label (or image) for a given listitem from the info manager.

Parameters
itemlistitem in question.
preferImagecaller is specifically wanting an image rather than a label. Defaults to false.
fallbackif non-NULL, is set to an alternate value to use should the actual value be not appropriate. Defaults to nullptr.
Returns
label (or image).

◆ GetItemLabel() [2/2]

std::string CGUIInfoLabel::GetItemLabel ( const std::string & label,
const CGUIListItem * item,
bool preferImage = false )
static

◆ GetLabel() [1/2]

std::string CGUIInfoLabel::GetLabel ( const std::string & label,
int contextWindow,
bool preferImage = false )
static

◆ GetLabel() [2/2]

const std::string & CGUIInfoLabel::GetLabel ( int contextWindow,
bool preferImage = false,
std::string * fallback = NULL ) const

Gets a label (or image) for a given window context from the info manager.

Parameters
contextWindowthe context in which to evaluate the expression.
preferImagecaller is specifically wanting an image rather than a label. Defaults to false.
fallbackif non-NULL, is set to an alternate value to use should the actual value be not appropriate. Defaults to NULL.
Returns
label (or image).

◆ IsConstant()

bool CGUIInfoLabel::IsConstant ( ) const

◆ IsEmpty()

bool CGUIInfoLabel::IsEmpty ( ) const

◆ ReplaceAddonStrings()

std::string CGUIInfoLabel::ReplaceAddonStrings ( std::string && label)
static

Replaces instances of $ADDON[id number] with the appropriate localized addon string.

Parameters
labeltext to replace
Returns
text with any localized strings filled in.

◆ ReplaceControllerStrings()

std::string CGUIInfoLabel::ReplaceControllerStrings ( std::string && label)
static

Replaces instances of $FEATURE[feature name, controller ID] with the appropriate localized controller string.

Parameters
labelThe text to replace
Returns
text with any controller strings filled in

◆ ReplaceLocalize()

std::string CGUIInfoLabel::ReplaceLocalize ( const std::string & label)
static

Replaces instances of $LOCALIZE[number] with the appropriate localized string.

Parameters
labeltext to replace
Returns
text with any localized strings filled in.

◆ ReplaceSpecialKeywordReferences() [1/2]

bool CGUIInfoLabel::ReplaceSpecialKeywordReferences ( const std::string & strInput,
const std::string & strKeyword,
const StringReplacerFunc & func,
std::string & strOutput )
static

Replaces instances of $strKeyword[value] with the appropriate resolved string.

Parameters
strInputtext to replace
strKeywordkeyword to look for
funcfunction that does the actual replacement of each bracketed value found
strOutputthe output string
Returns
whether anything has been replaced.

◆ ReplaceSpecialKeywordReferences() [2/2]

bool CGUIInfoLabel::ReplaceSpecialKeywordReferences ( std::string & work,
const std::string & strKeyword,
const StringReplacerFunc & func )
static

Replaces instances of $strKeyword[value] with the appropriate resolved string in-place.

Parameters
worktext to replace in-place
strKeywordkeyword to look for
funcfunction that does the actual replacement of each bracketed value found
Returns
whether anything has been replaced.

◆ SetLabel()

void CGUIInfoLabel::SetLabel ( const std::string & label,
const std::string & fallback,
int context = INFO::DEFAULT_CONTEXT )

The documentation for this class was generated from the following files: