www.pudn.com > cppcc.rar > cw_options_recorder.h


/*
 *  File:       cw_options_recorder.h
 *              $Id: cw_options_recorder.h,v 1.2 2002/04/29 09:34:10 alec Exp $
 *
 *  Author:     Alec Panoviciu (alecu@email.com)
 *
 *  Comments: this is the OptionsRecorder C wrapper. This layer is intended to
 *  make the YACC code behave as it were part of an IParser implementation
 *  towards the OptionsRecorder.
 *
 *  Revision history:
 *
 *  $Log: cw_options_recorder.h,v $
 *  Revision 1.2  2002/04/29 09:34:10  alec
 *  scanner ptree building compiles
 *
 */


/* 
  Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com)

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 */

#ifndef __CW_OPTIONS_RECORDER_H__
#define __CW_OPTIONS_RECORDER_H__

#include "debug.h"

#ifdef __cplusplus

class OptionsRecorder;

/**
 * \ingroup cw_options_recorder
 *
 * This will point to the OptionsRecorder object whose methods should actually
 * be called by the wrapper functions. It is initialized by the LexYaccParser
 * before parsing starts.
 */
extern OptionsRecorder *cw_optionsRecorder;

#define CLINK extern "C"

#else

#define CLINK 

#endif


/**
 * \defgroup cw_options_recorder OptionsRecorder C Wrapper
 *
 * These are the wrapper functions that will get called from the C parser
 * code. Each of these will call the corresponding method of the
 * OptionsRecorder instance pointed to by cw_OptinosRecorder.
 *
 * @{
 */
 

/**
 * Adds a string option into the registry, via
 * cw_optionsRecorder::setOption. It also takes care of freeing the string
 * arguments. 
 */
CLINK void OptionsRecorder_setStringOption (char *key, char *value);

/**
 * Adds an integer option into the registry, via
 * cw_optionsRecorder::setOption. It also takes care of freeing the string
 * arguments. 
 */
CLINK void OptionsRecorder_setBoolOption (char *key, int value);

/**
 * Adds a boolean option into the registry, via
 * cw_optionsRecorder::setOption. It also takes care of freeing the string
 * arguments.
 */
CLINK void OptionsRecorder_setIntOption (char *key, int value);


#ifdef DEBUG

/**
 * This method dumps the whole registry to cerr.
 */
CLINK void OptionsRecorder_dumpOptions ();

#endif

/* @} */

#endif /* #ifndef __CW_OPTIONS_RECORDER_H__ */