ManaPlus
Public Member Functions | Data Fields
TextChunkSmall Class Reference

#include <textchunksmall.h>

Public Member Functions

 TextChunkSmall (const std::string &text0, const Color &color0, const Color &color1)
 
 TextChunkSmall (const TextChunkSmall &old)
 
bool operator== (const TextChunkSmall &chunk) const
 
bool operator< (const TextChunkSmall &chunk) const
 
TextChunkSmalloperator= (const TextChunkSmall &chunk)
 

Data Fields

std::string text
 
Color color
 
Color color2
 

Detailed Description

Definition at line 31 of file textchunksmall.h.

Constructor & Destructor Documentation

◆ TextChunkSmall() [1/2]

TextChunkSmall::TextChunkSmall ( const std::string &  text0,
const Color color0,
const Color color1 
)

Definition at line 28 of file textchunksmall.cpp.

30  :
31  text(text0),
32  color(color0),
33  color2(color1)
34 {
35 }
std::string text

◆ TextChunkSmall() [2/2]

TextChunkSmall::TextChunkSmall ( const TextChunkSmall old)

Definition at line 37 of file textchunksmall.cpp.

37  :
38  text(old.text),
39  color(old.color),
40  color2(old.color2)
41 {
42 }

Member Function Documentation

◆ operator<()

bool TextChunkSmall::operator< ( const TextChunkSmall chunk) const

Definition at line 59 of file textchunksmall.cpp.

60 {
61  if (chunk.text != text)
62  return chunk.text > text;
63 
64  const Color &restrict c = chunk.color;
65  if (c.r != color.r)
66  return c.r > color.r;
67  if (c.g != color.g)
68  return c.g > color.g;
69  if (c.b != color.b)
70  return c.b > color.b;
71 
72  const Color &restrict c2 = chunk.color2;
73  if (c2.r != color2.r)
74  return c2.r > color2.r;
75  if (c2.g != color2.g)
76  return c2.g > color2.g;
77  if (c2.b != color2.b)
78  return c2.b > color2.b;
79 
80  if (c.a != color.a && Font::mSoftMode)
81  return c.a > color.a;
82 
83  return false;
84 }
Definition: color.h:76
unsigned int a
Definition: color.h:251
unsigned int b
Definition: color.h:245
unsigned int r
Definition: color.h:235
unsigned int g
Definition: color.h:240
static bool mSoftMode
Definition: font.h:140
#define restrict
Definition: localconsts.h:165

References Color::a, Color::b, color, color2, Color::g, Font::mSoftMode, Color::r, restrict, and text.

◆ operator=()

TextChunkSmall & TextChunkSmall::operator= ( const TextChunkSmall chunk)

Definition at line 44 of file textchunksmall.cpp.

45 {
46  text = chunk.text;
47  color = chunk.color;
48  color2 = chunk.color2;
49  return *this;
50 }

References color, color2, and text.

◆ operator==()

bool TextChunkSmall::operator== ( const TextChunkSmall chunk) const

Definition at line 52 of file textchunksmall.cpp.

53 {
54  return chunk.text == text &&
55  chunk.color == color &&
56  chunk.color2 == color2;
57 }

References color, color2, and text.

Field Documentation

◆ color

Color TextChunkSmall::color

Definition at line 47 of file textchunksmall.h.

Referenced by operator<(), operator=(), and operator==().

◆ color2

Color TextChunkSmall::color2

Definition at line 48 of file textchunksmall.h.

Referenced by operator<(), operator=(), and operator==().

◆ text

std::string TextChunkSmall::text

Definition at line 46 of file textchunksmall.h.

Referenced by operator<(), operator=(), and operator==().


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