mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
keep
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
147b3600d9
29 changed files with 239 additions and 120 deletions
|
@ -87,6 +87,7 @@ zstring::zstring(char const* s) {
|
|||
SASSERT(well_formed());
|
||||
}
|
||||
|
||||
|
||||
bool zstring::uses_unicode() const {
|
||||
return gparams::get_value("unicode") != "false";
|
||||
}
|
||||
|
@ -234,12 +235,17 @@ zstring zstring::extract(unsigned offset, unsigned len) const {
|
|||
return result;
|
||||
}
|
||||
|
||||
unsigned zstring::hash() const {
|
||||
return unsigned_ptr_hash(m_buffer.data(), m_buffer.size(), 23);
|
||||
}
|
||||
|
||||
zstring zstring::operator+(zstring const& other) const {
|
||||
zstring result(*this);
|
||||
result.m_buffer.append(other.m_buffer);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool zstring::operator==(const zstring& other) const {
|
||||
// two strings are equal iff they have the same length and characters
|
||||
if (length() != other.length()) {
|
||||
|
|
|
@ -19,6 +19,7 @@ Author:
|
|||
#include <string>
|
||||
#include "util/vector.h"
|
||||
#include "util/buffer.h"
|
||||
#include "util/rational.h"
|
||||
|
||||
class zstring {
|
||||
private:
|
||||
|
@ -34,6 +35,7 @@ public:
|
|||
zstring() {}
|
||||
zstring(char const* s);
|
||||
zstring(const std::string &str) : zstring(str.c_str()) {}
|
||||
zstring(rational const& r): zstring(r.to_string()) {}
|
||||
zstring(unsigned sz, unsigned const* s) { m_buffer.append(sz, s); SASSERT(well_formed()); }
|
||||
zstring(unsigned ch);
|
||||
zstring replace(zstring const& src, zstring const& dst) const;
|
||||
|
@ -51,6 +53,7 @@ public:
|
|||
zstring operator+(zstring const& other) const;
|
||||
bool operator==(const zstring& other) const;
|
||||
bool operator!=(const zstring& other) const;
|
||||
unsigned hash() const;
|
||||
|
||||
friend std::ostream& operator<<(std::ostream &os, const zstring &str);
|
||||
friend bool operator<(const zstring& lhs, const zstring& rhs);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue