Of course the changes should be done in all derived classes:
XMLValidator.hpp
virtual Grammar* getGrammar() const = 0;
DTDValidator.hpp
virtual Grammar* getGrammar() const;
...
inline Grammar* DTDValidator::getGrammar() const {
return fDTDGrammar;
}
SchemaValidator.hpp
virtual Grammar* getGrammar() const;
...
inline Grammar* SchemaValidator::getGrammar() const {
return fSchemaGrammar;
}
> Review the following code:
>
> void MyParser::someMethod()
> {
> ...
> const XMLElementDecl* eDecl =
getValidator().getGrammar()->getElemDecl(id);
> ...
> }
>
> I cannot get the XMLElementDecl, because getGrammar() returns not constant
> pointer.
>
> Solutions:
> 1. add "const" to getGrammar() method
> 2. remove "const" from getValidator()
>
> I guess the first is better.
> ----------------------
>
> DomParser.hpp
> const XMLValidator& getValidator() const;
>
> XMLValidator.hpp
> virtual Grammar* getGrammar() =0; // virtual const ...
>
> Grammar.hpp
> virtual const XMLElementDecl* getElemDecl(const unsigned int elemId)
> const =0;
>
>
>
>
> Peter A. Volchek
> Software Engineer
> Metis International, Inc.
> [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]