Skip to content

Commit

Permalink
Removed most throw declarations (deprecated by C++0x and dangerous)
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloambrosio committed Mar 10, 2013
1 parent e681c50 commit a690f14
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
18 changes: 16 additions & 2 deletions include/cucumber-cpp/internal/Table.hpp
Expand Up @@ -18,8 +18,22 @@ class Table {
typedef basic_type row_type; typedef basic_type row_type;
typedef std::vector<hash_row_type> hashes_type; typedef std::vector<hash_row_type> hashes_type;


void addColumn(const std::string column) throw (std::runtime_error); /**
void addRow(const row_type &row) throw (std::range_error, std::runtime_error); * @brief addColumn
* @param column
*
* @throws std::runtime_error
*/
void addColumn(const std::string column);

/**
* @brief addRow
* @param row
*
* @throws std::range_error
* @throws std::runtime_error
*/
void addRow(const row_type &row);
const hashes_type & hashes() const; const hashes_type & hashes() const;


private: private:
Expand Down
Expand Up @@ -130,8 +130,10 @@ class WireMessageCodec {
* @param One single message to decode * @param One single message to decode
* *
* @return The decoded command (ownership passed to the caller) * @return The decoded command (ownership passed to the caller)
*
* @throws WireMessageCodecException
*/ */
virtual WireCommand *decode(const std::string &request) const throw(WireMessageCodecException) = 0; virtual WireCommand *decode(const std::string &request) const = 0;


/** /**
* Encodes a response to wire format. * Encodes a response to wire format.
Expand All @@ -151,7 +153,7 @@ class WireMessageCodec {
class JsonSpiritWireMessageCodec : public WireMessageCodec { class JsonSpiritWireMessageCodec : public WireMessageCodec {
public: public:
JsonSpiritWireMessageCodec(); JsonSpiritWireMessageCodec();
WireCommand *decode(const std::string &request) const throw(WireMessageCodecException); WireCommand *decode(const std::string &request) const;
const std::string encode(const WireResponse *response) const; const std::string encode(const WireResponse *response) const;
}; };


Expand Down
4 changes: 2 additions & 2 deletions src/Table.cpp
Expand Up @@ -3,15 +3,15 @@
namespace cucumber { namespace cucumber {
namespace internal { namespace internal {


void Table::addColumn(const std::string column) throw (std::runtime_error) { void Table::addColumn(const std::string column) {
if (rows.empty()) { if (rows.empty()) {
columns.push_back(column); columns.push_back(column);
} else { } else {
throw std::runtime_error("Cannot alter columns after rows have been added"); throw std::runtime_error("Cannot alter columns after rows have been added");
} }
} }


void Table::addRow(const row_type &row) throw (std::range_error, std::runtime_error) { void Table::addRow(const row_type &row) {
const basic_type::size_type colSize = columns.size(); const basic_type::size_type colSize = columns.size();
if (colSize == 0) { if (colSize == 0) {
throw std::runtime_error("No column defined yet"); throw std::runtime_error("No column defined yet");
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/wire/WireProtocol.cpp
Expand Up @@ -204,7 +204,7 @@ static std::map<std::string, boost::shared_ptr<CommandDecoder> > commandDecoders


JsonSpiritWireMessageCodec::JsonSpiritWireMessageCodec() {}; JsonSpiritWireMessageCodec::JsonSpiritWireMessageCodec() {};


WireCommand *JsonSpiritWireMessageCodec::decode(const std::string &request) const throw(WireMessageCodecException) { WireCommand *JsonSpiritWireMessageCodec::decode(const std::string &request) const {
std::istringstream is(request); std::istringstream is(request);
mValue json; mValue json;
try { try {
Expand Down

0 comments on commit a690f14

Please sign in to comment.