Ignore:
Timestamp:
Mar 19, 2011, 10:47:28 PM (13 years ago)
Author:
イグトランス (egtra)
Message:

compilerにおいて、各クラスのコピー禁止を明確化、ならびにコピー可能なものにムーブコンストラクタ・ムーブ代入演算子を追加。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/egtra/ab5.0/abdev/BasicCompiler_Common/include/Messenger.h

    r812 r817  
    2424    {
    2525    }
     26
    2627    ErrorInfo( int errorCode, const std::string &keyword, int sourceIndex );
     28
     29    ErrorInfo(ErrorInfo&& y)
     30        : errorCode(std::move(y.errorCode))
     31        , keyword(std::move(y.keyword))
     32        , sourceFilePath(std::move(y.sourceFilePath))
     33        , sourceLineNum(std::move(y.sourceLineNum))
     34        , errorLineNum(std::move(y.errorLineNum))
     35    {
     36    }
     37
     38    ErrorInfo(ErrorInfo const& y)
     39        : errorCode(y.errorCode)
     40        , keyword(y.keyword)
     41        , sourceFilePath(y.sourceFilePath)
     42        , sourceLineNum(y.sourceLineNum)
     43        , errorLineNum(y.errorLineNum)
     44    {
     45    }
     46
     47    ErrorInfo& operator =(ErrorInfo&& y)
     48    {
     49        errorCode = std::move(y.errorCode);
     50        keyword = std::move(y.keyword);
     51        sourceFilePath = std::move(y.sourceFilePath);
     52        sourceLineNum = std::move(y.sourceLineNum);
     53        errorLineNum = std::move(y.errorLineNum);
     54        return *this;
     55    }
     56
     57    ErrorInfo& operator =(ErrorInfo const& y)
     58    {
     59        return *this = std::move(ErrorInfo(y));
     60    }
    2761
    2862    int GetErrorCode() const
     
    6397
    6498public:
     99    ErrorMessenger() {}
     100
    65101    void Output( const ErrorInfo &errorInfo );
    66102    void Output( int errorCode, const std::string &keyword, int sourceIndex = -1 );
     
    75111
    76112    void ShowErrorLine( int errorLineNum );
     113
     114private:
     115    ErrorMessenger(ErrorMessenger const&);
     116    ErrorMessenger& operator =(ErrorMessenger const&);
    77117};
Note: See TracChangeset for help on using the changeset viewer.