Unicorn XML Toolkit
Version 1.00.00

Namespace Som
Class CParser

class CParser {
public:
    CParser();
    ~CParser();
public:
    void SetErrorHandler(CErrorHandler *pErrorHandler);
    void SetProgramName(const CString &strProgramName);
    void SetLineNumber(int nLineNumber);
    void Parse(IStream *pStream, const XRepository &pRepository);
    bool HaveError();
    };

The SOM IDL parser.

The parser performs parsing of the source IDL description, extracts definitions of modules, interfaces, constants, attributes, and operations, and adds these definitions to the specified SOM repository.

When the parser detects an error in the IDL source (for example, invalid IDL syntax), it attempts to recover and to continue parsing. All errors are reported to the error handler (see CErrorHandler ) attached to this parser. When the parsing is finished, the application can use HaveError function to check whether any errors were detected.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
See Also:
CErrorHandler
Constructor/Destructor Summary
CParser ();
����������Constructs the IDL parser.
~CParser ();
����������Destroys the IDL parser.

Function Summary
void SetErrorHandler (CErrorHandler *pErrorHandler);
����������Specifies the error handler for reporting non-fatal parse errors.
void SetProgramName (const CString &strProgramName);
����������Specifies the name of the IDL source.
void SetLineNumber (int nLineNumber);
����������Specifies the starting line number of the IDL source.
void Parse (IStream *pStream, const XRepository &pRepository);
����������Parses the IDL definition provided by the given stream; adds results to the specified repository.
bool HaveError ();
����������Tests whether a parse error was encountered.

Constructor/Destructor Detail

CParser

CParser();

Constructs the IDL parser.

~CParser

~CParser();

Destroys the IDL parser.

Function Detail

SetErrorHandler

void SetErrorHandler(CErrorHandler *pErrorHandler);

Specifies the error handler for reporting non-fatal parse errors.

Parameters:
pErrorHandler - the error handler

SetProgramName

void SetProgramName(const CString &strProgramName);

Specifies the name of the IDL source.

This name may be used in error messages.

Parameters:
strProgramName - the source name

SetLineNumber

void SetLineNumber(int nLineNumber);

Specifies the starting line number of the IDL source.

Usually this parameter is set to 1 ; the different value may be used if the IDL definition is embedded in a bigger file. Line numbers may be used in error messages.

Parameters:
nLineNumber - the starting line number

Parse

void Parse(IStream *pStream, const XRepository &pRepository);

Parses the IDL definition provided by the given stream; adds results to the specified repository.

The repository needs not to be empty when the parsing is started. An application can perform multiple parser runs with different IDL sources and the same repository; as the result, the repository will contain definitions extracted from multiple IDL sources.

Parameters:
pStream - the stream containing IDL source
pRepository - the repository

HaveError

bool HaveError();

Tests whether a parse error was encountered.

Returns:
true if the parse error was encountered; false otherwise

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

Copyright 1999-2001 Unicorn Enterprises SA.
All Rights Reserved.