| QxOrm 1.2.2 C++ Object Relational Mapping library

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

Classes | Namespaces | Defines
QxForeach.h File Reference
QxCollection : QxOrm library container (keep insertion order + quick access by index + quick access by key)

foreach-style (based on BOOST_FOREACH macro) to iterate over all stl, boost and Qt containers + qx::QxCollection<Key, Value> QxOrm library container More...

`#include <boost/foreach.hpp>`
`#include <QxTraits/is_qx_collection.h>`

Go to the source code of this file.

## Classes
struct | qx::foreach::qx_deref_boost_or_qx< T, C, is_qx_collection >
struct | qx::foreach::qx_deref_boost_or_qx< T, C, true >
struct | qx::foreach::qx_deref_deduce< T, C, is_qx_collection >
struct | qx::foreach::qx_deref_deduce< T, C, true >
struct | qx::foreach::qx_deref
## Namespaces
namespace | qx
| Root namespace for all QxOrm library features.
namespace | qx::foreach
| Foreach-style (based on BOOST_FOREACH macro) to iterate over all stl, boost and Qt containers + qx::QxCollection<Key, Value> QxOrm library container.
## Defines
#define | BOOST_FOREACH_ID(x) x
#define | QX_FOREACH_DEREF(COL) qx::foreach::qx_deref::deref(BOOST_FOREACH_ID(_foreach_cur), BOOST_FOREACH_TYPEOF(COL))
#define | QX_FOREACH_DEREF_REVERSE(COL) qx::foreach::qx_deref::deref_reverse(BOOST_FOREACH_ID(_foreach_cur), BOOST_FOREACH_TYPEOF(COL))
#define | QX_FOREACH(VAR, COL)
#define | QX_FOREACH_REVERSE(VAR, COL)
#define | _foreach QX_FOREACH
#define | _foreach_reverse QX_FOREACH_REVERSE
#define | _foreach_if(VAR, COL, COND) _foreach(VAR, COL) if (COND)
#define | _foreach_reverse_if(VAR, COL, COND) _foreach_reverse(VAR, COL) if (COND)

## Detailed Description

foreach-style (based on BOOST_FOREACH macro) to iterate over all stl, boost and Qt containers + qx::QxCollection<Key, Value> QxOrm library container

Author:
  Lionel Marty

Quick sample using QX_FOREACH (or _foreach) macro :

    // iterate over drugs container using QxOrm '_foreach' keyword
    _foreach(drug_ptr p, lstDrugs)
    { qDebug() << qPrintable(p->name) << " " << qPrintable(p->desc); }

Note:
  QxOrm library provides also other macros to iterator over all containers : _foreach_reverse, _foreach_if, _foreach_reverse_if

Definition in file QxForeach.h.

## Define Documentation

#define _foreach QX_FOREACH

Definition at line 158 of file QxForeach.h.

#define _foreach_if | ( |  | VAR,
|  |  | COL,
|  |  | COND
| ) |  | _foreach(VAR, COL) if (COND)

Definition at line 161 of file QxForeach.h.

#define _foreach_reverse QX_FOREACH_REVERSE

Definition at line 159 of file QxForeach.h.

#define _foreach_reverse_if | ( |  | VAR,
|  |  | COL,
|  |  | COND
| ) |  | _foreach_reverse(VAR, COL) if (COND)

Definition at line 162 of file QxForeach.h.

#define BOOST_FOREACH_ID | ( |  | x | ) | x

Definition at line 52 of file QxForeach.h.

#define QX_FOREACH | ( |  | VAR,
|  |  | COL
| ) |  |

Value:

    BOOST_FOREACH_PREAMBLE()                                                                     \
       if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_col) = BOOST_FOREACH_CONTAIN(COL)) {} else    \
       if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_BEGIN(COL)) {} else      \
       if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_end) = BOOST_FOREACH_END(COL)) {} else        \
       for (bool BOOST_FOREACH_ID(_foreach_continue) = true;                                                          \
             BOOST_FOREACH_ID(_foreach_continue) && !BOOST_FOREACH_DONE(COL);                                         \
             BOOST_FOREACH_ID(_foreach_continue) ? BOOST_FOREACH_NEXT(COL) : (void)0)                                 \
          if  (boost::foreach_detail_::set_false(BOOST_FOREACH_ID(_foreach_continue))) {} else                        \
          for (VAR = QX_FOREACH_DEREF(COL); !BOOST_FOREACH_ID(_foreach_continue); BOOST_FOREACH_ID(_foreach_continue) = true)

Definition at line 120 of file QxForeach.h.

#define QX_FOREACH_DEREF | ( |  | COL | ) | qx::foreach::qx_deref::deref(BOOST_FOREACH_ID(_foreach_cur), BOOST_FOREACH_TYPEOF(COL))

Definition at line 114 of file QxForeach.h.

#define QX_FOREACH_DEREF_REVERSE | ( |  | COL | ) | qx::foreach::qx_deref::deref_reverse(BOOST_FOREACH_ID(_foreach_cur), BOOST_FOREACH_TYPEOF(COL))

Definition at line 117 of file QxForeach.h.

#define QX_FOREACH_REVERSE | ( |  | VAR,
|  |  | COL
| ) |  |

Value:

    BOOST_FOREACH_PREAMBLE()                                                                     \
       if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_col) = BOOST_FOREACH_CONTAIN(COL)) {} else    \
       if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_RBEGIN(COL)) {} else     \
       if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_end) = BOOST_FOREACH_REND(COL)) {} else       \
       for (bool BOOST_FOREACH_ID(_foreach_continue) = true;                                                          \
             BOOST_FOREACH_ID(_foreach_continue) && !BOOST_FOREACH_RDONE(COL);                                        \
             BOOST_FOREACH_ID(_foreach_continue) ? BOOST_FOREACH_RNEXT(COL) : (void)0)                                \
          if  (boost::foreach_detail_::set_false(BOOST_FOREACH_ID(_foreach_continue))) {} else                        \
          for (VAR = QX_FOREACH_DEREF_REVERSE(COL); !BOOST_FOREACH_ID(_foreach_continue); BOOST_FOREACH_ID(_foreach_continue) = true)

Definition at line 131 of file QxForeach.h.