You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dr...@apache.org on 2010/08/31 18:51:26 UTC
svn commit: r991252 - in /incubator/thrift/trunk/compiler/cpp/src/parse:
t_field.h t_scope.h
Author: dreiss
Date: Tue Aug 31 16:51:26 2010
New Revision: 991252
URL: http://svn.apache.org/viewvc?rev=991252&view=rev
Log:
THRIFT-507. Stop using boost::lexical_cast in the compiler
We were using boost::lexical_cast to convert an integer to a string,
but using a stringstream is only slightly more complicated.
Modified:
incubator/thrift/trunk/compiler/cpp/src/parse/t_field.h
incubator/thrift/trunk/compiler/cpp/src/parse/t_scope.h
Modified: incubator/thrift/trunk/compiler/cpp/src/parse/t_field.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/parse/t_field.h?rev=991252&r1=991251&r2=991252&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/parse/t_field.h (original)
+++ incubator/thrift/trunk/compiler/cpp/src/parse/t_field.h Tue Aug 31 16:51:26 2010
@@ -21,7 +21,7 @@
#define T_FIELD_H
#include <string>
-#include <boost/lexical_cast.hpp>
+#include <sstream>
#include "t_doc.h"
@@ -117,7 +117,9 @@ class t_field : public t_doc {
// This is not the same function as t_type::get_fingerprint_material,
// but it does the same thing.
std::string get_fingerprint_material() const {
- return boost::lexical_cast<std::string>(key_) + ":" +
+ std::ostringstream keystm;
+ keystm << key_;
+ return keystm.str() + ":" +
((req_ == T_OPTIONAL) ? "opt-" : "") +
type_->get_fingerprint_material();
}
Modified: incubator/thrift/trunk/compiler/cpp/src/parse/t_scope.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/parse/t_scope.h?rev=991252&r1=991251&r2=991252&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/parse/t_scope.h (original)
+++ incubator/thrift/trunk/compiler/cpp/src/parse/t_scope.h Tue Aug 31 16:51:26 2010
@@ -22,8 +22,8 @@
#include <map>
#include <string>
+#include <sstream>
-#include <boost/lexical_cast.hpp>
#include "t_type.h"
#include "t_service.h"
#include "t_const.h"
@@ -157,7 +157,9 @@ class t_scope {
t_enum* tenum = (t_enum*)ttype;
t_enum_value* enum_value = tenum->get_constant_by_value(const_val->get_integer());
if (enum_value == NULL) {
- throw "Couldn't find a named value in enum " + tenum->get_name() + " for value " + boost::lexical_cast<std::string>(const_val->get_integer());
+ std::ostringstream valstm;
+ valstm << const_val->get_integer();
+ throw "Couldn't find a named value in enum " + tenum->get_name() + " for value " + valstm.str();
}
const_val->set_identifier(enum_value->get_name());
const_val->set_enum(tenum);