From 58d90ea75b818929cbcd2fa08a65168b06189fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 11 Jul 2015 11:01:51 +0200 Subject: [PATCH] Documentation WIP --- GRDB/Row.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/GRDB/Row.swift b/GRDB/Row.swift index a782c777d..9a084345c 100644 --- a/GRDB/Row.swift +++ b/GRDB/Row.swift @@ -411,13 +411,22 @@ protocol RowImpl { } -/// Used to access the (columnName, databaseValue) pairs in a Row. +/// Indexes to (columnName, databaseValue) pairs in a database row. public struct RowIndex: ForwardIndexType, BidirectionalIndexType, RandomAccessIndexType { let index: Int init(_ index: Int) { self.index = index } + + /// The index of the next (ColumnName, DatabaseValue) pair in a row. public func successor() -> RowIndex { return RowIndex(index + 1) } + + /// The index of the previous (ColumnName, DatabaseValue) pair in a row. public func predecessor() -> RowIndex { return RowIndex(index - 1) } + + /// The number of columns between two (ColumnName, DatabaseValue) pairs in + /// a row. public func distanceTo(other: RowIndex) -> Int { return other.index - index } + + /// Return `self` offset by `n` steps. public func advancedBy(n: Int) -> RowIndex { return RowIndex(index + n) } }