1 /******************************************************************************
2 
3  This source file is part of the MoleQueue project.
4 
5  Copyright 2012 Kitware, Inc.
6 
7  This source code is released under the New BSD License, (the "License").
8 
9  Unless required by applicable law or agreed to in writing, software
10  distributed under the License is distributed on an "AS IS" BASIS,
11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  See the License for the specific language governing permissions and
13  limitations under the License.
14 
15  ******************************************************************************/
16 
17 #include "referencestring.h"
18 #include "molequeuetestconfig.h"
19 
20 #include <QtCore/QDebug>
21 #include <QtCore/QFile>
22 
ReferenceString(const QString & filename)23 ReferenceString::ReferenceString(const QString &filename)
24 {
25   QString realFilename = MoleQueue_TESTDATA_DIR + filename;
26   QFile refFile(realFilename);
27 
28   if (!refFile.open(QFile::ReadOnly | QIODevice::Text)) {
29     qDebug() << "Cannot access reference file" << realFilename;
30     return;
31   }
32 
33   m_refString = refFile.readAll();
34   refFile.close();
35 }
36 
toString() const37 QString ReferenceString::toString() const
38 {
39   return m_refString;
40 }
41 
operator QString&()42 ReferenceString::operator QString&()
43 {
44   return m_refString;
45 }
46