using System;
using System.Collections;
using System.Collections.Generic;
namespace TwlBackupBlock
{
///
/// データ本体を表す抽象クラスです。
///
public abstract class AbstractBody : IEnumerable, ICloneable
{
///
/// 指定したインデックスにアクセスします。
///
/// アクセスするインデックス。
/// 指定したインデックスのバイトデータ。
public abstract byte this[int index]
{
get;
set;
}
///
/// データ本体のバイトサイズを取得します。
///
public abstract int Length
{
get;
}
///
/// イテレータブロック。
///
/// 列挙子。
public IEnumerator GetEnumerator()
{
for (int i = 0; i < Length; i++)
{
yield return this[i];
}
}
///
/// イテレータブロック。
///
/// 列挙子。
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
///
/// データ本体を表すバイト配列を取得します。
///
/// データ本体を表すバイト配列
public abstract byte[] GetBytes();
///
/// バイト配列からデータ本体を構成します。
///
/// データ本体を表すバイト配列
public abstract void SetBytes(byte[] bytes);
///
/// AbstractBodyのディープコピーを作成します。
///
/// AbstractBodyのコピー
public abstract object Clone();
}
}