00001 #ifndef __TYPELIB_PACKING_H__ 00002 #define __TYPELIB_PACKING_H__ 00003 00004 #include <stdexcept> 00005 00006 namespace Typelib 00007 { 00008 class Compound; 00009 class Field; 00010 class Type; 00011 00012 namespace Packing 00013 { 00014 struct PackingUnknown : std::runtime_error 00015 { 00016 PackingUnknown(std::string const& what) 00017 : std::runtime_error(what) {} 00018 }; 00019 00022 struct FoundNullStructure : public PackingUnknown 00023 { 00024 FoundNullStructure() 00025 : PackingUnknown("queried the packing of a null type") {} 00026 }; 00029 struct FoundUnion : public PackingUnknown 00030 { 00031 FoundUnion() 00032 : PackingUnknown("queried the packing of an union") {} 00033 }; 00034 00039 int getOffsetOf(const Field& last_field, const Type& append_field, size_t packing); 00040 00045 int getOffsetOf(Compound const& last_field, const Type& append_field, size_t packing); 00046 00051 int getOffsetOf(Compound const& compound, Type const& append); 00056 int getOffsetOf(Field const& last_field, Type const& append); 00060 int getSizeOfCompound(Compound const& compound); 00061 } 00062 }; 00063 00064 #endif 00065