PrintStatement Struct Reference
A sed print statement, usually specified in one of the following forms:
More...
#include <muSED.h>
List of all members.
Public Member Functions |
LineRangeActivationState | activationState () |
bool | active (ScriptRuntimeContext *context, Statement *statement) |
| return true if the patternBuffer, line number, and isLast_ flag in the specified context match the requirements of the filters.
|
void | adoptChild (Statement *newbie) |
| Take ownership of a new statement and schedule it for delete when *this is destructed.
|
void | clear () |
std::string | debugPrefix () const |
virtual std::string | debugString () const |
virtual std::string | debugStringPrefix () const |
bool | execute (ScriptRuntimeContext *context) |
| Invoke context->Print().
|
| PrintStatement (Statement *parent, int fc, Filter const &f1, Filter const &f2, bool filtersInverted, bool firstLineOnly) |
void | setActivationState (LineRangeActivationState newState) |
virtual | ~PrintStatement () |
Static Public Member Functions |
static void | debugPrint (Statement *p) |
template<class StringIterator1 , class StringIterator2 , class CompiledScript > |
static Statement * | parse (Statement *parent, int filterCount, Filter const &f1, Filter const &f2, bool inverted, StringIterator1 &firstChar, StringIterator2 const &lastChar, size_t line, CompiledScript &script) |
Public Attributes |
ActivationMap | childStatementActivationMap_ |
std::list< Statement * > | childStatements_ |
Filter | filter1_ |
Filter | filter2_ |
int | filters_ |
bool | firstLineOnly_ |
| If true, print only up to the first \n character found in the pattern buffer.
|
bool | inverted_ |
Statement * | parentStatement_ |
Detailed Description
A sed print statement, usually specified in one of the following forms:
p # prints the whole pattern buffer
P # prints only up to the first \\n.
Prints the contents of the sed pattern buffer. A "print" operation output one or more strings into the output sequence associated with the script's runtmie context. See the muSED::ScriptRuntimeContext::print()
Note that the two different forms of the statement behave slightly differently with respect to \n characters in the pattern buffer. In the unix sed executable, the pattern buffer will only have \n characters in it if the script itself puts them there -- as lines are automatically split before script processing. This input splitting does not occur in muSED. The caller may include \n in the input strings.
The script can force \n characters into the pattern buffer in the following ways:
- the 'y' command can translate any character into a \n
- the 's' command can replace any sequence of charactes into a \n
- the 'G' command can append the hold buffer to the pattern buffer using \n as a delimiter
- the 'x' command can swap the pattern buffer with the hold buffer which might have \n in it if the H command were previously used to append the pattern buffer to the hold buffer.
The 'P' command prints only up to the first \n in the pattern buffer to the output sequences (or the whole pattern buffer if there is no \n).
The 'p' command prints each \n delimited component of the the pattern buffer to the output sequences.
Definition at line 1036 of file muSED.h.
Constructor & Destructor Documentation
Member Function Documentation
return true if the patternBuffer, line number, and isLast_ flag in the specified context match the requirements of the filters.
- Parameters:
-
[in] | context | The runtime context in which to determine if the current statement, as defined both by the statement pointer and by line number information in the context, is active. |
[in] | statement | The statement about to be executed on the current line of input as defined by the line number and is last flag in the context. |
Note that the runtime context keeps track of the activation status of statements, by the statement pointer, based on the filters in a filterable statement. Whenever you have a range filter, the activate function manages the activation state.
Definition at line 316 of file muSED.cxx.
void adoptChild |
( |
Statement * |
newbie |
) |
[inherited] |
Take ownership of a new statement and schedule it for delete when *this is destructed.
Definition at line 444 of file muSED.h.
void clear |
( |
|
) |
[inherited] |
std::string debugPrefix |
( |
|
) |
const [inherited] |
static void debugPrint |
( |
Statement * |
p |
) |
[static, inherited] |
std::string debugString |
( |
|
) |
const [virtual] |
std::string debugStringPrefix |
( |
|
) |
const [virtual, inherited] |
static Statement* parse |
( |
Statement * |
parent, |
|
|
int |
filterCount, |
|
|
Filter const & |
f1, |
|
|
Filter const & |
f2, |
|
|
bool |
inverted, |
|
|
StringIterator1 & |
firstChar, |
|
|
StringIterator2 const & |
lastChar, |
|
|
size_t |
line, |
|
|
CompiledScript & |
script | |
|
) |
| | [static] |
Member Data Documentation
If true, print only up to the first \n character found in the pattern buffer.
Definition at line 1079 of file muSED.h.
The documentation for this struct was generated from the following files: