EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BaseRowsetReader::iterator Class Referenceabstract

#include "RowsetReader.h"

Inheritance diagram for BaseRowsetReader::iterator:

Public Member Functions

virtual PyRep::PyType GetType (size_t index) const =0
 
virtual bool IsNone (size_t index) const
 
virtual bool GetBool (size_t index) const =0
 
virtual uint32 GetInt (size_t index) const =0
 
virtual int64 GetLong (size_t index) const =0
 
virtual double GetFloat (size_t index) const =0
 
virtual const char * GetString (size_t index) const =0
 
virtual const char * GetWString (size_t index) const =0
 
std::string GetAsString (size_t index) const
 
const iteratoroperator++ ()
 
const iteratoroperator++ (int)
 
const iteratoroperator-- ()
 
const iteratoroperator-- (int)
 
bool operator== (const iterator &oth) const
 
bool operator!= (const iterator &oth) const
 

Protected Member Functions

 iterator ()
 
virtual size_t _rowIndex () const
 
virtual BaseRowsetReader_baseReader () const =0
 
virtual void _SetRow (size_t rowIndex)
 

Protected Attributes

size_t mRowIndex
 

Detailed Description

Definition at line 49 of file RowsetReader.h.

Constructor & Destructor Documentation

BaseRowsetReader::iterator::iterator ( )
protected

Definition at line 51 of file RowsetReader.cpp.

52 : mRowIndex( -1 )
53 {
54 }

Member Function Documentation

virtual BaseRowsetReader* BaseRowsetReader::iterator::_baseReader ( ) const
protectedpure virtual

Implemented in TuplesetReader::iterator, and RowsetReader::iterator.

Referenced by operator==().

Here is the caller graph for this function:

virtual size_t BaseRowsetReader::iterator::_rowIndex ( ) const
inlineprotectedvirtual

Definition at line 76 of file RowsetReader.h.

References mRowIndex.

Referenced by operator==().

76 { return mRowIndex; }

Here is the caller graph for this function:

virtual void BaseRowsetReader::iterator::_SetRow ( size_t  rowIndex)
inlineprotectedvirtual

Reimplemented in TuplesetReader::iterator, and RowsetReader::iterator.

Definition at line 79 of file RowsetReader.h.

References mRowIndex.

Referenced by RowsetReader::iterator::_SetRow(), and TuplesetReader::iterator::_SetRow().

79 { mRowIndex = rowIndex; }

Here is the caller graph for this function:

std::string BaseRowsetReader::iterator::GetAsString ( size_t  index) const

Definition at line 56 of file RowsetReader.cpp.

References PyObjectEx_Type1::GetType(), PyRep::PyTypeBool, PyRep::PyTypeFloat, PyRep::PyTypeInt, PyRep::PyTypeLong, PyRep::PyTypeNone, PyRep::PyTypeString, PyRep::PyTypeWString, SearchReplace(), and snprintf.

57 {
58  const PyRep::PyType t = GetType( index );
59 
60  switch( t )
61  {
62  case PyRep::PyTypeNone:
63  return "None";
64  case PyRep::PyTypeBool:
65  return std::to_string( GetBool( index ) ? 1 : 0 );
66  case PyRep::PyTypeInt:
67  return std::to_string( GetInt( index ) );
68  case PyRep::PyTypeLong:
69  return std::to_string( GetLong( index ) );
70  case PyRep::PyTypeFloat:
71  {
72  char buf[64];
73  snprintf( buf, 64, "%f", GetFloat( index ) );
74  return buf;
75  }
77  {
78  std::string str = GetString( index );
79  SearchReplace( str, "'", "\\'" );
80 
81  str.insert( str.begin(), '\'' );
82  str.insert( str.end(), '\'' );
83 
84  return str;
85  }
87  {
88  std::string str = GetWString( index );
89  SearchReplace( str, "'", "\\'" );
90 
91  str.insert( str.begin(), '\'' );
92  str.insert( str.end(), '\'' );
93 
94  return str;
95  }
96  default:
97  {
98  char buf[64];
99  snprintf( buf, 64, "'UNKNOWN TYPE %u'", t );
100  return buf;
101  }
102  }
103 }
virtual int64 GetLong(size_t index) const =0
virtual const char * GetString(size_t index) const =0
virtual bool GetBool(size_t index) const =0
virtual PyRep::PyType GetType(size_t index) const =0
#define snprintf
Definition: eve-compat.h:184
PyType
Python wire object types.
Definition: PyRep.h:72
virtual double GetFloat(size_t index) const =0
virtual const char * GetWString(size_t index) const =0
virtual uint32 GetInt(size_t index) const =0
void SearchReplace(std::string &subject, const std::string &search, const std::string &replace)
Does search & replace on subject.

