DataContainer

The data container is the base class for the various classes that can hold other things.   It can hold other datacontainers, methods, or fields.   Note that depending on the type of DataContainer, there may be limits as to what other DataContainer types may be held.

DataContainers will never be directly constructed; the derived class will call it as part of its own construction.   However the derived class may be user-generated when constructing an assembly.

        DataContainer(std::string Name, Qualifiers Flags);

Add another data container such as a Class or Namespace.

        void Add(DataContainer *item);

Add a Method to this data container.

        void Add(CodeContainer *item);

Add a Field to this data container.

        void Add(Field *field);

Not currently used.

        bool IsInstantiated() const { return instantiated_; }
        void SetInstantiated() { instantiated_ = true; }

Get the parent container.   A Class, Namespace, or AssemblyDef object.

        DataContainer *Parent() const { return parent_; }

Get the name or CIL flags

        const std::string &Name() const { return name_; }

        Qualifiers Flags() const { return flags_; }

Utilities to find a subcontainer.  Usually called indirectly from the PELib object.

        DataContainer *FindContainer(std::string name) { return sortedChildren_[name]; }
        DataContainer *FindContainer(std::vector<std::string>& split, size_t &n);

Get a list of fields or methods.

        const std::list<Field *>&Fields() { return fields_; }
        const std::list<CodeContainer *>&Methods() { return methods_; }

Traverse the items in this container.  Usually not called directly; calles as a result of calling Traverse on the PELib object.

        virtual bool Traverse(Callback &callback) const;

Returns true if this is in an 'extern' assembly (usually loaded)

        virtual bool InAssemblyRef() const { return parent_->InAssemblyRef(); }