COFFI
1.2
               
coffi_utils.hpp File Reference

COFFI library utilities. More...

+ Include dependency graph for coffi_utils.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STRINGIFY(NAME)   #NAME
 
Macros for accessing the COFF structures fields

These macros provide a way to declare and define the get/set accessors to the COFF structures fields.
The list of the classes using these macro, and the COFF structures accessed is given by: COFF Data Accessors.

The declaration functions *_DECL are used in virtual template classes.
They declare the interface for all the classes, derived from the same virtual template class.
This is useful when a COFF structure has several flavors, depending on the COFF file architecture.

#define COFFI_GET_ACCESS_DECL(TYPE, NAME)   virtual TYPE get_##NAME() const = 0
 Declares a get_NAME function for accessing the NAME structure field.
 
#define COFFI_SET_ACCESS_DECL(TYPE, NAME)    virtual void set_##NAME(TYPE value) = 0
 Declares a set_NAME function for accessing the NAME structure field.
 
#define COFFI_GET_SET_ACCESS_DECL(TYPE, NAME)
 Declares a get_NAME and a set_NAME functions for accessing the NAME structure field. More...
 
#define COFFI_GET_ACCESS(TYPE, NAME)    TYPE get_##NAME() const { return header.NAME; }
 Defines a get_NAME function for accessing the NAME structure field.
 
#define COFFI_SET_ACCESS(TYPE, NAME)    void set_##NAME(TYPE value) { header.NAME = value; }
 Defines a set_NAME function for accessing the NAME structure field.
 
#define COFFI_GET_SET_ACCESS(TYPE, NAME)
 Defines a get_NAME and a set_NAME functions for accessing the NAME structure field. More...
 
#define COFFI_GET_ACCESS_NONE(TYPE, NAME)
 Disables the get_NAME function for prohibiting read accesses to the NAME structure field. More...
 
#define COFFI_SET_ACCESS_NONE(TYPE, NAME)
 Disables the set_NAME function for prohibiting write accesses to the NAME structure field. More...
 
#define COFFI_GET_SET_ACCESS_NONE(TYPE, NAME)
 Disables the get_NAME and the set_NAME function for prohibiting all accesses to the NAME structure field. More...
 
#define COFFI_GET_SIZEOF_DECL()   virtual size_t get_sizeof() const = 0
 Declares the get_sizeof function for returning the size of the COFF file structure.
 
#define COFFI_GET_SIZEOF()    size_t get_sizeof() const { return sizeof(header); }
 Defines the get_sizeof function for returning the size of the COFF file structure.
 

Detailed Description

COFFI library utilities.

Do not include this file directly. This file is included by coffi.hpp.

Definition in file coffi_utils.hpp.

Macro Definition Documentation

◆ COFFI_GET_ACCESS_NONE

#define COFFI_GET_ACCESS_NONE (   TYPE,
  NAME 
)
Value:
TYPE get_##NAME() const \
{ \
throw std::runtime_error("The header field '" STRINGIFY( \
NAME) "' is not applicable to this COFF version"); \
}

Disables the get_NAME function for prohibiting read accesses to the NAME structure field.

Definition at line 76 of file coffi_utils.hpp.

◆ COFFI_GET_SET_ACCESS

#define COFFI_GET_SET_ACCESS (   TYPE,
  NAME 
)
Value:
TYPE get_##NAME() const { return header.NAME; } \
void set_##NAME(TYPE value) { header.NAME = value; }

Defines a get_NAME and a set_NAME functions for accessing the NAME structure field.

Definition at line 71 of file coffi_utils.hpp.

◆ COFFI_GET_SET_ACCESS_DECL

#define COFFI_GET_SET_ACCESS_DECL (   TYPE,
  NAME 
)
Value:
virtual TYPE get_##NAME() const = 0; \
virtual void set_##NAME(TYPE value) = 0

Declares a get_NAME and a set_NAME functions for accessing the NAME structure field.

Definition at line 58 of file coffi_utils.hpp.

◆ COFFI_GET_SET_ACCESS_NONE

#define COFFI_GET_SET_ACCESS_NONE (   TYPE,
  NAME 
)
Value:
TYPE get_##NAME() const \
{ \
throw std::runtime_error("The header field '" STRINGIFY( \
NAME) "' is not applicable to this COFF version"); \
} \
void set_##NAME(TYPE) \
{ \
throw std::runtime_error("The header field '" STRINGIFY( \
NAME) "' is not applicable to this COFF version"); \
}

Disables the get_NAME and the set_NAME function for prohibiting all accesses to the NAME structure field.

Definition at line 92 of file coffi_utils.hpp.

◆ COFFI_SET_ACCESS_NONE

#define COFFI_SET_ACCESS_NONE (   TYPE,
  NAME 
)
Value:
void set_##NAME(TYPE value) \
{ \
throw std::runtime_error("The header field '" STRINGIFY( \
NAME) "' is not applicable to this COFF version"); \
}

Disables the set_NAME function for prohibiting write accesses to the NAME structure field.

Definition at line 84 of file coffi_utils.hpp.