Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-52189

Add operator bool to QTextStream

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • 6.6
    • 5.6.0, 6.5.0 Beta2
    • Core: Serialization
    • None
    • All
    • 21
    • Foundation PM Staging

    Description

      I hope QTextStream can add a operator bool() method, just like basic_istream in c++ STL:
      operator bool() const

      { return _M_ok; }

      Now if i need know whether QTextStream has the right format, i need do as this:
      QTextStream >> x;
      if(ss.status() == QTextStream::Ok)
      {
      }

      if QTextStream has operator bool() method, then i can do this:
      if(QTextStream >> x)
      {
      }
      This will be compatible with STL when convert code from STL to QT.
      Thanks!

      Attachments

        Activity

          People

            cnn Qt Core & Network
            johnff johnff
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: