diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-19 13:46:58 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-19 13:46:58 +0000 |
commit | efc7a579e880ec15ebe9afc0d8766c85c7d53ec2 (patch) | |
tree | c83d553fcdc3f3497b6645baa198288d499054a1 /src/libutil/util.hh | |
parent | 55b5ddd3ca1ff4dfe4cfbfab92a4025d88ef6443 (diff) |
* Don't use the ATerm library for parsing/printing .drv files.
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r-- | src/libutil/util.hh | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 4de33d3ef..ff710077c 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -302,32 +302,21 @@ string int2String(int n); bool hasSuffix(const string & s, const string & suffix); -/* Exception handling in destructors: print an error message, then - ignore the exception. */ -void ignoreException(); +/* Read string `s' from stream `str'. */ +void expect(std::istream & str, const string & s); -/* STL functions such as sort() pass a binary function object around - by value, so it gets cloned a lot. This is bad if the function - object has state or is simply large. This adapter wraps the - function object to simulate passing by reference. */ -template<class F> -struct binary_function_ref_adapter -{ - F * p; +/* Read a C-style string from stream `str'. */ +string parseString(std::istream & str); - binary_function_ref_adapter(F * _p) - { - p = _p; - } - - typename F::result_type operator () ( - const typename F::first_argument_type & x, - const typename F::second_argument_type & y) - { - return (*p)(x, y); - } -}; + +/* Utility function used to parse legacy ATerms. */ +bool endOfList(std::istream & str); + + +/* Exception handling in destructors: print an error message, then + ignore the exception. */ +void ignoreException(); } |