bintools/checklib/object/object.h
changeset 0 044383f39525
child 590 360bd6b35136
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Classes for interpreting a memory area as an ELF or COFF object.
       
    15 //
       
    16 //                    <creates>
       
    17 // Object_factory -----------------> Object
       
    18 //                                     ^
       
    19 //                                     |
       
    20 //                              +------+------+
       
    21 //                              |             |
       
    22 //
       
    23 //                         Elf_object      Coff_object
       
    24 //
       
    25 
       
    26 #ifndef OBJECT_H
       
    27 #define OBJECT_H
       
    28 
       
    29 #include <vector>
       
    30 #include <memory>
       
    31 
       
    32 
       
    33 class Object
       
    34 {
       
    35 public:
       
    36     virtual ~Object() = 0;
       
    37 public:
       
    38     // Does the object have an unresolved reference to the given symbol.
       
    39     virtual bool is_undef(const char*) const = 0;
       
    40 };
       
    41 
       
    42 class Elf_object : public Object
       
    43 {
       
    44 public:
       
    45     Elf_object(const char*, const char*);
       
    46     virtual ~Elf_object();
       
    47 public:
       
    48     virtual bool is_undef(const char*) const;
       
    49 private:
       
    50     std::vector<const char*> m_undef_symbols;
       
    51 };
       
    52 
       
    53 class Coff_object : public Object
       
    54 {
       
    55 public:
       
    56     Coff_object(const char*, const char*);
       
    57     virtual ~Coff_object();
       
    58 public:
       
    59     virtual bool is_undef(const char*) const;
       
    60 private:
       
    61     std::vector<const char*> m_undef_symbols;
       
    62 };
       
    63 
       
    64 class Object_factory
       
    65 {
       
    66 public:
       
    67     enum objkind_t {ELF, COFF};
       
    68 public:
       
    69     static std::auto_ptr<Object> create(objkind_t, const char*, const char*);
       
    70 };
       
    71 
       
    72 
       
    73 #endif
       
    74