Browse Subversion Repository
Contents of /trunk/compiler/QParseInfo.cpp
Parent Directory
| Revision Log
Revision 1 -
( show annotations)
( download)
( as text)
Wed Aug 3 10:14:23 2011 UTC
(12 years, 9 months ago)
by kaityo
File MIME type: text/x-c++src
File size: 1752 byte(s)
First commit
| 1 |
//---------------------------------------------------------------------------- |
| 2 |
// Parse information |
| 3 |
//---------------------------------------------------------------------------- |
| 4 |
#ifdef __BORLANDC__ |
| 5 |
#include <vcl.h> |
| 6 |
#pragma hdrstop |
| 7 |
#endif //__BORLANDC__ |
| 8 |
|
| 9 |
#include <iostream> |
| 10 |
#include <string> |
| 11 |
#include <vector> |
| 12 |
#include "QParseInfo.h" |
| 13 |
|
| 14 |
//---------------------------------------------------------------------------- |
| 15 |
#ifdef __BORLANDC__ |
| 16 |
#pragma package(smart_init) |
| 17 |
#endif //__BORLANDC__ |
| 18 |
|
| 19 |
|
| 20 |
std::vector<int> dummy_vec; |
| 21 |
|
| 22 |
/** |
| 23 |
* Constructor |
| 24 |
*/ |
| 25 |
QParseInfo::QParseInfo(const int _operator, const std::vector<int> &_targets, |
| 26 |
const double _rotation, const bool _result, |
| 27 |
const int _error) { |
| 28 |
mOperator = _operator; |
| 29 |
mTargetIndices = _targets; |
| 30 |
mRotation = _rotation; |
| 31 |
mParseResult = _result; |
| 32 |
mErrorNo = _error; |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Constructor for error notification |
| 37 |
*/ |
| 38 |
QParseInfo::QParseInfo(const int _error) { |
| 39 |
mOperator = -1; |
| 40 |
mTargetIndices = dummy_vec; |
| 41 |
mRotation = 0; |
| 42 |
mParseResult = false; |
| 43 |
mErrorNo = _error; |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Copy constructor |
| 48 |
*/ |
| 49 |
QParseInfo::QParseInfo(const QParseInfo &pinfo) { |
| 50 |
mOperator = pinfo.mOperator; |
| 51 |
mTargetIndices = pinfo.mTargetIndices; |
| 52 |
mRotation = pinfo.mRotation; |
| 53 |
mParseResult = pinfo.mParseResult; |
| 54 |
mErrorNo = pinfo.mErrorNo; |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* Operator<< |
| 59 |
*/ |
| 60 |
std::ostream &operator<<(std::ostream &os, const QParseInfo &pinfo) { |
| 61 |
os << "operator : " << pinfo.mOperator; |
| 62 |
if (pinfo.mParseResult) |
| 63 |
os << "\nparse result: true"; |
| 64 |
else |
| 65 |
os << "\nparse result: false"; |
| 66 |
os << "\nerror no. : " << pinfo.mErrorNo; |
| 67 |
return os; |
| 68 |
} |
|