void checkExtractLine(const char* wkt, double start, double end, const char* expected) { string wktstr(wkt); GeomPtr linearGeom(reader.read(wktstr)); LengthIndexedLine indexedLine(linearGeom.get()); GeomPtr result(indexedLine.extractLine(start, end)); checkExpected(result.get(), expected); }
void runIndicesOfThenExtract(string const& inputStr, string const& subLineStr) { GeomPtr input(reader.read(inputStr)); GeomPtr subLine(reader.read(subLineStr)); GeomPtr result(indicesOfThenExtract(input.get(), subLine.get())); checkExpected(result.get(), subLine.get()); }
// VISITs virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) { if (!nodep->user1Inc()) { // Process only once. cleanFileline(nodep); UINFO(5," "<<nodep<<endl); checkExpected(nodep); // Due to a need to get the arguments, the ParseRefs are under here, // rather than the NodeFTaskRef under the ParseRef. if (nodep->namep()) { m_exp = AstParseRefExp::PX_FUNC; nodep->namep()->accept(*this); // No next, we don't want to do the edit m_exp = AstParseRefExp::PX_NONE; if (!m_baseTextp) nodep->v3fatalSrc("No TEXT found to indicate function name"); nodep->name(m_baseTextp->text()); nodep->dotted(m_dotText); nodep->namep()->unlinkFrBack()->deleteTree(); m_baseTextp=NULL; } nodep->iterateChildren(*this); } }
virtual void visit(AstNode* nodep, AstNUser*) { // Default: Just iterate cleanFileline(nodep); checkExpected(nodep); // So we detect node types we forgot to list here nodep->iterateChildren(*this); }
void checkExpected(Geometry* result, string const& expected) { GeomPtr subLine(reader.read(expected)); checkExpected(result, subLine.get()); }
virtual void processUtf8(unsigned chars, const char *value, const RtlFieldInfo * field) { checkExpected(field); stringResult = value; resultChars = chars; }
virtual void processUnicode(unsigned chars, const UChar *value, const RtlFieldInfo * field) { checkExpected(field); unicodeResult = value; resultChars = chars; }
virtual void processQString(unsigned len, const char *value, const RtlFieldInfo * field) { checkExpected(field); stringResult = value; resultChars = len; }
virtual void processUDecimal(const void *value, unsigned digits, unsigned precision, const RtlFieldInfo * field) { checkExpected(field); decimalResult.setDecimal(digits, precision, value); }
virtual void processReal(double value, const RtlFieldInfo * field) { checkExpected(field); doubleResult = value; }
virtual void processUInt(unsigned __int64 value, const RtlFieldInfo * field) { checkExpected(field); uintResult = value; }
virtual void processInt(__int64 value, const RtlFieldInfo * field) { checkExpected(field); intResult = value; }
virtual void processBool(bool value, const RtlFieldInfo * field) { checkExpected(field); boolResult = value; }