OpenDDS  Snapshot(2023/04/07-19:43)
Public Types | Public Member Functions | Private Attributes | List of all members
Fields::Iterator Class Reference

#include <dds_generator.h>

Public Types

typedef AST_Field * value_type
 
typedef AST_Field ** pointer
 
typedef AST_Field *& reference
 
typedef std::input_iterator_tag iterator_category
 

Public Member Functions

 Iterator (AST_Structure *node=0, unsigned pos=0, bool explicit_keys_only=false)
 
bool valid () const
 
bool check ()
 
void validate_pos ()
 
unsigned pos () const
 
Iteratoroperator++ ()
 
Iterator operator++ (int)
 
AST_Field * operator* () const
 
bool operator== (const Iterator &other) const
 
bool operator!= (const Iterator &other) const
 

Private Attributes

AST_Structure * node_
 
unsigned pos_
 
bool explicit_keys_only_
 

Detailed Description

Definition at line 1074 of file dds_generator.h.

Member Typedef Documentation

◆ iterator_category

typedef std::input_iterator_tag Fields::Iterator::iterator_category

Definition at line 1079 of file dds_generator.h.

◆ pointer

typedef AST_Field** Fields::Iterator::pointer

Definition at line 1077 of file dds_generator.h.

◆ reference

typedef AST_Field*& Fields::Iterator::reference

Definition at line 1078 of file dds_generator.h.

◆ value_type

typedef AST_Field* Fields::Iterator::value_type

Definition at line 1076 of file dds_generator.h.

Constructor & Destructor Documentation

◆ Iterator()

Fields::Iterator::Iterator ( AST_Structure *  node = 0,
unsigned  pos = 0,
bool  explicit_keys_only = false 
)
inlineexplicit

Definition at line 1081 of file dds_generator.h.

1082  : node_(node)
1083  , pos_(pos)
1085  {
1086  validate_pos();
1087  }
AST_Structure * node_
static bool explicit_keys_only(AST_Structure *node, FieldFilter filter)
AST_Structure * node() const
unsigned pos() const

Member Function Documentation

◆ check()

bool Fields::Iterator::check ( )
inline

Definition at line 1094 of file dds_generator.h.

1095  {
1096  if (!valid()) {
1097  if (node_) {
1098  *this = Iterator();
1099  }
1100  return false;
1101  }
1102  return true;
1103  }
AST_Structure * node_
bool valid() const
Iterator(AST_Structure *node=0, unsigned pos=0, bool explicit_keys_only=false)

◆ operator!=()

bool Fields::Iterator::operator!= ( const Iterator other) const
inline

Definition at line 1142 of file dds_generator.h.

1143  {
1144  return !(*this == other);
1145  }

◆ operator*()

AST_Field* Fields::Iterator::operator* ( void  ) const
inline

Definition at line 1130 of file dds_generator.h.

References get_struct_field().

1131  {
1132  return get_struct_field(node_, pos_);
1133  }
AST_Structure * node_
AST_Field * get_struct_field(AST_Structure *struct_node, unsigned index)

◆ operator++() [1/2]

Iterator& Fields::Iterator::operator++ ( void  )
inline

Definition at line 1116 of file dds_generator.h.

1117  {
1118  ++pos_;
1119  validate_pos();
1120  return *this;
1121  }

◆ operator++() [2/2]

Iterator Fields::Iterator::operator++ ( int  )
inline

Definition at line 1123 of file dds_generator.h.

1124  {
1125  Iterator prev(*this);
1126  ++(*this);
1127  return prev;
1128  }
Iterator(AST_Structure *node=0, unsigned pos=0, bool explicit_keys_only=false)

◆ operator==()

bool Fields::Iterator::operator== ( const Iterator other) const
inline

Definition at line 1135 of file dds_generator.h.

References explicit_keys_only_, node_, and pos_.

1136  {
1137  return node_ == other.node_
1138  && pos_ == other.pos_
1139  && explicit_keys_only_ == other.explicit_keys_only_;
1140  }
AST_Structure * node_

◆ pos()

unsigned Fields::Iterator::pos ( ) const
inline

Definition at line 1111 of file dds_generator.h.

1112  {
1113  return pos_;
1114  }

◆ valid()

bool Fields::Iterator::valid ( void  ) const
inline

Definition at line 1089 of file dds_generator.h.

1090  {
1091  return node_ && pos_ < node_->nfields();
1092  }
AST_Structure * node_

◆ validate_pos()

void Fields::Iterator::validate_pos ( )
inline

Definition at line 1105 of file dds_generator.h.

References be_global.

1106  {
1107  for (; check() && explicit_keys_only_ && !be_global->is_key(**this); ++pos_) {
1108  }
1109  }
BE_GlobalData * be_global
Definition: be_global.cpp:43

Member Data Documentation

◆ explicit_keys_only_

bool Fields::Iterator::explicit_keys_only_
private

Definition at line 1150 of file dds_generator.h.

Referenced by operator==().

◆ node_

AST_Structure* Fields::Iterator::node_
private

Definition at line 1148 of file dds_generator.h.

Referenced by operator==().

◆ pos_

unsigned Fields::Iterator::pos_
private

Definition at line 1149 of file dds_generator.h.

Referenced by operator==().


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