TBool CTestConfig::IsAtStartOfNewLine(const TDesC8& aSource, const TLex8& aLex, TBool aIgnoreSpaces) const { TInt offset(aLex.MarkedOffset()); __ASSERT_ALWAYS(offset != 0, User::Invariant()); TChar ch = NULL; if (aIgnoreSpaces) { while (offset--) { ch = aSource[offset]; if (ch == KScriptLFChar || ch == KScriptCRChar || !ch.IsSpace()) break; } } else ch = aSource[offset-1]; TBool ret(EFalse); if (offset <= 0) ret = ETrue; else ret = (ch == KScriptLFChar || ch == KScriptCRChar); return ret; }
TPtrC8 CTestConfig::ParseValue(const TDesC8& aText, const TLex8& aInput, TInt aCurrentItemStart) const { const TInt mid = aCurrentItemStart; const TInt len = aInput.MarkedOffset() - mid; TPtrC8 ret(KNullDesC8); if (len > 0) ret.Set(aText.Mid(mid, len)); return ret; }
TBool CTestConfig::IsNewSection(const TDesC8& aSource, const TLex8& aInput) const /** * Checks whether the current marked token in aInput starts with a '[' and ends with a ']', * and checks that this token is at the start of a line. * * @returns Whether this is a new section in the script file */ { const TPtrC8 token(aInput.MarkedToken()); const TInt offset(aInput.MarkedOffset()); TBool ret = token.Length() > 2 && token.Find(KScriptSectionStart) == 0; ret = ret && token.Find(KScriptSectionEnd) != KErrNotFound; if (ret && offset > 0) { const TPtrC8 lastChar(aSource.Mid(offset-1, 1)); ret = ret && (lastChar == KScriptLF || lastChar == KScriptCR); } return ret; }