lemon/bits/item_writer.h
changeset 2426 6e1027a05d73
parent 2391 14a343be7a5a
child 2553 bfced05fa852
     1.1 --- a/lemon/bits/item_writer.h	Thu Apr 19 15:12:59 2007 +0000
     1.2 +++ b/lemon/bits/item_writer.h	Thu Apr 19 15:14:34 2007 +0000
     1.3 @@ -31,6 +31,9 @@
     1.4  #include <deque>
     1.5  #include <list>
     1.6  #include <set>
     1.7 +#include <map>
     1.8 +
     1.9 +#include <lemon/error.h>
    1.10  
    1.11  namespace lemon {
    1.12    
    1.13 @@ -146,13 +149,14 @@
    1.14      ///
    1.15      /// Constructor for the writer. If the given parameter is true
    1.16      /// the writer creates escape sequences from special characters.
    1.17 -    QuotedStringWriter(bool _escaped = true) : escaped(_escaped) {}
    1.18 +    QuotedStringWriter(bool _escaped = true, char _quote = '\"') 
    1.19 +      : escaped(_escaped), quote(_quote) {}
    1.20  
    1.21      /// \brief Writes a quoted string to the given stream.
    1.22      ///
    1.23      /// Writes a quoted string to the given stream.
    1.24      void write(std::ostream& os, const std::string& value) const {
    1.25 -      os << "\"";
    1.26 +      os << quote;
    1.27        if (escaped) {
    1.28  	std::ostringstream ls;
    1.29  	for (int i = 0; i < int(value.size()); ++i) {
    1.30 @@ -162,7 +166,7 @@
    1.31        } else {
    1.32  	os << value;
    1.33        }
    1.34 -      os << "\"";
    1.35 +      os << quote;
    1.36      }
    1.37  
    1.38    private:
    1.39 @@ -213,6 +217,7 @@
    1.40      }
    1.41    private:
    1.42      bool escaped;
    1.43 +    char quote;
    1.44    };
    1.45  
    1.46    /// \ingroup item_io