ManaPlus
Public Member Functions
anonymous_namespace{itemcontainer.cpp}::SortItemAlphaFunctor Class Reference

Public Member Functions

bool operator() (const ItemIdPair *const pair1, const ItemIdPair *const pair2) const
 

Detailed Description

Definition at line 86 of file itemcontainer.cpp.

Member Function Documentation

◆ operator()()

bool anonymous_namespace{itemcontainer.cpp}::SortItemAlphaFunctor::operator() ( const ItemIdPair *const  pair1,
const ItemIdPair *const  pair2 
) const
inline

Definition at line 91 of file itemcontainer.cpp.

93  {
94  const Item *const item1 = pair1->mItem;
95  const Item *const item2 = pair2->mItem;
96  if ((item1 == nullptr) || (item2 == nullptr))
97  return false;
98 
99  const std::string name1 = item1->getInfo().getName(
100  item1->getColor());
101  const std::string name2 = item2->getInfo().getName(
102  item2->getColor());
103  if (name1 == name2)
104  {
105  return item1->getInvIndex() <
106  item2->getInvIndex();
107  }
108  return name1 < name2;
109  }
const std::string & getName() const
Definition: iteminfo.h:74
Definition: item.h:50
int getInvIndex() const
Definition: item.h:165
ItemColor getColor() const
Definition: item.h:181
const ItemInfo & getInfo() const
Definition: item.h:171

References Item::getColor(), Item::getInfo(), Item::getInvIndex(), and ItemInfo::getName().


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