Ignore:
Timestamp:
Mar 19, 2012, 1:59:48 AM (12 years ago)
Author:
イグトランス (egtra)
Message:

egtraブランチの内容をマージ。

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/ab5.0/abdev

    • Property svn:ignore set to
      *.opensdf
      *.sdf
      *.suo
      *.user
      int
      ipch
      out
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Source.h

    r739 r828  
    2121    {
    2222    }
     23    IncludedFilesRelation(IncludedFilesRelation const& y)
     24        : filePaths(y.filePaths)
     25        , lineFileNumbers(y.lineFileNumbers)
     26    {
     27    }
     28    IncludedFilesRelation(IncludedFilesRelation&& y)
     29        : filePaths(std::move(y.filePaths))
     30        , lineFileNumbers(std::move(y.lineFileNumbers))
     31    {
     32    }
    2333    ~IncludedFilesRelation()
    2434    {
     35    }
     36    IncludedFilesRelation& operator =(IncludedFilesRelation&& y)
     37    {
     38        filePaths = std::move(y.filePaths);
     39        lineFileNumbers = std::move(y.lineFileNumbers);
     40        return *this;
     41    }
     42
     43    IncludedFilesRelation& operator =(IncludedFilesRelation const& y)
     44    {
     45        return *this = std::move(IncludedFilesRelation(y));
    2546    }
    2647
     
    7697        buffer[length] = 0;
    7798    }
     99    Text(Text&& text)
     100        : length( text.length )
     101    {
     102        buffer = text.buffer;
     103        text.buffer = static_cast<char*>(calloc(1, 1));
     104        text.length = 0;
     105    }
     106    Text& operator =(Text&& y)
     107    {
     108        SwapImpl(*this, y);
     109        return *this;
     110    }
     111    Text& operator =(Text const& y)
     112    {
     113        return *this = std::move(Text(y));
     114    }
    78115    ~Text(){
    79116        free( buffer );
     
    100137    static void SlideString(char *buffer, int slide){
    101138        memmove(buffer+slide, buffer, strlen(buffer)+1);
     139    }
     140
     141protected:
     142    static void SwapImpl(Text& lhs, Text& rhs)
     143    {
     144        std::swap(lhs.buffer, rhs.buffer);
     145        std::swap(lhs.length, rhs.length);
    102146    }
    103147};
     
    192236    {
    193237    }
     238    BasicSource(BasicSource&& basicSource)
     239        : Text(std::move(basicSource))
     240        , includedFilesRelation(std::move(basicSource.includedFilesRelation))
     241    {
     242    }
    194243    BasicSource( const std::string &source )
    195244    {
     
    230279    bool GetLineInfo( int sourceCodePos, int &line, std::string &fileName ) const;
    231280
    232     void operator = ( const BasicSource &source ){
     281    BasicSource& operator =(const BasicSource &source)
     282    {
    233283        Realloc( source.length );
    234284        strcpy( buffer, source.buffer );
     285        return *this;
     286    }
     287    BasicSource& operator =(BasicSource&& source)
     288    {
     289        Text::SwapImpl(*this, source);
     290        return *this;
    235291    }
    236292
     
    262318        ar & boost::serialization::make_nvp("vector_BasicSource", boost::serialization::base_object<std::vector<BasicSource>>(*this));
    263319    }
     320
     321public:
     322    BasicSources() {}
     323    BasicSources(BasicSources&& y) : std::vector<BasicSource>(std::move(y)) {}
     324    BasicSources(BasicSources const& y) : std::vector<BasicSource>(y) {}
     325    BasicSources operator =(BasicSources&& y)
     326    {
     327        std::vector<BasicSource>::operator =(std::move(y));
     328        return *this;
     329    }
     330    BasicSources operator =(BasicSources const& y)
     331    {
     332        return *this = std::move(BasicSources(y));
     333    }
    264334};
    265335
     
    289359    {
    290360    }
     361    SourceCodePosition(SourceCodePosition const& y)
     362        : relationalObjectModuleIndex(y.relationalObjectModuleIndex)
     363        , pos(y.pos)
     364    {
     365    }
     366
     367    SourceCodePosition& operator =(SourceCodePosition const& y)
     368    {
     369        relationalObjectModuleIndex = y.relationalObjectModuleIndex;
     370        pos = y.pos;
     371        return *this;
     372    }
    291373
    292374    int GetRelationalObjectModuleIndex() const;
Note: See TracChangeset for help on using the changeset viewer.