*
* The output is sorted by key.
*
- * @param fp target file
+ * @param writer writes to output
* @param map map to dump
* @param withEndOfLine true: '\n' will be written at the end
*/
-void dumpMap(FILE* fp, RplASMapOfVariants& map, bool withEndOfLine)
+void dumpMap(RplWriter& writer, RplASMapOfVariants& map, bool withEndOfLine)
{
QList<QString> sorted;
sorted.reserve(map.size());
bool first = true;
for (it2 = sorted.begin(); it2 != sorted.end(); it2++){
RplASVariant* value = map[*it2];
- fprintf(fp, "%c'%s':%s", first ? '{' : ',', (*it2).toUtf8().constData(),
+ writer.format("%c'%s':%s", first ? '{' : ',', (*it2).toUtf8().constData(),
value->toString().toUtf8().constData());
first = false;
}
- fprintf(fp, "%s}%s", first ? "{" : "", withEndOfLine ? "\n" : "");
+ if (first)
+ writer.write("{");
+ writer.write("}");
+ if (withEndOfLine)
+ writer.writeLine();
}
/** @class RplASException rplastree.hpp "rplexpr/rplastree.hpp"
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASConstant::dump(FILE* fp, int indent)
+void RplASConstant::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%sconst id: %d value: %s %s\n", tabs, m_id,
+ writer.formatIndented(indent, "const id: %d value: %s %s", m_id,
m_value.toString().toUtf8().constData(),
positionStr(buffer, sizeof buffer));
}
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASListConstant::dump(FILE* fp, int indent)
+void RplASListConstant::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%slistConst id: %d %s\n", tabs, m_id,
+ writer.formatIndented(indent, "listConst id: %d %s", m_id,
positionStr(buffer, sizeof buffer));
QString sValue = m_value.toString(8092);
- fprintf(fp, "%s\t%s\n", tabs, sValue.toUtf8().constData());
+ writer.writeIndented(indent + 1, sValue.toUtf8().constData());
}
/**
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASMapConstant::dump(FILE* fp, int indent)
+void RplASMapConstant::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%smapConst id: %d %s\n%s", tabs,
- m_id, positionStr(buffer, sizeof buffer), tabs);
- dumpMap(fp, *map(), true);
+ writer.formatIndented(indent, "mapConst id: %d %s",
+ m_id, positionStr(buffer, sizeof buffer));
+ writer.indent(indent);
+ dumpMap(writer, *map(), true);
}
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASNamedValue::dump(FILE* fp, int indent)
+void RplASNamedValue::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%snamedValue %s id: %d attr: 0x%x %s\n", tabs,
+ writer.formatIndented(indent, "namedValue %s id: %d attr: 0x%x %s",
m_name.toUtf8().constData(), m_id, m_attributes,
positionStr(buffer, sizeof buffer));
}
}
/**
- * @brief Writes the internals into a file.
+ * @brief Writes the internals into an output media.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASIndexedValue::dump(FILE* fp, int indent)
+void RplASIndexedValue::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%sindexedValue id: %d index: %d parent: %d %s\n", tabs,
+ writer.formatIndented(indent, "indexedValue id: %d index: %d parent: %d %s",
m_id, m_child2->id(), m_child->id(),
positionStr(buffer, sizeof buffer));
- m_child2->dump(fp, indent + 1);
- m_child->dump(fp, indent + 1);
+ m_child2->dump(writer, indent + 1);
+ m_child->dump(writer, indent + 1);
}
/** @class RplVarDefinition rplastree.hpp "rplexpr/rplastree.hpp"
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASVarDefinition::dump(FILE* fp, int indent)
+void RplASVarDefinition::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
RplASNamedValue* namedValue = dynamic_cast<RplASNamedValue*>(m_child2);
QByteArray name = namedValue->name().toUtf8();
char buffer[256];
- fprintf(fp, "%svarDef %s id: %d namedValue: %d value: %d succ: %d %s\n",
- tabs, name.constData(), m_id,
+ writer.formatIndented(indent, "varDef %s id: %d namedValue: %d value: %d succ: %d %s",
+ name.constData(), m_id,
m_child2 == NULL ? 0 : m_child2->id(),
m_child3 == NULL ? 0 : m_child3->id(),
m_child == NULL ? 0 : m_child->id(),
positionStr(buffer, sizeof buffer));
if (m_child2 != NULL)
- m_child2->dump(fp, indent + 1);
+ m_child2->dump(writer, indent + 1);
if (m_child3 != NULL)
- m_child3->dump(fp, indent + 1);
+ m_child3->dump(writer, indent + 1);
}
/**
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASExprStatement::dump(FILE* fp, int indent)
+void RplASExprStatement::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
if (m_id == 40)
m_id = 40;
- fprintf(fp, "%sExpr id: %d expr: %d succ: %d %s\n", tabs, m_id,
+ writer.formatIndented(indent, "Expr id: %d expr: %d succ: %d %s", m_id,
m_child2 == NULL ? 0 : m_child2->id(),
m_child == NULL ? 0 : m_child->id(),
positionStr(buffer, sizeof buffer));
if (m_child2 != NULL)
- m_child2->dump(fp, indent + 1);
+ m_child2->dump(writer, indent + 1);
}
/** @class RplASNode1 rplastree.hpp "rplexpr/rplastree.hpp"
/**
* @brief Writes the internals of a statement list into a file.
*
- * @param fp file to write
+ * @param writer writes to output media
* @param indent the indent level of the statement list
* @param chain the chain of statements to dump
*/
-void RplASNode1::dumpStatements(FILE* fp, int indent, RplASItem* statements)
+void RplASNode1::dumpStatements(RplWriter& writer, int indent,
+ RplASItem* statements)
{
RplASNode1* chain = dynamic_cast<RplASNode1*>(statements);
while (chain != NULL){
- chain->dump(fp, indent);
+ chain->dump(writer, indent);
chain = dynamic_cast<RplASNode1*>(chain->m_child);
}
}
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASUnaryOp::dump(FILE* fp, int indent)
+void RplASUnaryOp::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%sUnary %d op: %s (%d) expr: %d %s\n", tabs,
+ writer.formatIndented(indent, "Unary %d op: %s (%d) expr: %d %s",
m_id,
RplLexer::m_active->nameOfOp(m_operator).constData(),
m_operator,
m_child == NULL ? 0 : m_child->id(),
positionStr(buffer, sizeof buffer) );
if (m_child != NULL)
- m_child->dump(fp, indent + 1);
+ m_child->dump(writer, indent + 1);
}
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASCondition::dump(FILE* fp, int indent)
+void RplASCondition::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%sCondition %d Child: %d %s\n", tabs, m_id,
+ writer.formatIndented(indent, "Condition %d Child: %d %s", m_id,
m_child == NULL ? 0 : m_child->id(),
positionStr(buffer, sizeof buffer));
if (m_child != NULL)
- m_child->dump(fp, indent);
+ m_child->dump(writer, indent);
}
/** @class RplASIf rplastree.hpp "rplexpr/rplastree.hpp"
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASIf::dump(FILE* fp, int indent)
+void RplASIf::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%sIf id: %d condition: %d then: %d else: %d succ: %d%s\n", tabs,
+ writer.formatIndented(indent,
+ "If id: %d condition: %d then: %d else: %d succ: %d%s",
m_id,
m_child2 == NULL ? 0 : m_child2->id(),
m_child3 == NULL ? 0 : m_child3->id(),
m_child4 == NULL ? 0 : m_child4->id(),
m_child == NULL ? 0 : m_child->id(),
positionStr(buffer, sizeof buffer));
- m_child2->dump(fp, indent + 1);
+ m_child2->dump(writer, indent + 1);
if (m_child3 != NULL)
- m_child3->dump(fp, indent + 1);
+ m_child3->dump(writer, indent + 1);
if (m_child4 != NULL)
- m_child4->dump(fp, indent + 1);
+ m_child4->dump(writer, indent + 1);
}
/** @class RplASFor rplastree.hpp "rplexpr/rplastree.hpp"
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASForIterated::dump(FILE* fp, int indent)
+void RplASForIterated::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%sforIt id: %d var: %d set: %d body: %d succ: %d %s\n", tabs,
+ writer.formatIndented(indent, "forIt id: %d var: %d set: %d body: %d succ: %d %s",
m_id,
m_child3 == NULL ? 0 : m_child3->id(),
m_child4 == NULL ? 0 : m_child4->id(),
m_child == NULL ? 0 : m_child->id(),
positionStr(buffer, sizeof buffer));
if (m_child3 != NULL)
- m_child3->dump(fp, indent + 1);
+ m_child3->dump(writer, indent + 1);
if (m_child4 != NULL)
- m_child4->dump(fp, indent + 1);
- dumpStatements(fp, indent + 1, m_child2);
+ m_child4->dump(writer, indent + 1);
+ dumpStatements(writer, indent + 1, m_child2);
}
/** @class RplASForCounted rplastree.hpp "rplexpr/rplastree.hpp"
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASForCounted::dump(FILE* fp, int indent)
+void RplASForCounted::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%sforC id: %d var: %d from: %d to: %d step: %d body: %d succ: %d %s\n",
- tabs, m_id,
+ writer.formatIndented(indent, "forC id: %d var: %d from: %d to: %d step: %d body: %d succ: %d %s",
+ m_id,
m_child3 == NULL ? 0 : m_child3->id(),
m_child4 == NULL ? 0 : m_child4->id(),
m_child5 == NULL ? 0 : m_child5->id(),
m_child == NULL ? 0 : m_child->id(),
positionStr(buffer, sizeof buffer));
if (m_child3 != NULL)
- m_child3->dump(fp, indent + 1);
+ m_child3->dump(writer, indent + 1);
if (m_child4 != NULL)
- m_child4->dump(fp, indent + 1);
+ m_child4->dump(writer, indent + 1);
if (m_child5 != NULL)
- m_child5->dump(fp, indent + 1);
+ m_child5->dump(writer, indent + 1);
if (m_child6 != NULL)
- m_child6->dump(fp, indent + 1);
- dumpStatements(fp, indent + 1, m_child2);
+ m_child6->dump(writer, indent + 1);
+ dumpStatements(writer, indent + 1, m_child2);
}
/** @class RplASWhile rplastree.hpp "rplexpr/rplastree.hpp"
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASWhile::dump(FILE* fp, int indent)
+void RplASWhile::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
+
char buffer[256];
- fprintf(fp, "%swhile id: %d condition: %d body: %d succ: %d %s\n", tabs, m_id,
+ writer.formatIndented(indent, "while id: %d condition: %d body: %d succ: %d %s",
+ m_id,
m_child2 == NULL ? 0 : m_child2->id(),
m_child3 == NULL ? 0 : m_child3->id(),
m_child == NULL ? 0 : m_child->id(),
positionStr(buffer, sizeof buffer));
if (m_child2 != NULL)
- m_child2->dump(fp, indent + 1);
- dumpStatements(fp, indent + 1, m_child3);
+ m_child2->dump(writer, indent + 1);
+ dumpStatements(writer, indent + 1, m_child3);
}
/** @class RplASRepeat rplastree.hpp "rplexpr/rplastree.hpp"
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASRepeat::dump(FILE* fp, int indent)
+void RplASRepeat::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%srepeat id: %d condition: %d body: %d succ: %d %s\n", tabs, m_id,
+ writer.formatIndented(indent, "repeat id: %d condition: %d body: %d succ: %d %s",
+ m_id,
m_child2 == NULL ? 0 : m_child2->id(),
m_child3 == NULL ? 0 : m_child3->id(),
m_child == NULL ? 0 : m_child->id(),
positionStr(buffer, sizeof buffer));
if (m_child2 != NULL)
- m_child2->dump(fp, indent + 1);
- dumpStatements(fp, indent + 1, m_child3);
+ m_child2->dump(writer, indent + 1);
+ dumpStatements(writer, indent + 1, m_child3);
}
/** @class RplASClass rplastree.hpp "rplexpr/rplastree.hpp"
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASClass::dump(FILE* fp, int indent)
+void RplASClass::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
- fprintf(fp, "%sclass %s super: %s\n", tabs, m_name.toUtf8().constData(),
+ writer.formatIndented(indent, "class %s super: %s", m_name.toUtf8().constData(),
m_superClass == NULL
? "<none>" : m_superClass->name().toUtf8().constData());
- m_symbols->dump(fp, indent);
+ m_symbols->dump(writer, indent);
}
/**
*/
void RplASTree::dump(const char* filename, int flags, const char* header)
{
- FILE* fp = fopen(filename, "w");
- if (fp != NULL){
- if (header != NULL)
- fprintf(fp, "%s\n", header);
- if (flags & DMP_GLOBALS){
- m_global->dump(fp, 0, "=== Globals:");
+ RplFileWriter writer(filename);
+ if (header != NULL)
+ writer.writeLine(header);
+ if (flags & DMP_GLOBALS){
+ m_global->dump(writer, 0, "=== Globals:");
+ }
+ if (flags & DMP_MODULES){
+ QList<QString> sorted;
+ sorted.reserve(m_modules.size());
+ SymbolSpaceMap::iterator it;
+ for (it = m_modules.begin(); it != m_modules.end(); it++){
+ sorted.append(it.key());
}
- if (flags & DMP_MODULES){
- QList<QString> sorted;
- sorted.reserve(m_modules.size());
- SymbolSpaceMap::iterator it;
- for (it = m_modules.begin(); it != m_modules.end(); it++){
- sorted.append(it.key());
- }
- qSort(sorted.begin(), sorted.end(), qLess<QString>());
- QList<QString>::iterator it2;
- for (it2 = sorted.begin(); it2 != sorted.end(); it2++){
- RplSymbolSpace* space = m_modules[*it2];
- space->dump(fp, 0);
- }
+ qSort(sorted.begin(), sorted.end(), qLess<QString>());
+ QList<QString>::iterator it2;
+ for (it2 = sorted.begin(); it2 != sorted.end(); it2++){
+ RplSymbolSpace* space = m_modules[*it2];
+ space->dump(writer, 0);
}
- fclose(fp);
}
+ writer.close();
}
/** @class RplASMethodCall rplastree.hpp "rplexpr/rplastree.hpp"
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASMethodCall::dump(FILE* fp, int indent)
+void RplASMethodCall::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%scall %s Id: %d args: %d parent: %d succ: %d %s\n", tabs,
+ writer.formatIndented(indent, "call %s Id: %d args: %d parent: %d succ: %d %s",
m_name.toUtf8().constData(), m_id,
m_child2 == NULL ? 0 : m_child2->id(),
m_child3 == NULL ? 0 : m_child3->id(),
m_child == NULL ? 0 : m_child->id(),
positionStr(buffer, sizeof buffer));
if (m_child2 != NULL)
- m_child2->dump(fp, indent + 1);
+ m_child2->dump(writer, indent + 1);
if (m_child3 != NULL)
- m_child3->dump(fp, indent + 1);
+ m_child3->dump(writer, indent + 1);
}
/**
/**
* @brief Writes the internals into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASBinaryOp::dump(FILE* fp, int indent)
+void RplASBinaryOp::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
+
const QByteArray& opName = RplLexer::m_active->nameOfOp(m_operator);
char buffer[256];
- fprintf(fp, "%sBinOp id: %d op: %s (%d) left: %d right: %d %s\n",
- tabs, m_id,
+ writer.formatIndented(indent, "BinOp id: %d op: %s (%d) left: %d right: %d %s",
+ m_id,
opName.constData(), m_operator,
m_child == NULL ? 0 : m_child->id(),
m_child2 == NULL ? 0 : m_child2->id(),
positionStr(buffer, sizeof buffer));
if (indent < 32 && m_child != NULL)
- m_child->dump(fp, indent + 1);
+ m_child->dump(writer, indent + 1);
if (indent < 32 && m_child2 != NULL)
- m_child2->dump(fp, indent + 1);
+ m_child2->dump(writer, indent + 1);
}
/** @class RplASMethod rplastree.hpp "rplexpr/rplastree.hpp"
/**
* @brief Writes the internals of the instance into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASMethod::dump(FILE* fp, int indent)
+void RplASMethod::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
+
char buffer[256];
- fprintf(fp, "%sMethod %s %s(", tabs,
+ writer.indent(indent);
+ writer.format("Method %s %s(",
m_resultType == NULL ? "<NoneType>" : m_resultType->name().toUtf8().constData(),
m_name.toUtf8().constData());
RplSymbolSpace* parent = m_symbols->parent();
- fprintf(fp, ") id: %d parent: %s args: %d body: %d %s\n", m_id,
+ writer.formatLine(") id: %d parent: %s args: %d body: %d %s", m_id,
parent == NULL ? "" : parent->name().toUtf8().constData(),
m_child2 == NULL ? 0 : m_child2->id(),
m_child->id(),
positionStr(buffer, sizeof buffer));
if (m_child2 != NULL)
- m_child2->dump(fp, indent + 1);
- dumpStatements(fp, indent + 1, m_child);
- m_symbols->dump(fp, indent + 1);
+ m_child2->dump(writer, indent + 1);
+ dumpStatements(writer, indent + 1, m_child);
+ m_symbols->dump(writer, indent + 1);
}
/**
* @brief Returns the symbol space of the instance.
/**
* @brief Writes the internals of the instance into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param no current number of the argument: 1..N
* @param indent nesting level
- * @param tabs a string with tabs (count: indent)
*/
-void RplASArgument::dumpOne(FILE* fp, int no, int indent, char tabs[])
+void RplASArgument::dumpOne(RplWriter& writer, int no, int indent)
{
int succ = m_child == NULL ? 0 : m_child->id();
- fprintf(fp, "%sarg %d id: %d expr: %d succ: %d\n", tabs, no, m_id,
+ writer.formatIndented(indent, "arg %d id: %d expr: %d succ: %d", no, m_id,
child2()->id(), succ);
- m_child2->dump(fp, indent + 1);
+ m_child2->dump(writer, indent + 1);
}
/**
* @brief Writes the internals of the instance into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASArgument::dump(FILE* fp, int indent)
+void RplASArgument::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
+
RplASArgument* current = this;
int no = 0;
do {
- current->dumpOne(fp, ++no, indent, tabs);
+ current->dumpOne(writer, ++no, indent);
current = static_cast<RplASArgument*>(current->child());
} while (current != NULL);
}
/**
* @brief Writes the internals of the instance into a file.
*
- * @param fp target file
+ * @param writer writes to output
* @param indent nesting level
*/
-void RplASField::dump(FILE* fp, int indent)
+void RplASField::dump(RplWriter& writer, int indent)
{
- DEFINE_TABS(indent);
char buffer[256];
- fprintf(fp, "%sfield %s id: %d parent: %d succ: %s\n", tabs,
+ writer.formatIndented(indent, "field %s id: %d parent: %d succ: %s",
m_name.toUtf8().constData(), m_id,
m_child == NULL ? 0 : m_child->id(),
positionStr(buffer, sizeof buffer));
- m_child->dump(fp, indent + 1);
+ m_child->dump(writer, indent + 1);
}
* Licence:
* You can use and modify this file without any restriction.
* There is no warranty.
- * You also can use the licence from http://www.wtfpl.net/.
+ * You also can use the licence from http://www.wtwriterl.net/.
* The original sources can be found on https://github.com/republib.
*/
char* positionStr(char buffer[], size_t bufferSize) const;
public:
/**
- * @brief Writes the content of the instance into a file.
+ * @brief Writes the content of the instance into an output medium.
*
- * @param fp the target file
+ * @param writer writes to output media
* @param indent nesting level: so many tabs will be used as prefix
* @param header NULL or the headline
*/
- virtual void dump(FILE* fp, int indent) = 0;
+ virtual void dump(RplWriter& writer,int indent) = 0;
public:
static void reset();
RplASItemType nodeType() const;
public:
virtual RplASNode1* calc(RplASVariant& value);
public:
- virtual void dump(FILE* fp, int indent);
+ virtual void dump(RplWriter& writer,int indent);
RplASVariant& value();
private:
RplASVariant m_value;
RplASItem* child() const;
void setChild(RplASItem* child);
public:
- static void dumpStatements(FILE* fp, int indent, RplASItem* statements);
+ static void dumpStatements(RplWriter& writer, int indent, RplASItem* statements);
protected:
RplASItem* m_child;
};
public:
virtual RplASNode1* calc(RplASVariant& value);
public:
- virtual void dump(FILE* fp, int indent);
+ virtual void dump(RplWriter& writer,int indent);
RplASVariant& value();
RplASListOfVariants* list();
private:
public:
virtual RplASNode1* calc(RplASVariant& value);
public:
- virtual void dump(FILE* fp, int indent);
+ virtual void dump(RplWriter& writer,int indent);
RplASVariant& value();
RplASMapOfVariants* map();
private:
const QString& name() const;
public:
virtual RplASNode1* calc(RplASVariant& value, RplStackFrame* frame);
- void dump(FILE* fp, int indent);
+ void dump(RplWriter& writer, int indent);
RplASClass* dataType() const;
protected:
public:
RplASIndexedValue();
public:
- void dump(FILE* fp, int indent);
+ void dump(RplWriter& writer, int indent);
};
class RplASStatement
public:
virtual void execute();
virtual RplASNode1* calc(RplASVariant& value);
- void dump(FILE* fp, int indent);
+ void dump(RplWriter& writer, int indent);
const QString& name() const;
RplASClass* datatype() const;
};
public:
virtual void execute();
virtual RplASNode1* calc(RplASVariant& value);
- void dump(FILE* fp, int indent);
+ void dump(RplWriter& writer, int indent);
};
class RplASUnaryOp : public RplASNode1
RplASUnaryOp(int op, RplASItemType type);
public:
int getOperator() const;
- void dump(FILE* fp, int indent);
+ void dump(RplWriter& writer, int indent);
private:
int m_operator;
public:
int getOperator() const;
void setOperator(int op);
- void dump(FILE* fp, int indent);
+ void dump(RplWriter& writer, int indent);
private:
int m_operator;
};
public:
RplASNode1* calc(RplASVariant& value);
bool calcAsBool();
- void dump(FILE* fp, int indent);
+ void dump(RplWriter& writer, int indent);
};
class RplASIf : public RplASNode4, public RplASStatement
RplASIf();
public:
virtual void execute();
- virtual void dump(FILE* fp, int indent);
+ virtual void dump(RplWriter& writer, int indent);
};
class RplASForIterated : public RplASNode4, public RplASStatement
RplASForIterated(RplASNamedValue* variable);
public:
virtual void execute();
- virtual void dump(FILE* fp, int indent);
+ virtual void dump(RplWriter& writer, int indent);
};
class RplASForCounted : public RplASNode6, public RplASStatement
RplASForCounted(RplASNamedValue* variable);
public:
virtual void execute();
- virtual void dump(FILE* fp, int indent);
+ virtual void dump(RplWriter& writer, int indent);
};
class RplASWhile : public RplASNode3, public RplASStatement
RplASWhile();
public:
virtual void execute();
- virtual void dump(FILE* fp, int indent);
+ virtual void dump(RplWriter& writer, int indent);
};
class RplASRepeat : public RplASNode3, public RplASStatement
RplASRepeat();
public:
virtual void execute();
- virtual void dump(FILE* fp, int indent);
+ virtual void dump(RplWriter& writer, int indent);
};
class RplASArgument : public RplASNode2
public:
RplASArgument();
public:
- void dump(FILE* fp, int indent);
+ void dump(RplWriter& writer, int indent);
protected:
- void dumpOne(FILE* fp, int no, int indent, char tabs[]);
+ void dumpOne(RplWriter& writer, int no, int indent);
};
class RplASMethod;
public:
RplASMethodCall(const QString& name, RplASItem* parent);
public:
- void dump(FILE* fp, int indent);
+ void dump(RplWriter& writer, int indent);
virtual void execute();
public:
public:
RplASField(const QString& name);
public:
- void dump(FILE* fp, int indent);
+ void dump(RplWriter& writer, int indent);
private:
QString m_name;
};
RplASMethod(const QString& name, RplASTree& tree);
public:
void execute();
- void dump(FILE* fp, int indent);
+ void dump(RplWriter& writer, int indent);
RplSymbolSpace* symbols() const;
void setSymbols();
const QString& name() const;
virtual QString toString(void *object, int maxLength = 80) const = 0;
public:
const QString& name() const;
- virtual void dump(FILE* fp, int indent);
+ virtual void dump(RplWriter& writer, int indent);
void setSymbols();
protected:
QString m_name;