classPiiStringFormatter
#include <PiiStringFormatter.h>
An operation that composes formatted strings out of data read from a configurable number of inputs.
Inherits PiiDefaultOperation
Description
Outputs
Properties
|
Format string. |
Constructors and destructor
Public member functions
|
( )
|
|
|
void
|
Protected member functions
|
virtual void
|
( )
Executes one round of processing. |
Property details
-
QString format
[read, write]Format string.
Use "%0", "%1", etc. to insert the data read from
input0,input1, etc. The default value is "%0". Setting this property automatically changes the number of input sockets to match the number of distinct argument places in the format string. For example "%0 %3 %0" as the format string adds two inputs to the operation. If the number of argument places is zero, one input will still be retained.PiiOperation* op = engine.createOperation("PiiStringFormatter"); // This will add two inputs to the operation. op->setProperty("format", "%0 (%1)"); otherOp->connectOutput("int output", op, "input0"); otherOp2->connectOutput("bool output", op, "input1"); // output now emits something like // 0 (false) // 1 (true) // 2 (false)
Function details
-
PiiStringFormatter
() -
QString format
() -
void setFormat
-
virtual void process
()[protected, virtual]Executes one round of processing.
This function is invoked by the processor if the necessary preconditions for a new processing round are met. This function does all the necessary calculations to create output objects and sends them to output sockets.
Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling process().
Note: With time-consuming operations, one should occasionally check that the operation hasn't been interrupted, i.e. that state() returns
Running.Exceptions
- PiiExecutionException
-
whenever an unrecoverable error occurs during a processing round, the operation is interrupted, or finishes execution due to end of input data.
Reimplemented from PiiDefaultOperation.
Add a note
Not a single note added yet. Be the first, add yours.