3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00

add get_lstring per #2286

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-05-22 10:16:15 +04:00
parent 112e13eeea
commit b2845d888e
11 changed files with 64 additions and 10 deletions

View file

@ -3453,9 +3453,9 @@ void scoped_mark::pop_scope(unsigned num_scopes) {
// show an expr_ref on stdout
void prexpr(expr_ref &e){
std::cout << mk_pp(e.get(), e.get_manager()) << std::endl;
std::cout << mk_pp(e.get(), e.get_manager()) << std::endl;
}
void ast_manager::show_id_gen(){
std::cout << "id_gen: " << m_expr_id_gen.show_hash() << " " << m_decl_id_gen.show_hash() << "\n";
std::cout << "id_gen: " << m_expr_id_gen.show_hash() << " " << m_decl_id_gen.show_hash() << "\n";
}

View file

@ -224,6 +224,17 @@ std::string zstring::encode() const {
return strm.str();
}
std::string zstring::as_string() const {
SASSERT(m_encoding == ascii);
std::ostringstream strm;
for (unsigned i = 0; i < m_buffer.size(); ++i) {
unsigned char ch = m_buffer[i];
strm << (char)(ch);
}
return strm.str();
}
bool zstring::suffixof(zstring const& other) const {
if (length() > other.length()) return false;
bool suffix = true;

View file

@ -107,6 +107,7 @@ public:
unsigned num_bits() const { return (m_encoding==ascii)?8:16; }
encoding get_encoding() const { return m_encoding; }
std::string encode() const;
std::string as_string() const;
unsigned length() const { return m_buffer.size(); }
unsigned operator[](unsigned i) const { return m_buffer[i]; }
bool empty() const { return m_buffer.empty(); }