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

(dc3c359)

#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::ostreamoperator<< (std::ostream &os, const Position &p)
 
std::ostreamoperator<< (std::ostream &os, const Path &path)
 

Typedef Documentation

◆ Path

typedef std::list<Position> Path

Definition at line 48 of file position.h.

◆ PathIterator

typedef Path::iterator PathIterator

Definition at line 49 of file position.h.

◆ PathRIterator

typedef Path::reverse_iterator PathRIterator

Definition at line 50 of file position.h.

Function Documentation

◆ operator<<() [1/2]

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

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

Definition at line 27 of file position.cpp.

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

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

◆ operator<<() [2/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 33 of file position.cpp.

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