X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fio%2FHTTPRequest.cxx;h=b9466ebf36d11a3938365f9f035e7830a36add6c;hb=70c5d605641b628039f75cb8761ce783a17a5bdf;hp=900b7fc29f9178ea9d2a572752e8af0b2bbe9bc5;hpb=e302ad092eb52efce99f74327ede5fa00e03a3ef;p=simgear.git diff --git a/simgear/io/HTTPRequest.cxx b/simgear/io/HTTPRequest.cxx index 900b7fc2..b9466ebf 100644 --- a/simgear/io/HTTPRequest.cxx +++ b/simgear/io/HTTPRequest.cxx @@ -1,3 +1,20 @@ +// Copyright (C) 2011 James Turner +// Copyright (C) 2013 Thomas Geymayer +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + #include "HTTPRequest.hxx" #include @@ -39,7 +56,7 @@ Request* Request::done(const Callback& cb) if( _ready_state == DONE ) cb(this); else - _cb_done = cb; + _cb_done.push_back(cb); return this; } @@ -50,7 +67,7 @@ Request* Request::fail(const Callback& cb) if( _ready_state == FAILED ) cb(this); else - _cb_fail = cb; + _cb_fail.push_back(cb); return this; } @@ -61,7 +78,7 @@ Request* Request::always(const Callback& cb) if( isComplete() ) cb(this); else - _cb_always = cb; + _cb_always.push_back(cb); return this; } @@ -321,22 +338,19 @@ void Request::setReadyState(ReadyState state) onDone(); onAlways(); - if( _cb_done ) - _cb_done(this); + _cb_done(this); } else if( state == FAILED ) { onFail(); onAlways(); - if( _cb_fail ) - _cb_fail(this); + _cb_fail(this); } else return; - if( _cb_always ) - _cb_always(this); + _cb_always(this); } //------------------------------------------------------------------------------