42 #include "Teuchos_MatrixMarket_generic.hpp"
43 #include "Teuchos_MatrixMarket_split.hpp"
47 namespace MatrixMarket {
49 int maxLineLength() {
return 1024; }
52 checkCommentLine (
const std::string& line,
55 const size_t lineNumber,
57 const bool maybeBannerLine)
65 std::ostringstream os;
66 os <<
"Line " << lineNumber <<
" contains no characters";
67 throw std::invalid_argument (os.str());
72 start = line.find_first_not_of (
" \t");
73 if (start == std::string::npos) {
80 std::ostringstream os;
81 os <<
"Line " << lineNumber <<
" contains only whitespace";
82 throw std::invalid_argument (os.str());
89 const size_t commentPos = line.find_first_of(
"%#", start);
90 if (commentPos == std::string::npos) {
94 size = std::string::npos;
97 else if (commentPos == start) {
102 if (maybeBannerLine) {
103 const size_t bannerStart =
104 line.substr (commentPos).find (
"%%MatrixMarket");
105 if (bannerStart != std::string::npos) {
106 size = line.size() - commentPos;
125 size = commentPos - start;