ManaPlus
Data Structures | Typedefs | Functions
position.h File Reference

(986a3bf)

#include <iostream>
#include <list>
#include "localconsts.h"

Go to the source code of this file.

Data Structures

struct  Position
 

Typedefs

typedef std::list< PositionPath
 
typedef Path::iterator PathIterator
 
typedef Path::reverse_iterator PathRIterator
 

Functions

std::ostream & operator<< (std::ostream &os, const Position &p)
 
std::ostream & operator<< (std::ostream &os, const Path &path)
 

Typedef Documentation

◆ Path

typedef std::list<Position> Path

Definition at line 49 of file position.h.

◆ PathIterator

typedef Path::iterator PathIterator

Definition at line 50 of file position.h.

◆ PathRIterator

typedef Path::reverse_iterator PathRIterator

Definition at line 51 of file position.h.

Function Documentation

◆ operator<<() [1/2]

std::ostream& operator<< ( std::ostream &  os,
const Path path 
)

Appends a string representation of a path (sequence of positions) to the output stream.

Definition at line 34 of file position.cpp.

35 {
36  Path::const_iterator i = path.begin();
37  const Path::const_iterator i_end = path.end();
38 
39  os << "(";
40  while (i != i_end)
41  {
42  os << *i;
43  ++i;
44  if (i != i_end)
45  os << ", ";
46  }
47  os << ")";
48 
49  return os;
50 }

◆ operator<<() [2/2]

std::ostream& operator<< ( std::ostream &  os,
const Position p 
)

Appends a string representation of a position to the output stream.

Definition at line 28 of file position.cpp.

29 {
30  os << "(" << p.x << ", " << p.y << ")";
31  return os;
32 }
int y
Definition: position.h:46
int x
Definition: position.h:45

References Position::x, and Position::y.