#include "fileOpenMode.hpp" QIODevice::OpenMode fileModeFromString(const QString& modeString) { QIODevice::OpenMode modeFlags = QIODevice::NotOpen; // if the mode don't contains a "b", set the text mode if (!modeString.contains("b")) modeFlags |= QIODevice::Text; // if the mode contains a "r", set the read mode if (modeString.contains("r")) modeFlags |= QIODevice::ReadOnly; // if the mode contains a "w", set the write mode if (modeString.contains("w")) modeFlags |= QIODevice::WriteOnly; // if the mode contains a "a", set the append mode if (modeString.contains("a")) modeFlags |= QIODevice::Append; return modeFlags; }