Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array::Size() renamed to Array::size() #50

Merged
merged 1 commit into from
Feb 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/tightdb/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ void Array::Clear()

// Make sure we don't have any dangling references
if (m_hasRefs) {
for (size_t i = 0; i < Size(); ++i) {
for (size_t i = 0; i < size(); ++i) {
const size_t ref = GetAsRef(i);
if (ref == 0 || ref & 0x1) continue; // zero-refs and refs that are not 64-aligned do not point to sub-trees

Expand Down Expand Up @@ -1606,7 +1606,7 @@ template <size_t w>void Array::ReferenceSort(Array& ref)
}

// Accumulate occurences
for (size_t t = 1; t < count.Size(); t++) {
for (size_t t = 1; t < count.size(); t++) {
count.Set(t, count.Get(t) + count.Get(t - 1));
}

Expand All @@ -1621,7 +1621,7 @@ template <size_t w>void Array::ReferenceSort(Array& ref)
}

// Copy result into ref
for (size_t t = 0; t < res.Size(); t++)
for (size_t t = 0; t < res.size(); t++)
ref.Set(t, res.Get(t));

res.Destroy();
Expand Down Expand Up @@ -1781,17 +1781,17 @@ template<size_t w> void Array::QuickSort(size_t lo, size_t hi)
std::vector<int64_t> Array::ToVector(void) const
{
std::vector<int64_t> v;
const size_t count = Size();
const size_t count = size();
for (size_t t = 0; t < count; ++t)
v.push_back(Get(t));
return v;
}

bool Array::Compare(const Array& c) const
{
if (c.Size() != Size()) return false;
if (c.size() != size()) return false;

for (size_t i = 0; i < Size(); ++i) {
for (size_t i = 0; i < size(); ++i) {
if (Get(i) != c.Get(i)) return false;
}

Expand All @@ -1803,8 +1803,8 @@ bool Array::Compare(const Array& c) const

void Array::Print() const
{
std::cout << std::hex << GetRef() << std::dec << ": (" << Size() << ") ";
for (size_t i = 0; i < Size(); ++i) {
std::cout << std::hex << GetRef() << std::dec << ": (" << size() << ") ";
for (size_t i = 0; i < size(); ++i) {
if (i) std::cout << ", ";
std::cout << Get(i);
}
Expand Down
10 changes: 5 additions & 5 deletions src/tightdb/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class Array: public ArrayParent {
bool IsValid() const TIGHTDB_NOEXCEPT {return m_data != NULL;}
void Invalidate() const TIGHTDB_NOEXCEPT {m_data = NULL;}

virtual size_t Size() const TIGHTDB_NOEXCEPT {return m_len;}
virtual size_t size() const TIGHTDB_NOEXCEPT {return m_len;}
bool is_empty() const TIGHTDB_NOEXCEPT {return m_len == 0;}

void Insert(size_t ndx, int64_t value);
Expand Down Expand Up @@ -800,7 +800,7 @@ template<class S> size_t Array::Write(S& out, bool recurse, bool persist) const
newRefs.SetIsIndexNode(true);

// First write out all sub-arrays
const size_t count = Size();
const size_t count = size();
for (size_t i = 0; i < count; ++i) {
const size_t ref = GetAsRef(i);
if (ref == 0 || ref & 0x1) {
Expand Down Expand Up @@ -1544,7 +1544,7 @@ template <class cond, Action action, size_t bitwidth, class Callback> void Array
r_state.m_state = (int64_t)&r_arr;

if (action == act_FindAll) {
for (size_t t = 0; t < akku->Size(); t++)
for (size_t t = 0; t < akku->size(); t++)
r_arr.add(akku->Get(t));
}
else {
Expand Down Expand Up @@ -1572,8 +1572,8 @@ template <class cond2, Action action, size_t bitwidth, class Callback> int64_t A
// Reference implementation of find_optimized for bug testing
(void)callback;

if (end > Size())
end = Size();
if (end > size())
end = size();

for (size_t t = start; t < end; t++) {
int64_t v = Get(t);
Expand Down
2 changes: 1 addition & 1 deletion src/tightdb/array_basic_tpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void BasicArray<T>::Delete(size_t ndx)
template<typename T>
bool BasicArray<T>::Compare(const BasicArray<T>& c) const
{
for (size_t i = 0; i < Size(); ++i) {
for (size_t i = 0; i < size(); ++i) {
if (Get(i) != c.Get(i))
return false;
}
Expand Down
20 changes: 10 additions & 10 deletions src/tightdb/array_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ ArrayBinary::ArrayBinary(size_t ref, ArrayParent* parent, size_t pndx, Allocator
m_blob(Array::GetAsRef(1), NULL, 0, alloc)
{
TIGHTDB_ASSERT(HasRefs() && !IsNode()); // HasRefs indicates that this is a long string
TIGHTDB_ASSERT(Array::Size() == 2);
TIGHTDB_ASSERT(m_blob.Size() ==(size_t)(m_offsets.is_empty() ? 0 : m_offsets.back()));
TIGHTDB_ASSERT(Array::size() == 2);
TIGHTDB_ASSERT(m_blob.size() ==(size_t)(m_offsets.is_empty() ? 0 : m_offsets.back()));

m_offsets.SetParent(this, 0);
m_blob.SetParent(this, 1);
Expand All @@ -39,22 +39,22 @@ bool ArrayBinary::is_empty() const TIGHTDB_NOEXCEPT
return m_offsets.is_empty();
}

size_t ArrayBinary::Size() const TIGHTDB_NOEXCEPT
size_t ArrayBinary::size() const TIGHTDB_NOEXCEPT
{
return m_offsets.Size();
return m_offsets.size();
}

const char* ArrayBinary::Get(size_t ndx) const TIGHTDB_NOEXCEPT
{
TIGHTDB_ASSERT(ndx < m_offsets.Size());
TIGHTDB_ASSERT(ndx < m_offsets.size());

const size_t offset = ndx ? size_t(m_offsets.Get(ndx-1)) : 0;
return m_blob.Get(offset);
}

size_t ArrayBinary::GetLen(size_t ndx) const TIGHTDB_NOEXCEPT
{
TIGHTDB_ASSERT(ndx < m_offsets.Size());
TIGHTDB_ASSERT(ndx < m_offsets.size());

const size_t start = ndx ? size_t(m_offsets.Get(ndx-1)) : 0;
const size_t end = size_t(m_offsets.Get(ndx));
Expand All @@ -72,7 +72,7 @@ void ArrayBinary::add(const char* value, size_t len)

void ArrayBinary::Set(size_t ndx, const char* value, size_t len)
{
TIGHTDB_ASSERT(ndx < m_offsets.Size());
TIGHTDB_ASSERT(ndx < m_offsets.size());
TIGHTDB_ASSERT(len == 0 || value);

const size_t start = ndx ? (size_t)m_offsets.Get(ndx-1) : 0;
Expand All @@ -85,7 +85,7 @@ void ArrayBinary::Set(size_t ndx, const char* value, size_t len)

void ArrayBinary::Insert(size_t ndx, const char* value, size_t len)
{
TIGHTDB_ASSERT(ndx <= m_offsets.Size());
TIGHTDB_ASSERT(ndx <= m_offsets.size());
TIGHTDB_ASSERT(len == 0 || value);

const size_t pos = ndx ? (size_t)m_offsets.Get(ndx-1) : 0;
Expand All @@ -97,7 +97,7 @@ void ArrayBinary::Insert(size_t ndx, const char* value, size_t len)

void ArrayBinary::Delete(size_t ndx)
{
TIGHTDB_ASSERT(ndx < m_offsets.Size());
TIGHTDB_ASSERT(ndx < m_offsets.size());

const size_t start = ndx ? (size_t)m_offsets.Get(ndx-1) : 0;
const size_t end = (size_t)m_offsets.Get(ndx);
Expand All @@ -109,7 +109,7 @@ void ArrayBinary::Delete(size_t ndx)

void ArrayBinary::Resize(size_t ndx)
{
TIGHTDB_ASSERT(ndx < m_offsets.Size());
TIGHTDB_ASSERT(ndx < m_offsets.size());

const size_t len = ndx ? (size_t)m_offsets.Get(ndx-1) : 0;

Expand Down
2 changes: 1 addition & 1 deletion src/tightdb/array_binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ArrayBinary : public Array {
//ArrayBinary(Allocator& alloc);

bool is_empty() const TIGHTDB_NOEXCEPT;
size_t Size() const TIGHTDB_NOEXCEPT TIGHTDB_OVERRIDE;
size_t size() const TIGHTDB_NOEXCEPT TIGHTDB_OVERRIDE;

const char* Get(size_t ndx) const TIGHTDB_NOEXCEPT;
size_t GetLen(size_t ndx) const TIGHTDB_NOEXCEPT;
Expand Down
2 changes: 1 addition & 1 deletion src/tightdb/array_blob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void ArrayBlob::ToDot(std::ostream& out, const char* title) const

// Values
out << "<TD>";
out << Size() << " bytes"; //TODO: write content
out << size() << " bytes"; //TODO: write content
out << "</TD>" << std::endl;

out << "</TR></TABLE>>];" << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions src/tightdb/array_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ size_t ArrayString::FindWithLen(const char* value, size_t len, size_t start, siz

bool ArrayString::Compare(const ArrayString& c) const
{
if (c.Size() != Size()) return false;
if (c.size() != size()) return false;

for (size_t i = 0; i < Size(); ++i) {
for (size_t i = 0; i < size(); ++i) {
if (strcmp(Get(i), c.Get(i)) != 0) return false;
}

Expand Down
16 changes: 8 additions & 8 deletions src/tightdb/array_string_long.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ ArrayStringLong::ArrayStringLong(size_t ref, ArrayParent* parent, size_t pndx, A
m_blob(Array::GetAsRef(1), NULL, 0, alloc)
{
TIGHTDB_ASSERT(HasRefs() && !IsNode()); // HasRefs indicates that this is a long string
TIGHTDB_ASSERT(Array::Size() == 2);
TIGHTDB_ASSERT(m_blob.Size() == (m_offsets.is_empty() ? 0 : (size_t)m_offsets.back()));
TIGHTDB_ASSERT(Array::size() == 2);
TIGHTDB_ASSERT(m_blob.size() == (m_offsets.is_empty() ? 0 : (size_t)m_offsets.back()));

m_offsets.SetParent(this, 0);
m_blob.SetParent(this, 1);
Expand All @@ -36,7 +36,7 @@ ArrayStringLong::ArrayStringLong(size_t ref, ArrayParent* parent, size_t pndx, A

const char* ArrayStringLong::Get(size_t ndx) const TIGHTDB_NOEXCEPT
{
TIGHTDB_ASSERT(ndx < m_offsets.Size());
TIGHTDB_ASSERT(ndx < m_offsets.size());

const size_t offset = ndx ? size_t(m_offsets.Get(ndx-1)) : 0;
return m_blob.Get(offset);
Expand All @@ -63,7 +63,7 @@ void ArrayStringLong::Set(size_t ndx, const char* value)

void ArrayStringLong::Set(size_t ndx, const char* value, size_t len)
{
TIGHTDB_ASSERT(ndx < m_offsets.Size());
TIGHTDB_ASSERT(ndx < m_offsets.size());
TIGHTDB_ASSERT(value);

const size_t start = ndx ? (size_t)m_offsets.Get(ndx-1) : 0;
Expand All @@ -83,7 +83,7 @@ void ArrayStringLong::Insert(size_t ndx, const char* value)

void ArrayStringLong::Insert(size_t ndx, const char* value, size_t len)
{
TIGHTDB_ASSERT(ndx <= m_offsets.Size());
TIGHTDB_ASSERT(ndx <= m_offsets.size());
TIGHTDB_ASSERT(value);

const size_t pos = ndx ? (size_t)m_offsets.Get(ndx-1) : 0;
Expand All @@ -96,7 +96,7 @@ void ArrayStringLong::Insert(size_t ndx, const char* value, size_t len)

void ArrayStringLong::Delete(size_t ndx)
{
TIGHTDB_ASSERT(ndx < m_offsets.Size());
TIGHTDB_ASSERT(ndx < m_offsets.size());

const size_t start = ndx ? (size_t)m_offsets.Get(ndx-1) : 0;
const size_t end = (size_t)m_offsets.Get(ndx);
Expand All @@ -108,7 +108,7 @@ void ArrayStringLong::Delete(size_t ndx)

void ArrayStringLong::Resize(size_t ndx)
{
TIGHTDB_ASSERT(ndx < m_offsets.Size());
TIGHTDB_ASSERT(ndx < m_offsets.size());

const size_t len = ndx ? (size_t)m_offsets.Get(ndx-1) : 0;

Expand Down Expand Up @@ -165,7 +165,7 @@ size_t ArrayStringLong::FindWithLen(const char* value, size_t len, size_t start,
TIGHTDB_ASSERT(value);

len += 1; // include trailing null byte
const size_t count = m_offsets.Size();
const size_t count = m_offsets.size();
size_t offset = (start == 0 ? 0 : (size_t)m_offsets.Get(start - 1)); // todo, verify
for (size_t i = start; i < count && i < end; ++i) {
const size_t end = (size_t)m_offsets.Get(i);
Expand Down
6 changes: 3 additions & 3 deletions src/tightdb/array_string_long.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ArrayStringLong : public Array {
//ArrayStringLong(Allocator& alloc);

bool is_empty() const TIGHTDB_NOEXCEPT;
size_t Size() const TIGHTDB_NOEXCEPT TIGHTDB_OVERRIDE;
size_t size() const TIGHTDB_NOEXCEPT TIGHTDB_OVERRIDE;

const char* Get(size_t ndx) const TIGHTDB_NOEXCEPT;
void add(const char* value);
Expand Down Expand Up @@ -73,9 +73,9 @@ inline bool ArrayStringLong::is_empty() const TIGHTDB_NOEXCEPT
return m_offsets.is_empty();
}

inline std::size_t ArrayStringLong::Size() const TIGHTDB_NOEXCEPT
inline std::size_t ArrayStringLong::size() const TIGHTDB_NOEXCEPT
{
return m_offsets.Size();
return m_offsets.size();
}

} // namespace tightdb
Expand Down
Loading