[smuxi] Engine: provide enumerator based MessageBufferBase.CopyTo() as default implementation
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi] Engine: provide enumerator based MessageBufferBase.CopyTo() as default implementation
- Date: Fri, 28 Feb 2014 20:26:06 +0000 (UTC)
commit ddc12c6a553d704fe068790749c09f220816e918
Author: Mirco Bauer <meebey meebey net>
Date: Wed Feb 26 23:06:04 2014 +0100
Engine: provide enumerator based MessageBufferBase.CopyTo() as default implementation
src/Engine/MessageBuffers/Db4oMessageBuffer.cs | 12 ------------
src/Engine/MessageBuffers/MessageBufferBase.cs | 13 ++++++++++++-
src/Engine/MessageBuffers/SqliteMessageBuffer.cs | 5 -----
3 files changed, 12 insertions(+), 18 deletions(-)
---
diff --git a/src/Engine/MessageBuffers/Db4oMessageBuffer.cs b/src/Engine/MessageBuffers/Db4oMessageBuffer.cs
index b94b22a..d154275 100644
--- a/src/Engine/MessageBuffers/Db4oMessageBuffer.cs
+++ b/src/Engine/MessageBuffers/Db4oMessageBuffer.cs
@@ -161,18 +161,6 @@ namespace Smuxi.Engine
return IndexOf(item) != -1;
}
- public override void CopyTo(MessageModel[] array, int arrayIndex)
- {
- if (array == null) {
- throw new ArgumentNullException("array");
- }
-
- int i = arrayIndex;
- foreach (var msg in this) {
- array[i++] = msg;
- }
- }
-
public override IEnumerator<MessageModel> GetEnumerator()
{
foreach (var dbId in Index) {
diff --git a/src/Engine/MessageBuffers/MessageBufferBase.cs b/src/Engine/MessageBuffers/MessageBufferBase.cs
index 1667f88..59537ef 100644
--- a/src/Engine/MessageBuffers/MessageBufferBase.cs
+++ b/src/Engine/MessageBuffers/MessageBufferBase.cs
@@ -83,6 +83,18 @@ namespace Smuxi.Engine
return range;
}
+ public virtual void CopyTo(MessageModel[] array, int arrayIndex)
+ {
+ if (array == null) {
+ throw new ArgumentNullException("array");
+ }
+
+ int i = arrayIndex;
+ foreach (var msg in this) {
+ array[i++] = msg;
+ }
+ }
+
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
@@ -111,7 +123,6 @@ namespace Smuxi.Engine
public abstract void Add(MessageModel item);
public abstract void Clear();
public abstract bool Contains(MessageModel item);
- public abstract void CopyTo(MessageModel[] array, int arrayIndex);
public abstract bool Remove(MessageModel item);
public abstract IEnumerator<MessageModel> GetEnumerator();
public abstract int IndexOf(MessageModel item);
diff --git a/src/Engine/MessageBuffers/SqliteMessageBuffer.cs
b/src/Engine/MessageBuffers/SqliteMessageBuffer.cs
index 78975bd..97f574d 100644
--- a/src/Engine/MessageBuffers/SqliteMessageBuffer.cs
+++ b/src/Engine/MessageBuffers/SqliteMessageBuffer.cs
@@ -138,11 +138,6 @@ namespace Smuxi.Engine
throw new NotImplementedException ();
}
- public override void CopyTo(MessageModel[] array, int arrayIndex)
- {
- throw new NotImplementedException ();
- }
-
public override bool Remove(MessageModel item)
{
throw new NotImplementedException ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]