#pragma once

#include "MessageException.h"

#include <QString>
#include <QFile>

#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
#endif

class utils
{
public:
	static const QString readFile(const QString &fileName)
	{
		QFile file(fileName);
		if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
            throw MessageException("读取文件失败!");

		QString result;
		while (!file.atEnd())
		{
			QByteArray line = file.readLine();
			result.append(line);
		}

		return result;
	}
};
