--- /dev/null
+/********************* */\r
+/*! \file regexp.cpp\r
+ ** \verbatim\r
+ ** Original author: Tianyi Liang\r
+ ** Major contributors: none\r
+ ** Minor contributors (to current version): Morgan Deters\r
+ ** This file is part of the CVC4 project.\r
+ ** Copyright (c) 2009-2013 New York University and The University of Iowa\r
+ ** See the file COPYING in the top-level source directory for licensing\r
+ ** information.\endverbatim\r
+ **\r
+ ** \brief [[ Add one-line brief description here ]]\r
+ **\r
+ ** [[ Add lengthier description here ]]\r
+ ** \todo document this file\r
+ **/\r
+\r
+#include "util/regexp.h"\r
+#include <iostream>\r
+\r
+using namespace std;\r
+\r
+namespace CVC4 {\r
+\r
+std::string String::toString() const {\r
+ std::string str;\r
+ for(unsigned int i=0; i<d_str.size(); ++i) {\r
+ char c = convertUnsignedIntToChar( d_str[i] );\r
+ if(isprint( c )) {\r
+ if(c == '\\') {\r
+ str += "\\\\";\r
+ } else if(c == '\"') {\r
+ str += "\\\"";\r
+ } else {\r
+ str += c;\r
+ }\r
+ } else {\r
+ std::string s;\r
+ switch(c) {\r
+ case '\a': s = "\\a"; break;\r
+ case '\b': s = "\\b"; break;\r
+ case '\t': s = "\\t"; break;\r
+ case '\r': s = "\\r"; break;\r
+ case '\v': s = "\\v"; break;\r
+ case '\f': s = "\\f"; break;\r
+ case '\n': s = "\\n"; break;\r
+ case '\e': s = "\\e"; break;\r
+ default : {\r
+ std::string s2 = static_cast<std::ostringstream*>( &(std::ostringstream() << (int)c) )->str();\r
+ if(s2.size() == 1) {\r
+ s2 = "0" + s2;\r
+ }\r
+ s = "\\x" + s2;\r
+ }\r
+ }\r
+ str += s;\r
+ }\r
+ }\r
+ return str;\r
+}\r
+\r
+std::ostream& operator <<(std::ostream& os, const String& s) {\r
+ return os << "\"" << s.toString() << "\"";\r
+}\r
+\r
+std::ostream& operator<<(std::ostream& out, const RegExp& s) {\r
+ return out << "regexp(" << s.getType() << ')';\r
+}\r
+\r
+}/* CVC4 namespace */
\ No newline at end of file