Beispiel #1
0
QString CommentFormatter::formatComment( const QString& comment ) {
  QString ret;
  int i = 0;

  if( i > 1 ) {
      ret = comment.mid( i );
  } else {
      ///remove the star in each line
      QStringList lines = comment.split( "\n", QString::KeepEmptyParts );

      if( lines.isEmpty() ) return ret;

      QStringList::iterator it = lines.begin();
      QStringList::iterator eit = lines.end();

      if( it != lines.end() ) {
 
          for( ; it != eit; ++it ) {
              strip( "//", *it );
              strip( "**", *it );
              rStrip( "/**", *it );
          }

          if( lines.front().trimmed().isEmpty() )
              lines.pop_front();

          if( !lines.isEmpty() && lines.back().trimmed().isEmpty() )
              lines.pop_back();
      }

      ret = lines.join( "\n" );
  }

  return ret;
}
Beispiel #2
0
 /*
 * Get the next non-blank line of input, strip trailing whitespace.
 */
 bool getNextLine(std::istream& in, std::string& line)
 {
    while (true) {
       if (!in.eof()) {
          getline(in, line);
          rStrip(line);
          if (!line.empty()) {
             // Return true indicates eof not reached
             return true;
          }
       } else {
          line.clear();
          // Return false indicates eof was reached
          return false;
       }
    }
 }
Beispiel #3
0
 /*
 * Assign the next non-blank line of input to a stringstream
 */
 bool getNextLine(std::istream& in, std::stringstream& line)
 {
    std::string string;
    line.str(string);
    line.clear();
    while (true) {
       if (!in.eof()) {
          getline(in, string);
          rStrip(string);
          if (!string.empty()) {
             line.str(string);
             // Return true indicates eof not reached
             return true;
          }
       } else {
          // Return false indicates eof reached
          return false;
       }
    }
 }