Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NavigationSystem::CachedSectorIterator Class Reference

#include <navscreen.h>

Classes

class  SectorInfo
 

Public Member Functions

 CachedSectorIterator ()
 
 CachedSectorIterator (CachedSystemIterator &systemIter)
 
void init (CachedSystemIterator &systemIter)
 
bool seek (unsigned position=0)
 
unsigned getIndex () const
 
unsigned size () const
 
bool done () const
 
SectorInfooperator[] (unsigned pos)
 
const SectorInfooperator[] (unsigned pos) const
 
SectorInfooperator* ()
 
const SectorInfooperator* () const
 
SectorInfooperator-> ()
 
const SectorInfooperator-> () const
 
CachedSectorIteratornext ()
 
CachedSectorIteratoroperator++ ()
 

Friends

class SectorInfo
 

Detailed Description

Definition at line 90 of file navscreen.h.

Constructor & Destructor Documentation

NavigationSystem::CachedSectorIterator::CachedSectorIterator ( )

Definition at line 605 of file drawgalaxy.cpp.

605 {}
NavigationSystem::CachedSectorIterator::CachedSectorIterator ( CachedSystemIterator systemIter)

Definition at line 607 of file drawgalaxy.cpp.

References init().

608 {
609  init( systemIter );
610 }

Member Function Documentation

bool NavigationSystem::CachedSectorIterator::done ( ) const

Definition at line 658 of file drawgalaxy.cpp.

Referenced by NavigationSystem::DrawSectorList().

659 {
660  return currentPosition >= sectors.size();
661 }
unsigned NavigationSystem::CachedSectorIterator::getIndex ( ) const

Definition at line 648 of file drawgalaxy.cpp.

Referenced by NavigationSystem::DrawSectorList().

649 {
650  return currentPosition;
651 }
void NavigationSystem::CachedSectorIterator::init ( CachedSystemIterator systemIter)

Definition at line 612 of file drawgalaxy.cpp.

References Beautify(), NavigationSystem::CachedSystemIterator::done(), NavigationSystem::CachedSystemIterator::getIndex(), NavigationSystem::CachedSystemIterator::SystemInfo::GetName(), index, SectorInfo, and NavigationSystem::CachedSystemIterator::seek().

Referenced by CachedSectorIterator(), and NavigationSystem::Setup().

613 {
614  map< string, unsigned >index_table;
615  sectors.clear();
616 
617  string sys, csector, csystem;
618  unsigned index;
619 
620  systemIter.seek();
621  while ( !systemIter.done() ) {
622  sys = systemIter->GetName();
623  Beautify( sys, csector, csystem );
624  if (index_table.count( csector ) == 0) {
625  index_table[csector] = sectors.size();
626  sectors.push_back( SectorInfo( csector ) );
627  }
628  index = index_table[csector];
629  sectors[index].AddSystem( systemIter.getIndex() );
630  ++systemIter;
631  }
632 }
NavigationSystem::CachedSectorIterator & NavigationSystem::CachedSectorIterator::next ( )

Definition at line 708 of file drawgalaxy.cpp.

709 {
710  return ++(*this);
711 }
NavigationSystem::CachedSectorIterator::SectorInfo & NavigationSystem::CachedSectorIterator::operator* ( )

Definition at line 680 of file drawgalaxy.cpp.

References done, and nullSectorPair.

681 {
682  if ( done() )
683  return nullSectorPair;
684  return sectors[currentPosition];
685 }
const NavigationSystem::CachedSectorIterator::SectorInfo & NavigationSystem::CachedSectorIterator::operator* ( ) const

Definition at line 687 of file drawgalaxy.cpp.

References done, and nullSectorPair.

688 {
689  if ( done() )
690  return nullSectorPair;
691  return sectors[currentPosition];
692 }
NavigationSystem::CachedSectorIterator & NavigationSystem::CachedSectorIterator::operator++ ( )

Definition at line 713 of file drawgalaxy.cpp.

714 {
715  ++currentPosition;
716  return *this;
717 }
NavigationSystem::CachedSectorIterator::SectorInfo * NavigationSystem::CachedSectorIterator::operator-> ( )

Definition at line 694 of file drawgalaxy.cpp.

References done, and nullSectorPair.

695 {
696  if ( done() )
697  return &nullSectorPair;
698  return &sectors[currentPosition];
699 }
const NavigationSystem::CachedSectorIterator::SectorInfo * NavigationSystem::CachedSectorIterator::operator-> ( ) const

Definition at line 701 of file drawgalaxy.cpp.

References done, and nullSectorPair.

702 {
703  if ( done() )
704  return &nullSectorPair;
705  return &sectors[currentPosition];
706 }
NavigationSystem::CachedSectorIterator::SectorInfo & NavigationSystem::CachedSectorIterator::operator[] ( unsigned  pos)

Definition at line 665 of file drawgalaxy.cpp.

References nullSectorPair, and size.

666 {
667  if ( pos >= size() )
668  return nullSectorPair;
669  return sectors[pos];
670 }
const NavigationSystem::CachedSectorIterator::SectorInfo & NavigationSystem::CachedSectorIterator::operator[] ( unsigned  pos) const

Definition at line 673 of file drawgalaxy.cpp.

References nullSectorPair, and size.

674 {
675  if ( pos >= size() )
676  return nullSectorPair;
677  return sectors[pos];
678 }
bool NavigationSystem::CachedSectorIterator::seek ( unsigned  position = 0)

Definition at line 638 of file drawgalaxy.cpp.

Referenced by NavigationSystem::DrawSectorList().

639 {
640  if ( position < sectors.size() ) {
641  currentPosition = position;
642  return true;
643  } else {
644  return false;
645  }
646 }
unsigned NavigationSystem::CachedSectorIterator::size ( ) const

Definition at line 653 of file drawgalaxy.cpp.

Referenced by NavigationSystem::DrawSectorList().

654 {
655  return sectors.size();
656 }

Friends And Related Function Documentation

friend class SectorInfo
friend

Definition at line 107 of file navscreen.h.

Referenced by init().


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