compiler: Move t_type::generate_fingerprint to a .cc file
Forcing all of the functions under src/parse to be defined in header
files is silly and sometimes painful. Createa a "parse.cc" file for
functions that don't belong in header files. To start, move
generate_fingerprint there, because it requires including md5.h.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1004702 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am
index 24687dc..6902ba4 100644
--- a/compiler/cpp/Makefile.am
+++ b/compiler/cpp/Makefile.am
@@ -56,6 +56,7 @@
src/parse/t_scope.h \
src/parse/t_const.h \
src/parse/t_const_value.h \
+ src/parse/parse.cc \
src/generate/t_generator.h \
src/generate/t_oop_generator.h
diff --git a/compiler/cpp/src/parse/parse.cc b/compiler/cpp/src/parse/parse.cc
new file mode 100644
index 0000000..2570c37
--- /dev/null
+++ b/compiler/cpp/src/parse/parse.cc
@@ -0,0 +1,11 @@
+#include "t_type.h"
+
+#include "md5.h"
+
+void t_type::generate_fingerprint() {
+ std::string material = get_fingerprint_material();
+ md5_state_t ctx;
+ md5_init(&ctx);
+ md5_append(&ctx, (md5_byte_t*)(material.data()), (int)material.size());
+ md5_finish(&ctx, (md5_byte_t*)fingerprint_);
+}
diff --git a/compiler/cpp/src/parse/t_type.h b/compiler/cpp/src/parse/t_type.h
index 4ce2eda..0941a26 100644
--- a/compiler/cpp/src/parse/t_type.h
+++ b/compiler/cpp/src/parse/t_type.h
@@ -26,9 +26,6 @@
#include <stdint.h>
#include "t_doc.h"
-// What's worse? This, or making a src/parse/non_inlined.cc?
-#include "md5.h"
-
class t_program;
/**
@@ -82,13 +79,7 @@
static const int fingerprint_len = 16;
// Call this before trying get_*_fingerprint().
- virtual void generate_fingerprint() {
- std::string material = get_fingerprint_material();
- md5_state_t ctx;
- md5_init(&ctx);
- md5_append(&ctx, (md5_byte_t*)(material.data()), (int)material.size());
- md5_finish(&ctx, (md5_byte_t*)fingerprint_);
- }
+ virtual void generate_fingerprint();
bool has_fingerprint() const {
for (int i = 0; i < fingerprint_len; i++) {