OpenDDS  Snapshot(2023/04/28-20:55)
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 1103 of file dds_generator.h.

Member Typedef Documentation

◆ iterator_category

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

Definition at line 1108 of file dds_generator.h.

◆ pointer

typedef AST_Field** Fields::Iterator::pointer

Definition at line 1106 of file dds_generator.h.

◆ reference

typedef AST_Field*& Fields::Iterator::reference

Definition at line 1107 of file dds_generator.h.

◆ value_type

typedef AST_Field* Fields::Iterator::value_type

Definition at line 1105 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 1110 of file dds_generator.h.

1111  : node_(node)
1112  , pos_(pos)
1114  {
1115  validate_pos();
1116  }
static bool explicit_keys_only(AST_Structure *node, FieldFilter filter)
AST_Structure * node() const
unsigned pos() const
AST_Structure * node_

Member Function Documentation

◆ check()

bool Fields::Iterator::check ( )
inline

Definition at line 1123 of file dds_generator.h.

1124  {
1125  if (!valid()) {
1126  if (node_) {
1127  *this = Iterator();
1128  }
1129  return false;
1130  }
1131  return true;
1132  }
Iterator(AST_Structure *node=0, unsigned pos=0, bool explicit_keys_only=false)
bool valid() const
AST_Structure * node_

◆ operator!=()

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

Definition at line 1171 of file dds_generator.h.

1172  {
1173  return !(*this == other);
1174  }

◆ operator*()

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

Definition at line 1159 of file dds_generator.h.

References get_struct_field().

1160  {
1161  return get_struct_field(node_, pos_);
1162  }
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 1145 of file dds_generator.h.

1146  {
1147  ++pos_;
1148  validate_pos();
1149  return *this;
1150  }

◆ operator++() [2/2]

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

Definition at line 1152 of file dds_generator.h.

1153  {
1154  Iterator prev(*this);
1155  ++(*this);
1156  return prev;
1157  }
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 1164 of file dds_generator.h.

References explicit_keys_only_, node_, and pos_.

1165  {
1166  return node_ == other.node_
1167  && pos_ == other.pos_
1168  && explicit_keys_only_ == other.explicit_keys_only_;
1169  }
AST_Structure * node_

◆ pos()

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

Definition at line 1140 of file dds_generator.h.

1141  {
1142  return pos_;
1143  }

◆ valid()

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

Definition at line 1118 of file dds_generator.h.

1119  {
1120  return node_ && pos_ < node_->nfields();
1121  }
AST_Structure * node_

◆ validate_pos()

void Fields::Iterator::validate_pos ( )
inline

Definition at line 1134 of file dds_generator.h.

References be_global.

1135  {
1136  for (; check() && explicit_keys_only_ && !be_global->is_key(**this); ++pos_) {
1137  }
1138  }
BE_GlobalData * be_global
Definition: be_global.cpp:44

Member Data Documentation

◆ explicit_keys_only_

bool Fields::Iterator::explicit_keys_only_
private

Definition at line 1179 of file dds_generator.h.

Referenced by operator==().

◆ node_

AST_Structure* Fields::Iterator::node_
private

Definition at line 1177 of file dds_generator.h.

Referenced by operator==().

◆ pos_

unsigned Fields::Iterator::pos_
private

Definition at line 1178 of file dds_generator.h.

Referenced by operator==().


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