aboutsummaryrefslogtreecommitdiff
path: root/Source/ablastr/utils/text
diff options
context:
space:
mode:
Diffstat (limited to 'Source/ablastr/utils/text')
-rw-r--r--Source/ablastr/utils/text/CMakeLists.txt1
-rw-r--r--Source/ablastr/utils/text/Make.package1
-rw-r--r--Source/ablastr/utils/text/StreamUtils.H24
-rw-r--r--Source/ablastr/utils/text/StreamUtils.cpp17
4 files changed, 43 insertions, 0 deletions
diff --git a/Source/ablastr/utils/text/CMakeLists.txt b/Source/ablastr/utils/text/CMakeLists.txt
index 037256942..754ec2859 100644
--- a/Source/ablastr/utils/text/CMakeLists.txt
+++ b/Source/ablastr/utils/text/CMakeLists.txt
@@ -2,6 +2,7 @@ foreach(D IN LISTS WarpX_DIMS)
warpx_set_suffix_dims(SD ${D})
target_sources(ablastr_${SD}
PRIVATE
+ StreamUtils.cpp
StringUtils.cpp
)
endforeach()
diff --git a/Source/ablastr/utils/text/Make.package b/Source/ablastr/utils/text/Make.package
index 1cd8ee593..9a47977bd 100644
--- a/Source/ablastr/utils/text/Make.package
+++ b/Source/ablastr/utils/text/Make.package
@@ -1,3 +1,4 @@
+CEXE_sources += StreamUtils.cpp
CEXE_sources += StringUtils.cpp
VPATH_LOCATIONS += $(WARPX_HOME)/Source/ablastr/utils/text
diff --git a/Source/ablastr/utils/text/StreamUtils.H b/Source/ablastr/utils/text/StreamUtils.H
new file mode 100644
index 000000000..b797c2fb6
--- /dev/null
+++ b/Source/ablastr/utils/text/StreamUtils.H
@@ -0,0 +1,24 @@
+/* Copyright 2023
+ *
+ * This file is part of WarpX.
+ *
+ * License: BSD-3-Clause-LBNL
+ */
+
+#ifndef ABLASTR_UTILS_TEXT_STREAMUTILS_H_
+#define ABLASTR_UTILS_TEXT_STREAMUTILS_H_
+
+#include <istream>
+
+namespace ablastr::utils::text
+{
+ /**
+ * \brief This function drops the rest of the current line of
+ * the input stream "is"
+ *
+ * @param[in,out] is the input stream
+ */
+ void goto_next_line (std::istream& is);
+}
+
+#endif //ABLASTR_UTILS_TEXT_STREAMUTILS_H_
diff --git a/Source/ablastr/utils/text/StreamUtils.cpp b/Source/ablastr/utils/text/StreamUtils.cpp
new file mode 100644
index 000000000..965beb179
--- /dev/null
+++ b/Source/ablastr/utils/text/StreamUtils.cpp
@@ -0,0 +1,17 @@
+/* Copyright 2023
+ *
+ * This file is part of WarpX.
+ *
+ * License: BSD-3-Clause-LBNL
+ */
+
+#include "StreamUtils.H"
+
+#include <ios>
+#include <limits>
+
+void
+ablastr::utils::text::goto_next_line (std::istream& is)
+{
+ is.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+}