diff --git a/src/tightdb/array.cpp b/src/tightdb/array.cpp index fa6b1e1d92e..78aed84fe1d 100644 --- a/src/tightdb/array.cpp +++ b/src/tightdb/array.cpp @@ -173,7 +173,7 @@ void Array::Preset(size_t bitwidth, size_t count) void Array::Preset(int64_t min, int64_t max, size_t count) { - size_t w = std::max(BitWidth(max), BitWidth(min)); + size_t w = ::max(BitWidth(max), BitWidth(min)); Preset(w, count); } @@ -1531,7 +1531,7 @@ template void Array::sort() size_t lo = 0; size_t hi = m_len - 1; - std::vector count; + vector count; int64_t min; int64_t max; bool b = false; @@ -1669,9 +1669,9 @@ template void Array::QuickSort(size_t lo, size_t hi) if (i < (int)hi) QuickSort(i, hi); } -std::vector Array::ToVector() const +vector Array::ToVector() const { - std::vector v; + vector v; const size_t count = size(); for (size_t t = 0; t < count; ++t) v.push_back(Get(t)); @@ -1694,12 +1694,12 @@ bool Array::Compare(const Array& c) const void Array::Print() const { - std::cout << std::hex << GetRef() << std::dec << ": (" << size() << ") "; + cout << hex << GetRef() << dec << ": (" << size() << ") "; for (size_t i = 0; i < size(); ++i) { - if (i) std::cout << ", "; - std::cout << Get(i); + if (i) cout << ", "; + cout << Get(i); } - std::cout << "\n"; + cout << "\n"; } void Array::Verify() const @@ -1714,25 +1714,25 @@ void Array::Verify() const TIGHTDB_ASSERT(ref_in_parent == (IsValid() ? m_ref : 0)); } -void Array::ToDot(std::ostream& out, const char* title) const +void Array::ToDot(ostream& out, StringData title) const { const size_t ref = GetRef(); - if (title) { - out << "subgraph cluster_" << ref << " {" << std::endl; - out << " label = \"" << title << "\";" << std::endl; - out << " color = white;" << std::endl; + if (0 < title.size()) { + out << "subgraph cluster_" << ref << " {" << endl; + out << " label = \"" << title << "\";" << endl; + out << " color = white;" << endl; } - out << "n" << std::hex << ref << std::dec << "[shape=none,label=<"; - out << "" << std::endl; + out << "n" << hex << ref << dec << "[shape=none,label=<"; + out << "
" << endl; // Header out << "" << std::endl; + out << "" << endl; // Values for (size_t i = 0; i < m_len; ++i) { @@ -1744,23 +1744,23 @@ void Array::ToDot(std::ostream& out, const char* title) const else out << "" << std::endl; + out << "" << endl; } - out << "
"; - out << "0x" << std::hex << ref << std::dec << "
"; + out << "0x" << hex << ref << dec << "
"; if (m_isNode) out << "IsNode
"; if (m_hasRefs) out << "HasRefs
"; - out << "
"; } else out << "" << v; - out << "
>];" << std::endl; - if (title) out << "}" << std::endl; + out << ">];" << endl; + if (0 < title.size()) out << "}" << endl; if (m_hasRefs) { for (size_t i = 0; i < m_len; ++i) { const int64_t target = Get(i); if (target == 0 || target & 0x1) continue; // zero-refs and refs that are not 64-aligned do not point to sub-trees - out << "n" << std::hex << ref << std::dec << ":" << i; - out << " -> n" << std::hex << target << std::dec << std::endl; + out << "n" << hex << ref << dec << ":" << i; + out << " -> n" << hex << target << dec << endl; } } - out << std::endl; + out << endl; } void Array::Stats(MemStats& stats) const diff --git a/src/tightdb/array.hpp b/src/tightdb/array.hpp index 832b0c0f42b..1bbae908ba3 100644 --- a/src/tightdb/array.hpp +++ b/src/tightdb/array.hpp @@ -397,7 +397,7 @@ class Array: public ArrayParent { #ifdef TIGHTDB_DEBUG void Print() const; void Verify() const; - void ToDot(std::ostream& out, const char* title=NULL) const; + void ToDot(std::ostream& out, StringData title = StringData()) const; void Stats(MemStats& stats) const; #endif // TIGHTDB_DEBUG diff --git a/src/tightdb/array_binary.cpp b/src/tightdb/array_binary.cpp index 564200b8f5e..3598ad740f7 100644 --- a/src/tightdb/array_binary.cpp +++ b/src/tightdb/array_binary.cpp @@ -154,9 +154,9 @@ void ArrayBinary::ToDot(ostream& out, const char* title) const if (title) out << "\\n'" << title << "'"; out << "\";" << endl; - Array::ToDot(out, "binary_top"); - m_offsets.ToDot(out, "offsets"); - m_blob.ToDot(out, "blob"); +// Array::ToDot(out, "binary_top"); +// m_offsets.ToDot(out, "offsets"); +// m_blob.ToDot(out, "blob"); out << "}" << endl; } diff --git a/src/tightdb/array_string_long.cpp b/src/tightdb/array_string_long.cpp index 24a0049571d..725f5a428fa 100644 --- a/src/tightdb/array_string_long.cpp +++ b/src/tightdb/array_string_long.cpp @@ -155,9 +155,9 @@ void ArrayStringLong::ToDot(ostream& out, const char* title) const if (title) out << "\\n'" << title << "'"; out << "\";" << endl; - Array::ToDot(out, "stringlong_top"); - m_offsets.ToDot(out, "offsets"); - m_blob.ToDot(out, "blob"); +// Array::ToDot(out, "stringlong_top"); +// m_offsets.ToDot(out, "offsets"); +// m_blob.ToDot(out, "blob"); out << "}" << endl; } diff --git a/src/tightdb/column.cpp b/src/tightdb/column.cpp index e7de05d1056..5e159bafaa3 100644 --- a/src/tightdb/column.cpp +++ b/src/tightdb/column.cpp @@ -855,11 +855,11 @@ void ColumnBase::ArrayToDot(std::ostream& out, const Array& array) const out << " label = \"Node\";" << std::endl; array.ToDot(out); - offsets.ToDot(out, "offsets"); +// offsets.ToDot(out, "offsets"); out << "}" << std::endl; - refs.ToDot(out, "refs"); +// refs.ToDot(out, "refs"); const size_t count = refs.size(); for (size_t i = 0; i < count; ++i) { diff --git a/src/tightdb/column_mixed.cpp b/src/tightdb/column_mixed.cpp index fe5668575ae..2d182f37a1c 100644 --- a/src/tightdb/column_mixed.cpp +++ b/src/tightdb/column_mixed.cpp @@ -324,7 +324,7 @@ void ColumnMixed::ToDot(std::ostream& out, StringData title) const if (0 < title.size()) out << "\\n'" << title << "'"; out << "\";" << std::endl; - m_array->ToDot(out, "mixed_top"); +// m_array->ToDot(out, "mixed_top"); // Write sub-tables const size_t count = Size(); @@ -335,11 +335,11 @@ void ColumnMixed::ToDot(std::ostream& out, StringData title) const subtable->to_dot(out); } - m_types->ToDot(out, "types"); - m_refs->ToDot(out, "refs"); +// m_types->ToDot(out, "types"); +// m_refs->ToDot(out, "refs"); if (m_array->size() > 2) { - m_data->ToDot(out, "data"); +// m_data->ToDot(out, "data"); } out << "}" << std::endl; diff --git a/src/tightdb/column_string_enum.cpp b/src/tightdb/column_string_enum.cpp index 3cdddbfce9a..77fa4be99f7 100644 --- a/src/tightdb/column_string_enum.cpp +++ b/src/tightdb/column_string_enum.cpp @@ -256,8 +256,8 @@ void ColumnStringEnum::ToDot(std::ostream& out, StringData title) const if (0 < title.size()) out << "\\n'" << title << "'"; out << "\";" << std::endl; - m_keys.ToDot(out, "keys"); - Column::ToDot(out, "values"); +// m_keys.ToDot(out, "keys"); +// Column::ToDot(out, "values"); out << "}" << std::endl; } diff --git a/src/tightdb/group.cpp b/src/tightdb/group.cpp index 2bbfed5991e..4d50ccd7401 100644 --- a/src/tightdb/group.cpp +++ b/src/tightdb/group.cpp @@ -665,9 +665,9 @@ void Group::to_dot(std::ostream& out) const out << "subgraph cluster_group {" << endl; out << " label = \"Group\";" << endl; - m_top.ToDot(out, "group_top"); - m_tableNames.ToDot(out, "table_names"); - m_tables.ToDot(out, "tables"); +// m_top.ToDot(out, "group_top"); +// m_tableNames.ToDot(out, "table_names"); +// m_tables.ToDot(out, "tables"); // Tables for (size_t i = 0; i < m_tables.size(); ++i) { diff --git a/src/tightdb/index_string.cpp b/src/tightdb/index_string.cpp index fb1f937013b..6e86e8ec32b 100644 --- a/src/tightdb/index_string.cpp +++ b/src/tightdb/index_string.cpp @@ -677,11 +677,11 @@ void StringIndex::ArrayToDot(std::ostream& out, const Array& array) const } array.ToDot(out); - KeysToDot(out, offsets, "keys"); +// KeysToDot(out, offsets, "keys"); out << "}" << std::endl; - refs.ToDot(out, "refs"); +// refs.ToDot(out, "refs"); const size_t count = refs.size(); for (size_t i = 0; i < count; ++i) { diff --git a/src/tightdb/mixed.hpp b/src/tightdb/mixed.hpp index 0304553fd70..81d66280c1c 100644 --- a/src/tightdb/mixed.hpp +++ b/src/tightdb/mixed.hpp @@ -110,8 +110,10 @@ class Mixed { // These are shortcuts for Mixed(StringData(c_str)), and are // needed to avoid unwanted implicit conversion of char* to bool. - Mixed( char* c_str) TIGHTDB_NOEXCEPT { set_string(c_str); } - Mixed(const char* c_str) TIGHTDB_NOEXCEPT { set_string(c_str); } +// Mixed( char* c_str) TIGHTDB_NOEXCEPT { set_string(c_str); } +// Mixed(const char* c_str) TIGHTDB_NOEXCEPT { set_string(c_str); } + + template Mixed(T*) { typename T::viggo x; } struct subtable_tag {}; Mixed(subtable_tag) TIGHTDB_NOEXCEPT: m_type(type_Table) {} @@ -189,6 +191,7 @@ bool operator==(Wrap, StringData) TIGHTDB_NOEXCEPT; bool operator!=(Wrap, StringData) TIGHTDB_NOEXCEPT; bool operator==(StringData, Wrap) TIGHTDB_NOEXCEPT; bool operator!=(StringData, Wrap) TIGHTDB_NOEXCEPT; +/* bool operator==(Wrap, const char* c_str) TIGHTDB_NOEXCEPT; bool operator!=(Wrap, const char* c_str) TIGHTDB_NOEXCEPT; bool operator==(const char* c_str, Wrap) TIGHTDB_NOEXCEPT; @@ -197,6 +200,7 @@ bool operator==(Wrap, char* c_str) TIGHTDB_NOEXCEPT; bool operator!=(Wrap, char* c_str) TIGHTDB_NOEXCEPT; bool operator==(char* c_str, Wrap) TIGHTDB_NOEXCEPT; bool operator!=(char* c_str, Wrap) TIGHTDB_NOEXCEPT; +*/ // Compare mixed with binary data bool operator==(Wrap, BinaryData) TIGHTDB_NOEXCEPT; @@ -493,6 +497,7 @@ inline bool operator!=(StringData a, Wrap b) TIGHTDB_NOEXCEPT return type_String != Mixed(b).get_type() || a != Mixed(b).get_string(); } +/* inline bool operator==(Wrap a, const char* b) TIGHTDB_NOEXCEPT { return a == StringData(b); @@ -532,6 +537,7 @@ inline bool operator!=(char* a, Wrap b) TIGHTDB_NOEXCEPT { return StringData(a) != b; } +*/ // Compare mixed with binary data diff --git a/src/tightdb/spec.cpp b/src/tightdb/spec.cpp index 33ac45fc927..6b1e93e1deb 100644 --- a/src/tightdb/spec.cpp +++ b/src/tightdb/spec.cpp @@ -433,7 +433,7 @@ void Spec::Verify() const TIGHTDB_ASSERT(column_count <= m_spec.size()); } -void Spec::to_dot(std::ostream& out, const char*) const +void Spec::to_dot(std::ostream& out, StringData) const { const size_t ref = m_specSet.GetRef(); diff --git a/src/tightdb/spec.hpp b/src/tightdb/spec.hpp index 7f5626687af..3fac6dea170 100644 --- a/src/tightdb/spec.hpp +++ b/src/tightdb/spec.hpp @@ -79,7 +79,7 @@ class Spec { #ifdef TIGHTDB_DEBUG void Verify() const; // Must be upper case to avoid conflict with macro in ObjC - void to_dot(std::ostream& out, const char* title=NULL) const; + void to_dot(std::ostream& out, StringData title = StringData()) const; #endif // TIGHTDB_DEBUG private: diff --git a/src/tightdb/string_data.hpp b/src/tightdb/string_data.hpp index 22b622816a9..57ba08844df 100644 --- a/src/tightdb/string_data.hpp +++ b/src/tightdb/string_data.hpp @@ -36,7 +36,8 @@ namespace tightdb { /// other way attempt to manage the lifetime of it. /// /// \sa BinaryData -struct StringData { +class StringData { +public: StringData() TIGHTDB_NOEXCEPT: m_data(0), m_size(0) {} StringData(const char* d, std::size_t s) TIGHTDB_NOEXCEPT: m_data(d), m_size(s) {} diff --git a/src/tightdb/table.cpp b/src/tightdb/table.cpp index ebed6bb1688..bc397739541 100644 --- a/src/tightdb/table.cpp +++ b/src/tightdb/table.cpp @@ -2644,7 +2644,7 @@ void Table::to_dot(std::ostream& out, StringData title) const out << " label = \"TopLevelTable"; if (0 < title.size()) out << "\\n'" << title << "'"; out << "\";" << endl; - m_top.ToDot(out, "table_top"); +// m_top.ToDot(out, "table_top"); const Spec& specset = get_spec(); specset.to_dot(out); } @@ -2662,7 +2662,7 @@ void Table::to_dot(std::ostream& out, StringData title) const void Table::ToDotInternal(std::ostream& out) const { - m_columns.ToDot(out, "columns"); +// m_columns.ToDot(out, "columns"); // Columns const size_t column_count = get_column_count();