summaryrefslogtreecommitdiff
path: root/ace/Svc_Conf_Lexer_Guard.h
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2001-07-29 06:10:07 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2001-07-29 06:10:07 +0000
commitfd5cbe771ca5dcbe40677c7a23dd27d6d6173d40 (patch)
tree3f41ae0351ab00180fb9e598bdfdefb3caedbe84 /ace/Svc_Conf_Lexer_Guard.h
parentb5ec4decbec04a9cb35ad340b180d640d14fdf12 (diff)
downloadATCD-fd5cbe771ca5dcbe40677c7a23dd27d6d6173d40.tar.gz
ChangeLogTag:Sat Jul 28 23:03:24 2001 Ossama Othman <ossama@uci.edu>
Diffstat (limited to 'ace/Svc_Conf_Lexer_Guard.h')
-rw-r--r--ace/Svc_Conf_Lexer_Guard.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/ace/Svc_Conf_Lexer_Guard.h b/ace/Svc_Conf_Lexer_Guard.h
new file mode 100644
index 00000000000..988e302ae6e
--- /dev/null
+++ b/ace/Svc_Conf_Lexer_Guard.h
@@ -0,0 +1,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 */