bool ParsedTypeStructure::Initialize(ParsedContextSet &set, Parser &parser, Parser::Element *pElementBase, Parser::Element *pElement, string &error) { if (!superM.Initialize(set, parser, BaseType_Structure, pElementBase, error)) { return false; } // Structure *pStructureM Context *pContext; if (!(pContext = set.GetContext (parser, pElement->GetAttributeValue("id"), error))) { return false; } if ((pContext->GetType() != Context::Type_Class) && (pContext->GetType() != Context::Type_Struct) && (pContext->GetType() != Context::Type_Union)) { error = ("Expected structure while processing structure type " + pElementBase->GetAttributeValue("id")); return false; } pStructureM = (Structure *) pContext; return true; }
bool Equals(const Context &c1, const Context &c2) { Context::Type t1 = c1.GetType(); if (t1 != c2.GetType()) { return false; } switch (t1) { case Context::Type_Class: case Context::Type_Struct: return ((const Struct &) c1 == (const Struct &) c2); case Context::Type_Namespace: return (c1 == c2); default: // Type_Union return ((const Structure &) c1 == (const Structure &) c2); } }