summaryrefslogtreecommitdiff
path: root/examples/file/README
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-12-10 09:47:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-12-10 09:47:29 +0200
commitf8edfd22cb45b554a573d2722900196758e9e958 (patch)
treeb2c800c8793f08be287a67ed72517f9cc2831fda /examples/file/README
parenteddefea6ea39e64e9eb5adf74a279a230a63cf5b (diff)
Scanner-based parsing with support for element erasing
Also implement argv_file_scanner which provides support for reading command line arguments from the argv array as well as files specified with command line options. New examples: file. New tests: ctor, erase, file.
Diffstat (limited to 'examples/file/README')
-rw-r--r--examples/file/README38
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/file/README b/examples/file/README
new file mode 100644
index 0000000..289fc64
--- /dev/null
+++ b/examples/file/README
@@ -0,0 +1,38 @@
+This example shows how to allow the users of your application to supply
+options in files in addition to the command line.
+
+The example consists of the following files:
+
+options.cli
+ Command line interface description in the CLI language.
+
+options.hxx
+options.ixx
+options.cxx
+ Command line interface implementation in C++. These files are generated
+ by the CLI compiler from options.cli using the following command line:
+
+ cli --generate-file-scanner hello.cli
+
+ We use the --generate-file-scanner CLI compiler option to include the
+ argv_file_scanner scanner implementation which provides support for
+ reading options from files in addition to the command line.
+
+driver.cxx
+ Driver for the example. It first creates the argv_file_scanner object
+ and indicates that the values for the --options-file option should be
+ recognized as files containing additional options. It then passes this
+ scanner object to the option class which parses the command line. The
+ driver then prints the option values.
+
+test.ops
+ Sample options file.
+
+To run this example you can try the following command line:
+
+$ ./driver --verbose 2 --val 1 --options-file test.ops --val 4
+
+The output will be:
+
+verbosity: 5
+values: 1 2 3 4