Making DALi public API typesafe using guaranteed types; uint8_t, uint32_t
[platform/core/uifw/dali-core.git] / dali / public-api / object / property-array.cpp
index 2522113..7fe8447 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -51,53 +51,42 @@ Property::Array::~Array()
   delete mImpl;
 }
 
-
-unsigned int Property::Array::Size() const
+Property::Array::SizeType Property::Array::Count() const
 {
   return mImpl->mArray.size();
 }
 
-unsigned int Property::Array::Count() const
-{
-  return Size();
-}
-
-void Property::Array::PushBack(const Value& value)
+void Property::Array::PushBack( const Value& value )
 {
   mImpl->mArray.push_back( value );
 }
 
-bool Property::Array::Empty() const
-{
-  return mImpl->mArray.empty();
-}
-
 void Property::Array::Clear()
 {
   mImpl->mArray.clear();
 }
 
-void Property::Array::Reserve(size_t size)
+void Property::Array::Reserve( SizeType size )
 {
   mImpl->mArray.reserve(size);
 }
 
-void Property::Array::Resize(size_t size)
+void Property::Array::Resize( SizeType size )
 {
   mImpl->mArray.resize(size);
 }
 
-size_t Property::Array::Capacity()
+Property::Array::SizeType Property::Array::Capacity()
 {
   return mImpl->mArray.capacity();
 }
 
-const Property::Value& Property::Array::operator[]( const std::size_t index ) const
+const Property::Value& Property::Array::operator[]( SizeType index ) const
 {
   return mImpl->mArray[ index ];
 }
 
-Property::Value& Property::Array::operator[]( const std::size_t index )
+Property::Value& Property::Array::operator[]( SizeType index )
 {
   return mImpl->mArray[ index ];
 }
@@ -113,4 +102,21 @@ Property::Array& Property::Array::operator=( const Property::Array& other )
   return *this;
 }
 
+std::ostream& operator<<( std::ostream& stream, const Property::Array& array )
+{
+  stream << "Array(" << array.Count() << ") = [";
+  for( Property::Array::SizeType i=0; i<array.Count(); ++i )
+  {
+    if( i>0 )
+    {
+      stream << ", ";
+    }
+    stream << array.GetElementAt(i);
+  }
+  stream << "]";
+
+  return stream;
+}
+
+
 } // namespace Dali