From cbf9c1dd0e857e406e833153f371219b1b65eaae Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Tue, 16 Feb 2016 17:22:10 +0100 Subject: [PATCH] Add GFitsTableStringCol.__setitem__ method for GFilename argument. --- pyext/GFitsTableStringCol.i | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/pyext/GFitsTableStringCol.i b/pyext/GFitsTableStringCol.i index d05b8d4..38713d4 100644 --- a/pyext/GFitsTableStringCol.i +++ b/pyext/GFitsTableStringCol.i @@ -1,7 +1,7 @@ /*************************************************************************** * GFitsTableStringCol.i - FITS table string column class * * ----------------------------------------------------------------------- * - * copyright (C) 2008-2015 by Juergen Knoedlseder * + * copyright (C) 2008-2016 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -26,6 +26,7 @@ %{ /* Put headers and other declarations here that are needed for compilation */ #include "GFitsTableStringCol.hpp" +#include "GFilename.hpp" %} @@ -110,6 +111,26 @@ public: } } } + void __setitem__(int GFitsTableColInx[], GFilename value) { + if (GFitsTableColInx[1] < 0 || GFitsTableColInx[1] >= self->length()) { + throw GException::out_of_range("__setitem__()", "Row index", + GFitsTableColInx[1], self->length()); + } + if (GFitsTableColInx[0] == 1) { + (*self)(GFitsTableColInx[1]) = std::string(value); + } + else { + if (GFitsTableColInx[2] >= 0 && GFitsTableColInx[2] < + self->elements(GFitsTableColInx[1])) { + (*self)(GFitsTableColInx[1], GFitsTableColInx[2]) = std::string(value); + } + else { + throw GException::out_of_range("__setitem__()", "Column index", + GFitsTableColInx[2], + self->elements(GFitsTableColInx[1])); + } + } + } GFitsTableStringCol copy() { return (*self); } -- libgit2 0.21.4