ManaPlus
Public Member Functions | Static Public Member Functions | Data Fields
ItemOptionsList Struct Reference

#include <itemoptionslist.h>

Public Member Functions

 ItemOptionsList (const size_t amount0)
 
 ItemOptionsList ()
 
 ~ItemOptionsList ()
 
void add (const uint16_t index, const uint16_t value)
 
size_t size () const
 
const ItemOptionget (const size_t index) const
 

Static Public Member Functions

static ItemOptionsListcopy (const ItemOptionsList *const options0)
 

Data Fields

ItemOptionoptions
 
size_t amount
 
size_t pointer
 

Detailed Description

Definition at line 33 of file itemoptionslist.h.

Constructor & Destructor Documentation

◆ ItemOptionsList() [1/2]

ItemOptionsList::ItemOptionsList ( const size_t  amount0)
inlineexplicit

Definition at line 35 of file itemoptionslist.h.

35  :
36  options(nullptr),
37  amount(amount0),
38  pointer(0U)
39  {
40  options = new ItemOption[amount];
41  }
ItemOption * options

References amount, and options.

◆ ItemOptionsList() [2/2]

ItemOptionsList::ItemOptionsList ( )
inline

Definition at line 43 of file itemoptionslist.h.

43  :
44  options(nullptr),
46  pointer(0U)
47  {
48  options = new ItemOption[amount];
49  }
#define maxItemOptions
Definition: itemoptions.h:25

References amount, and options.

Referenced by copy().

◆ ~ItemOptionsList()

ItemOptionsList::~ItemOptionsList ( )
inline

Definition at line 53 of file itemoptionslist.h.

54  {
55  delete [] options;
56  options = nullptr;
57  }

References options.

Member Function Documentation

◆ add()

void ItemOptionsList::add ( const uint16_t  index,
const uint16_t  value 
)
inline

◆ copy()

static ItemOptionsList* ItemOptionsList::copy ( const ItemOptionsList *const  options0)
inlinestatic

Definition at line 69 of file itemoptionslist.h.

70  {
71  if (options0 == nullptr)
72  return nullptr;
73 
74  const size_t amount0 = options0->amount;
75  ItemOptionsList *const obj = new ItemOptionsList(amount0);
76  for (size_t f = 0; f < amount0; f ++)
77  {
78  obj->options[f].index = options0->options[f].index;
79  obj->options[f].value = options0->options[f].value;
80  }
81  obj->amount = options0->amount;
82  obj->pointer = options0->pointer;
83  return obj;
84  }

References amount, ItemOption::index, ItemOptionsList(), options, pointer, and ItemOption::value.

Referenced by Item::setOptions().

◆ get()

const ItemOption& ItemOptionsList::get ( const size_t  index) const
inline

Definition at line 93 of file itemoptionslist.h.

94  {
95  return options[index];
96  }

References options.

Referenced by ItemPopup::getOptionsString().

◆ size()

size_t ItemOptionsList::size ( ) const
inline

Definition at line 86 of file itemoptionslist.h.

87  {
88  if (pointer < amount)
89  return pointer;
90  return amount;
91  }

References amount, and pointer.

Referenced by ItemPopup::getOptionsString().

Field Documentation

◆ amount

size_t ItemOptionsList::amount

Definition at line 99 of file itemoptionslist.h.

Referenced by add(), copy(), ItemOptionsList(), and size().

◆ options

ItemOption* ItemOptionsList::options

Definition at line 98 of file itemoptionslist.h.

Referenced by add(), copy(), get(), ItemOptionsList(), and ~ItemOptionsList().

◆ pointer

size_t ItemOptionsList::pointer

Definition at line 100 of file itemoptionslist.h.

Referenced by add(), copy(), and size().


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