Here is the call graph for this function:

virtual bool BaseRowsetReader::iterator::GetBool ( size_t  index) const
pure virtual

Implemented in PyRowsetReader::iterator.

virtual double BaseRowsetReader::iterator::GetFloat ( size_t  index) const
pure virtual

Implemented in PyRowsetReader::iterator.

virtual uint32 BaseRowsetReader::iterator::GetInt ( size_t  index) const
pure virtual

Implemented in PyRowsetReader::iterator.

virtual int64 BaseRowsetReader::iterator::GetLong ( size_t  index) const
pure virtual

Implemented in PyRowsetReader::iterator.

virtual const char* BaseRowsetReader::iterator::GetString ( size_t  index) const
pure virtual

Implemented in PyRowsetReader::iterator.

virtual PyRep::PyType BaseRowsetReader::iterator::GetType ( size_t  index) const
pure virtual

Implemented in PyRowsetReader::iterator.

Referenced by IsNone().

Here is the caller graph for this function:

virtual const char* BaseRowsetReader::iterator::GetWString ( size_t  index) const
pure virtual

Implemented in PyRowsetReader::iterator.

virtual bool BaseRowsetReader::iterator::IsNone ( size_t  index) const
inlinevirtual

Reimplemented in PyRowsetReader::iterator.

Definition at line 53 of file RowsetReader.h.

References GetType(), and PyRep::PyTypeNone.

Referenced by PyRowsetReader::iterator::IsNone().

53 { return ( PyRep::PyTypeNone == GetType( index ) ); }
virtual PyRep::PyType GetType(size_t index) const =0

Here is the call graph for this function:

Here is the caller graph for this function:

bool BaseRowsetReader::iterator::operator!= ( const iterator oth) const
inline

Definition at line 71 of file RowsetReader.h.

71 { return !( *this == oth ); }
const BaseRowsetReader::iterator & BaseRowsetReader::iterator::operator++ ( )

Definition at line 105 of file RowsetReader.cpp.

References BaseRowsetReader::rowCount().

106 {
107  if( _baseReader()->rowCount() > _rowIndex() )
108  _SetRow( _rowIndex() + 1 );
109 
110  return *this;
111 }
virtual size_t rowCount() const =0
virtual BaseRowsetReader * _baseReader() const =0
virtual void _SetRow(size_t rowIndex)
Definition: RowsetReader.h:79
virtual size_t _rowIndex() const
Definition: RowsetReader.h:76

Here is the call graph for this function:

const iterator& BaseRowsetReader::iterator::operator++ ( int  )
inline

Definition at line 66 of file RowsetReader.h.

66 { return ++*this; }
const BaseRowsetReader::iterator & BaseRowsetReader::iterator::operator-- ( )

Definition at line 113 of file RowsetReader.cpp.

114 {
115  if( 0 < _rowIndex() )
116  _SetRow( _rowIndex() - 1 );
117 
118  return *this;
119 }
virtual void _SetRow(size_t rowIndex)
Definition: RowsetReader.h:79
virtual size_t _rowIndex() const
Definition: RowsetReader.h:76
const iterator& BaseRowsetReader::iterator::operator-- ( int  )
inline

Definition at line 68 of file RowsetReader.h.

68 { return --*this; }
bool BaseRowsetReader::iterator::operator== ( const iterator oth) const

Definition at line 121 of file RowsetReader.cpp.

References _baseReader(), and _rowIndex().

122 {
123  if( _baseReader() != other._baseReader() )
124  return false;
125  else if( _rowIndex() != other._rowIndex() )
126  return false;
127  return true;
128 }
virtual BaseRowsetReader * _baseReader() const =0
virtual size_t _rowIndex() const
Definition: RowsetReader.h:76

Here is the call graph for this function:

Member Data Documentation

size_t BaseRowsetReader::iterator::mRowIndex
protected

Definition at line 81 of file RowsetReader.h.

Referenced by _rowIndex(), and _SetRow().


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