static std::vector<std::string > expandUseBasesMask ( const std::vector<unsigned int> &readLengths, const std::string &useBasesMask, const boost::filesystem::path &baseCallsDirectory) { std::vector<std::string > result; std::string::const_iterator parseIt(useBasesMask.begin()); const std::string::const_iterator parseEnd(useBasesMask.end()); UseBasesMaskGrammar<std::string::const_iterator> parser(readLengths); if (!boost::spirit::qi::parse(parseIt, parseEnd, parser, result) || parseEnd != parseIt) { const boost::format message = boost::format("\n *** Could not parse the use-bases-mask '%s' for '%s' at: %s ***\n") % useBasesMask % baseCallsDirectory.string() % useBasesMask.substr(parseIt - useBasesMask.begin()); BOOST_THROW_EXCEPTION(common::InvalidOptionException(message.str())); } ISAAC_THREAD_CERR << "use bases mask: " << boost::algorithm::join(result, ",") << "\n"; ISAAC_THREAD_CERR << "reads parsed: " << parser.currentRead_ << "\n"; if (result.size() != readLengths.size()) { const boost::format message = boost::format("\n *** use-bases-mask '%s' is incompatible with number of reads (%d) in %s ***\n") % useBasesMask % readLengths.size() % baseCallsDirectory.string(); BOOST_THROW_EXCEPTION(common::InvalidOptionException(message.str())); } return result; }
int main() { char * result = parseIt("t\\x04abcd\\x04efgh"); printf("%s\n", result); /* char * matched = text; int matchCount = 0; while (matched = strstr(matched, "\\x")) { matched += 2; matchCount++; } printf("matched %u\n", matchCount); int toAlloc = strlen(text) + (matched * */ return 0; }
int QueryParser::parseIt(int sessionId, string query, TreeNode *&qTree) { string tcResultString = ""; int errcode = parseIt(sessionId, query, qTree, tcResultString, false, false); return errcode; }