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

📄 elfio.cpp

📁 C++写的,提供操作ELF格式文件的API
💻 CPP
字号:
/*
ELFIO.cpp - ELFIO objects creator.
Copyright (C) 2001 Serge Lamikhov-Center <to_serge@users.sourceforge.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
*/


#include "ELFIO.h"
#include "ELFIImpl.h"
#include "ELFOImpl.h"


ELFIO::ELFIO()
{
}


ELFIO::ELFIO( const ELFIO& )
{
}


const ELFIO*
ELFIO::GetInstance()
{
    static ELFIO instance;

    return &instance;
}


ELFIO_Err
ELFIO::CreateELFI( IELFI** ppObj ) const
{
    ELFIO_Err bRet = ERR_ELFIO_NO_ERROR;
    *ppObj = new ELFI;
    if ( 0 == *ppObj ) {
      bRet = ERR_ELFIO_MEMORY;
    }

    return bRet;
}


ELFIO_Err
ELFIO::CreateELFO( IELFO** ppObj ) const
{
    ELFIO_Err bRet = ERR_ELFIO_NO_ERROR;
    *ppObj = new ELFO;
    if ( 0 == *ppObj ) {
      bRet = ERR_ELFIO_MEMORY;
    }

    return bRet;
}


std::string
ELFIO::GetErrorText( ELFIO_Err err ) const
{
    switch ( err ) {
    case ERR_ELFIO_NO_ERROR:         // No error
        return "No error";
        break;
    case ERR_ELFIO_INITIALIZED:      // The ELFIO object was initialized
        return "The ELFIO object initialized";
        break;
    case ERR_ELFIO_MEMORY:           // Out of memory
        return "Out of memory";
        break;
    case ERR_ELFIO_CANT_OPEN:        // Can't open a specified file
        return "Can't open a specified file";
        break;
    case ERR_ELFIO_NOT_ELF:          // The file is not a valid ELF file
        return "The file is not a valid ELF file";
        break;
    case ERR_NO_SUCH_READER:         // There is no such reader
        return "There is no such reader";
        break;
    case ERR_ELFIO_SYMBOL_ERROR:     // Symbol section reader error
        return "Symbol section reader error";
        break;
    case ERR_ELFIO_RELOCATION_ERROR: // Relocation section reader error
        return "Relocation section reader error";
        break;
    default:
        return "Unknown error code";
        break;
    }
}

⌨️ 快捷键说明

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