Class
The Class object holds the declaration for a .Net class.   A class can be an Enumeration, in fact the Enum object derives from Class.   The Class object derives from the DataContainer object, which allows it to hold Method objects, Field objects, and other Class or Enum objects.   Additionally, a class object may hold Property objects.   Note that classes may NOT contain namespaces or assemblies.

The constructor may be called either directly or through the Allocator object.   It takes a name, qualifiers such as whether the class is static or a value type, a packing value, and the size of the object.   If the pack value and size of the object are both set to -1, these attributes will not be generated for the class.

        Class(std::string Name, Qualifiers Flags, int Pack, int Size);

The pack value and size value may be independently set for the class.   Note that if either is set to a non-negative value, the PE file will have an entry which sets both anyway.

        void pack(int pk) { pack_ = pk; }
        void size(int sz) { size_ = sz; }

Classes always extend other classes in .Net.   If an extendsFrom class is not selected, the library will choose one of the classes System.ValueType, System.Enum, or System.Object based on whether the class is an enumeration and the Qualifier flags.

        void Extends(Class *extendsFrom) { extendsFrom_ = extendsFrom; }

One can add or view class properties.  Methods and Fields are managed through the underlying DataContainer object.

        void Add(Property *property);

        const std::vector<Property *>& Properties() const { return properties_;  }

To set the fact that a class reference is to be an external reference for purpose of the object file, use

        bool External() const;

        void External(bool external);

It is possible to traverse the members of a class.   Normally though, one would start the traversal process by calling the related PELib traverse function, which would traverse every object known to the library.

        virtual bool Traverse(Callback &callback) const override;