⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pointertype.cc

📁 C++ Reflection & Service Library
💻 CC
字号:
/* C++ Reflection & Serice Library * Copyright (C) 2003  Marcus Perlick * mailto: riffraff@users.sf.net *  * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. *  * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. *  * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * This file is part of the "C++ Reflection & Serice Library" */#include "PointerType.hh"#include <cassert>#include <new>#include "align.hh"namespace rfl {  static mpu::String mkPointerName( const Type& pointeeType )  {    mpu::String tmp = pointeeType.getName();    tmp += '*';    return tmp;  }  PointerType::PointerType( const Type& pointeeType ) :    Type( ID_PTR,	  mkPointerName( pointeeType ),	  sizeof(void*),	  AlignmentOf<void*>::is(),	  1,	  &PointerType::fCreate,	  &PointerType::fCCreate,	  &PointerType::fDestroy,	  &PointerType::fAssign,	  &PointerType::fNewObj,	  &PointerType::fNewCopy,	  &PointerType::fDelObj ),    pointee_( &pointeeType )  {}  void  PointerType::avStartCall( av_alist& avList,			    void* fnPtr,			    void *retVal ) const  {    av_start_ptr( avList, fnPtr, void*, *(void**)retVal );  }  void  PointerType::avPutArg( av_alist& avList, void* arg ) const  {    av_ptr( avList, void*, *(void**)arg );  }    void  PointerType::fCreate( const Type*, void* addr )  {    *(void**)addr = 0;  }  void  PointerType::fCCreate( const Type*, void* addr, const void* obj )  {    *(void**)addr = *(void**)obj;  }  void  PointerType::fDestroy( const Type*, void* obj )  {}  void  PointerType::fAssign( const Type*, void* dst, const void* src )  {    *(void**)dst = *(void**)src;  }  void*  PointerType::fNewObj( const Type* )  {    return new void*( 0 );  }  void*  PointerType::fNewCopy( const Type*, const void* obj )  {    return new void*( *(void**)obj );  }  void  PointerType::fDelObj( const Type*, void* obj )  {    delete static_cast<void**>(obj);  }  const Type&  PointerType::getElmType( std::size_t idx ) const  {    assert( pointee_ != 0 );    return *pointee_;  }  void*  PointerType::getElmAddr( void* obj, std::size_t idx ) const  {    return *(void**)obj;  }  unsigned long  PointerType::hash( void ) const  {    unsigned long ret = ID_PTR;    assert( pointee_ != 0 );    updateHash( ret, pointee_->hash() );    return ret;  }  bool  PointerType::operator==( const Type& type ) const  {    if ( type.getId() != ID_PTR )      return false;    assert( pointee_ != 0 );    assert( static_cast<const PointerType&>(type).pointee_ != 0 );        return *pointee_ == *static_cast<const PointerType&>(type).pointee_;  }} // namespace rfl

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -