aboutsummaryrefslogtreecommitdiff
path: root/Carpet
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2007-01-12 21:08:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2007-01-12 21:08:00 +0000
commit46e30f53f9789beaa49b942ed3a0c168e4a99f7c (patch)
tree3d26ce70a2aef860df7610696009bf027cc1dea0 /Carpet
parentc23315efb5b4fea80c92f747173e47a7d29d644d (diff)
CarpetLib: Add consume() routine for strings
Add a routine consume() which reads a whole string, not only a single character. darcs-hash:20070112210808-dae7b-dc1e0be61cefe8af390d9f598bfdac314dd7aeac.gz
Diffstat (limited to 'Carpet')
-rw-r--r--Carpet/CarpetLib/src/defs.cc9
-rw-r--r--Carpet/CarpetLib/src/defs.hh5
2 files changed, 12 insertions, 2 deletions
diff --git a/Carpet/CarpetLib/src/defs.cc b/Carpet/CarpetLib/src/defs.cc
index 09a078141..f912d28a0 100644
--- a/Carpet/CarpetLib/src/defs.cc
+++ b/Carpet/CarpetLib/src/defs.cc
@@ -71,6 +71,15 @@ void consume (istream& is, const char c) {
+void consume (istream& is, const char * const s) {
+ for (const char * p = s; * p; ++ p) {
+ expect (is, * p);
+ is.get();
+ }
+}
+
+
+
// Vector input
template<class T>
istream& input (istream& is, vector<T>& v) {
diff --git a/Carpet/CarpetLib/src/defs.hh b/Carpet/CarpetLib/src/defs.hh
index 3e2bc1734..3ad0becec 100644
--- a/Carpet/CarpetLib/src/defs.hh
+++ b/Carpet/CarpetLib/src/defs.hh
@@ -70,8 +70,9 @@ T ipow (T x, int y);
// Input streams
struct input_error { };
void skipws (istream& is);
-void expect (istream& is, const char c);
-void consume (istream& is, const char c);
+void expect (istream& is, char c);
+void consume (istream& is, char c);
+void consume (istream& is, char const * c);