blob: 988e302ae6ee1138621922394e5ceb594ac50712 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// -*- C++ -*-
//=============================================================================
/**
* @file Svc_Conf_Lexer_Guard.h
*
* $Id$
*
* @author Ossama Othman <ossama@uci.edu>
*/
//=============================================================================
#ifndef ACE_SVC_CONF_LEXER_GUARD_H
#define ACE_SVC_CONF_LEXER_GUARD_H
#include "ace/pre.h"
#include "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
/**
* @class ACE_Svc_Conf_Lexer_Guard
*
* @brief "Guard" that ensures lexer buffer stack manipulation is
* exception-safe.
*
* Buffers are allocated and deallocated when scanning a file or a
* string. This class utilizes the "guard" idiom to perform stack
* pushing and popping before and after parsing/scanning.
* @par
* The underlying stack allows nested scans to occur. For example,
* while scanning a `svc.conf' file, a Service Object's init() method
* could invoke a Service Configurator directive, which would require
* "moving" the current lexer state out of the way (pushing it onto
* the stack implementation).
*/
class ACE_Svc_Conf_Lexer_Guard
{
public:
/// Constructor
/**
* Create a new buffer to be used when scanning a new Service
* Configurator file, push it onto the underlying buffer stack,
* and make it the current buffer.
*/
ACE_Svc_Conf_Lexer_Guard (FILE *file);
/// Constructor
/**
* Create a new buffer to be used when scanning a new Service
* Configurator directive, push it onto the underlying buffer stack,
* and make it the current buffer.
*/
ACE_Svc_Conf_Lexer_Guard (const char *directive);
/// Destructor
/**
* Pop the current buffer off of the underlying buffer stack,
* and make the previous buffer (i.e. the one on the top of the
* stack), the current buffer.
*/
~ACE_Svc_Conf_Lexer_Guard (void);
};
#include "ace/post.h"
#endif /* ACE_SVC_CONF_LEXER_GUARD_H */
|