10 #include "Teuchos_MatrixMarket_generic.hpp"
11 #include "Teuchos_MatrixMarket_split.hpp"
15 namespace MatrixMarket {
17 int maxLineLength() {
return 1024; }
20 checkCommentLine (
const std::string& line,
23 const size_t lineNumber,
25 const bool maybeBannerLine)
33 std::ostringstream os;
34 os <<
"Line " << lineNumber <<
" contains no characters";
35 throw std::invalid_argument (os.str());
40 start = line.find_first_not_of (
" \t");
41 if (start == std::string::npos) {
48 std::ostringstream os;
49 os <<
"Line " << lineNumber <<
" contains only whitespace";
50 throw std::invalid_argument (os.str());
57 const size_t commentPos = line.find_first_of(
"%#", start);
58 if (commentPos == std::string::npos) {
62 size = std::string::npos;
65 else if (commentPos == start) {
70 if (maybeBannerLine) {
71 const size_t bannerStart =
72 line.substr (commentPos).find (
"%%MatrixMarket");
73 if (bannerStart != std::string::npos) {
74 size = line.size() - commentPos;
93 size = commentPos - start;