Qt 4.8
Public Types | Public Functions | Properties | List of all members
QPatternist::TraceCallback Class Reference

TraceCallback is a MappingCallback and takes care of the tracing of each individual item. More...

Inheritance diagram for QPatternist::TraceCallback:
QSharedData

Public Types

typedef QExplicitlySharedDataPointer< TraceCallbackPtr
 

Public Functions

Item mapToItem (const Item &item, const DynamicContext::Ptr &context)
 
 TraceCallback (const QString &msg)
 
- Public Functions inherited from QSharedData
 QSharedData ()
 Constructs a QSharedData object with a reference count of 0. More...
 
 QSharedData (const QSharedData &)
 Constructs a QSharedData object with reference count 0. More...
 

Properties

const QString m_msg
 
xsInteger m_position
 

Additional Inherited Members

- Public Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

TraceCallback is a MappingCallback and takes care of the tracing of each individual item.

Because Patternist must be thread safe, TraceFN creates a TraceCallback each time the function is evaluated. In other words, TraceFN, which is an Expression sub class, can't modify its members, but MappingCallback does not have this limitation since it's created on a per evaluation basis.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 66 of file qtracefn.cpp.

Typedefs

◆ Ptr

Definition at line 69 of file qtracefn.cpp.

Constructors and Destructors

◆ TraceCallback()

QPatternist::TraceCallback::TraceCallback ( const QString msg)
inline

Definition at line 71 of file qtracefn.cpp.

Referenced by QPatternist::TraceFN::evaluateSequence(), and QPatternist::TraceFN::evaluateSingleton().

71  : m_position(0),
72  m_msg(msg)
73  {
74  }

Functions

◆ mapToItem()

Item QPatternist::TraceCallback::mapToItem ( const Item item,
const DynamicContext::Ptr context 
)
inline

Performs the actual tracing.

Definition at line 79 of file qtracefn.cpp.

81  {
82  QTextStream out(stderr);
83  ++m_position;
84  if(m_position == 1)
85  {
86  if(item)
87  {
88  out << qPrintable(m_msg)
89  << " : "
90  << qPrintable(item.stringValue());
91  }
92  else
93  {
94  out << qPrintable(m_msg)
95  << " : ("
97  << ")\n";
98  return Item();
99  }
100  }
101  else
102  {
103  out << qPrintable(item.stringValue())
104  << '['
105  << m_position
106  << "]\n";
107  }
108 
109  return item;
110  }
virtual NamePool::Ptr namePool() const =0
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
QString stringValue() const
Returns the string value of this Item.
Definition: qitem_p.h:302
static const EmptySequenceType::Ptr Empty
Represents an item in the XPath 2.0 Data Model.
Definition: qitem_p.h:182
The QTextStream class provides a convenient interface for reading and writing text.
Definition: qtextstream.h:73
#define qPrintable(string)
Definition: qglobal.h:1750

Properties

◆ m_msg

const QString QPatternist::TraceCallback::m_msg
private

Definition at line 114 of file qtracefn.cpp.

Referenced by mapToItem().

◆ m_position

xsInteger QPatternist::TraceCallback::m_position
private

Definition at line 113 of file qtracefn.cpp.

Referenced by mapToItem().


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