summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore24
-rw-r--r--compiler/cpp/CMakeLists.txt121
-rw-r--r--compiler/cpp/Makefile.am210
-rw-r--r--compiler/cpp/src/Makefile.am96
-rw-r--r--compiler/cpp/src/thrift/audit/t_audit.cpp (renamed from compiler/cpp/src/audit/t_audit.cpp)26
-rw-r--r--compiler/cpp/src/thrift/audit/t_audit.h (renamed from compiler/cpp/src/audit/t_audit.h)0
-rw-r--r--compiler/cpp/src/thrift/common.cc (renamed from compiler/cpp/src/common.cc)4
-rw-r--r--compiler/cpp/src/thrift/common.h (renamed from compiler/cpp/src/common.h)2
-rw-r--r--compiler/cpp/src/thrift/generate/t_as3_generator.cc (renamed from compiler/cpp/src/generate/t_as3_generator.cc)6
-rw-r--r--compiler/cpp/src/thrift/generate/t_c_glib_generator.cc (renamed from compiler/cpp/src/generate/t_c_glib_generator.cc)6
-rw-r--r--compiler/cpp/src/thrift/generate/t_cocoa_generator.cc (renamed from compiler/cpp/src/generate/t_cocoa_generator.cc)176
-rw-r--r--compiler/cpp/src/thrift/generate/t_cpp_generator.cc (renamed from compiler/cpp/src/generate/t_cpp_generator.cc)66
-rw-r--r--compiler/cpp/src/thrift/generate/t_csharp_generator.cc (renamed from compiler/cpp/src/generate/t_csharp_generator.cc)16
-rw-r--r--compiler/cpp/src/thrift/generate/t_d_generator.cc (renamed from compiler/cpp/src/generate/t_d_generator.cc)6
-rw-r--r--compiler/cpp/src/thrift/generate/t_dart_generator.cc (renamed from compiler/cpp/src/generate/t_dart_generator.cc)4
-rw-r--r--compiler/cpp/src/thrift/generate/t_delphi_generator.cc (renamed from compiler/cpp/src/generate/t_delphi_generator.cc)12
-rw-r--r--compiler/cpp/src/thrift/generate/t_erl_generator.cc (renamed from compiler/cpp/src/generate/t_erl_generator.cc)6
-rw-r--r--compiler/cpp/src/thrift/generate/t_generator.cc (renamed from compiler/cpp/src/generate/t_generator.cc)2
-rw-r--r--compiler/cpp/src/thrift/generate/t_generator.h (renamed from compiler/cpp/src/generate/t_generator.h)8
-rw-r--r--compiler/cpp/src/thrift/generate/t_generator_registry.h (renamed from compiler/cpp/src/generate/t_generator_registry.h)0
-rw-r--r--compiler/cpp/src/thrift/generate/t_go_generator.cc (renamed from compiler/cpp/src/generate/t_go_generator.cc)12
-rw-r--r--compiler/cpp/src/thrift/generate/t_gv_generator.cc (renamed from compiler/cpp/src/generate/t_gv_generator.cc)6
-rw-r--r--compiler/cpp/src/thrift/generate/t_haxe_generator.cc (renamed from compiler/cpp/src/generate/t_haxe_generator.cc)20
-rw-r--r--compiler/cpp/src/thrift/generate/t_hs_generator.cc (renamed from compiler/cpp/src/generate/t_hs_generator.cc)8
-rw-r--r--compiler/cpp/src/thrift/generate/t_html_generator.cc (renamed from compiler/cpp/src/generate/t_html_generator.cc)8
-rw-r--r--compiler/cpp/src/thrift/generate/t_html_generator.h (renamed from compiler/cpp/src/generate/t_html_generator.h)0
-rw-r--r--compiler/cpp/src/thrift/generate/t_java_generator.cc (renamed from compiler/cpp/src/generate/t_java_generator.cc)10
-rw-r--r--compiler/cpp/src/thrift/generate/t_javame_generator.cc (renamed from compiler/cpp/src/generate/t_javame_generator.cc)6
-rw-r--r--compiler/cpp/src/thrift/generate/t_js_generator.cc (renamed from compiler/cpp/src/generate/t_js_generator.cc)8
-rw-r--r--compiler/cpp/src/thrift/generate/t_json_generator.cc (renamed from compiler/cpp/src/generate/t_json_generator.cc)6
-rw-r--r--compiler/cpp/src/thrift/generate/t_lua_generator.cc (renamed from compiler/cpp/src/generate/t_lua_generator.cc)6
-rw-r--r--compiler/cpp/src/thrift/generate/t_ocaml_generator.cc (renamed from compiler/cpp/src/generate/t_ocaml_generator.cc)8
-rw-r--r--compiler/cpp/src/thrift/generate/t_oop_generator.h (renamed from compiler/cpp/src/generate/t_oop_generator.h)4
-rw-r--r--compiler/cpp/src/thrift/generate/t_perl_generator.cc (renamed from compiler/cpp/src/generate/t_perl_generator.cc)8
-rw-r--r--compiler/cpp/src/thrift/generate/t_php_generator.cc (renamed from compiler/cpp/src/generate/t_php_generator.cc)4
-rw-r--r--compiler/cpp/src/thrift/generate/t_py_generator.cc (renamed from compiler/cpp/src/generate/t_py_generator.cc)8
-rw-r--r--compiler/cpp/src/thrift/generate/t_rb_generator.cc (renamed from compiler/cpp/src/generate/t_rb_generator.cc)8
-rw-r--r--compiler/cpp/src/thrift/generate/t_st_generator.cc (renamed from compiler/cpp/src/generate/t_st_generator.cc)8
-rw-r--r--compiler/cpp/src/thrift/generate/t_swift_generator.cc (renamed from compiler/cpp/src/generate/t_swift_generator.cc)634
-rw-r--r--compiler/cpp/src/thrift/generate/t_xml_generator.cc (renamed from compiler/cpp/src/generate/t_xml_generator.cc)44
-rw-r--r--compiler/cpp/src/thrift/generate/t_xsd_generator.cc (renamed from compiler/cpp/src/generate/t_xsd_generator.cc)8
-rw-r--r--compiler/cpp/src/thrift/globals.h (renamed from compiler/cpp/src/globals.h)0
-rw-r--r--compiler/cpp/src/thrift/logging.cc (renamed from compiler/cpp/src/logging.cc)4
-rw-r--r--compiler/cpp/src/thrift/logging.h (renamed from compiler/cpp/src/logging.h)0
-rw-r--r--compiler/cpp/src/thrift/main.cc (renamed from compiler/cpp/src/main.cc)22
-rw-r--r--compiler/cpp/src/thrift/main.h (renamed from compiler/cpp/src/main.h)6
-rw-r--r--compiler/cpp/src/thrift/parse/parse.cc (renamed from compiler/cpp/src/parse/parse.cc)6
-rw-r--r--compiler/cpp/src/thrift/parse/t_base_type.h (renamed from compiler/cpp/src/parse/t_base_type.h)2
-rw-r--r--compiler/cpp/src/thrift/parse/t_const.h (renamed from compiler/cpp/src/parse/t_const.h)4
-rw-r--r--compiler/cpp/src/thrift/parse/t_const_value.h (renamed from compiler/cpp/src/parse/t_const_value.h)2
-rw-r--r--compiler/cpp/src/thrift/parse/t_container.h (renamed from compiler/cpp/src/parse/t_container.h)2
-rw-r--r--compiler/cpp/src/thrift/parse/t_doc.h (renamed from compiler/cpp/src/parse/t_doc.h)4
-rw-r--r--compiler/cpp/src/thrift/parse/t_enum.h (renamed from compiler/cpp/src/parse/t_enum.h)4
-rw-r--r--compiler/cpp/src/thrift/parse/t_enum_value.h (renamed from compiler/cpp/src/parse/t_enum_value.h)2
-rw-r--r--compiler/cpp/src/thrift/parse/t_field.h (renamed from compiler/cpp/src/parse/t_field.h)4
-rw-r--r--compiler/cpp/src/thrift/parse/t_function.h (renamed from compiler/cpp/src/parse/t_function.h)6
-rw-r--r--compiler/cpp/src/thrift/parse/t_list.h (renamed from compiler/cpp/src/parse/t_list.h)2
-rw-r--r--compiler/cpp/src/thrift/parse/t_map.h (renamed from compiler/cpp/src/parse/t_map.h)2
-rw-r--r--compiler/cpp/src/thrift/parse/t_program.h (renamed from compiler/cpp/src/parse/t_program.h)30
-rw-r--r--compiler/cpp/src/thrift/parse/t_scope.h (renamed from compiler/cpp/src/parse/t_scope.h)14
-rw-r--r--compiler/cpp/src/thrift/parse/t_service.h (renamed from compiler/cpp/src/parse/t_service.h)2
-rw-r--r--compiler/cpp/src/thrift/parse/t_set.h (renamed from compiler/cpp/src/parse/t_set.h)2
-rw-r--r--compiler/cpp/src/thrift/parse/t_struct.h (renamed from compiler/cpp/src/parse/t_struct.h)4
-rw-r--r--compiler/cpp/src/thrift/parse/t_type.h (renamed from compiler/cpp/src/parse/t_type.h)2
-rw-r--r--compiler/cpp/src/thrift/parse/t_typedef.cc (renamed from compiler/cpp/src/parse/t_typedef.cc)4
-rw-r--r--compiler/cpp/src/thrift/parse/t_typedef.h (renamed from compiler/cpp/src/parse/t_typedef.h)2
-rw-r--r--compiler/cpp/src/thrift/platform.h (renamed from compiler/cpp/src/platform.h)2
-rw-r--r--compiler/cpp/src/thrift/plugin/Makefile.am (renamed from compiler/cpp/src/plugin/Makefile.am)4
-rw-r--r--compiler/cpp/src/thrift/plugin/plugin.cc (renamed from compiler/cpp/src/plugin/plugin.cc)8
-rw-r--r--compiler/cpp/src/thrift/plugin/plugin.h (renamed from compiler/cpp/src/plugin/plugin.h)0
-rw-r--r--compiler/cpp/src/thrift/plugin/plugin.thrift (renamed from compiler/cpp/src/plugin/plugin.thrift)0
-rw-r--r--compiler/cpp/src/thrift/plugin/plugin_output.cc (renamed from compiler/cpp/src/plugin/plugin_output.cc)10
-rw-r--r--compiler/cpp/src/thrift/plugin/plugin_output.h (renamed from compiler/cpp/src/plugin/plugin_output.h)0
-rw-r--r--compiler/cpp/src/thrift/plugin/type_util.h (renamed from compiler/cpp/src/plugin/type_util.h)0
-rw-r--r--compiler/cpp/src/thrift/thriftl.ll (renamed from compiler/cpp/src/thriftl.ll)16
-rw-r--r--compiler/cpp/src/thrift/thrifty.yy (renamed from compiler/cpp/src/thrifty.yy)12
-rw-r--r--compiler/cpp/src/thrift/version.h.in (renamed from compiler/cpp/src/version.h.in)0
-rw-r--r--compiler/cpp/src/thrift/windows/config.h (renamed from compiler/cpp/src/windows/config.h)0
-rw-r--r--compiler/cpp/src/thrift/windows/version.h.in (renamed from compiler/cpp/src/windows/version.h.in)0
-rw-r--r--compiler/cpp/test/CMakeLists.txt2
-rw-r--r--compiler/cpp/test/plugin/conversion_test.cc6
-rw-r--r--compiler/cpp/test/plugin/cpp_plugin.cc4
-rwxr-xr-xconfigure.ac8
83 files changed, 960 insertions, 859 deletions
diff --git a/.gitignore b/.gitignore
index 94e851967..9a0e27513 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,28 +48,28 @@ erl_crash.dump
/autoscan.log
/autoscan-*.log
/compiler/cpp/test/plugin/t_cpp_generator.cc
-/compiler/cpp/src/plugin/plugin_constants.cpp
-/compiler/cpp/src/plugin/plugin_constants.h
-/compiler/cpp/src/plugin/plugin_types.cpp
-/compiler/cpp/src/plugin/plugin_types.h
+/compiler/cpp/src/thrift/plugin/plugin_constants.cpp
+/compiler/cpp/src/thrift/plugin/plugin_constants.h
+/compiler/cpp/src/thrift/plugin/plugin_types.cpp
+/compiler/cpp/src/thrift/plugin/plugin_types.h
/compiler/cpp/test/*test
/compiler/cpp/test/thrift-gen-*
-/compiler/cpp/src/thrift-bootstrap
-/compiler/cpp/src/plugin/gen.stamp
+/compiler/cpp/src/thrift/thrift-bootstrap
+/compiler/cpp/src/thrift/plugin/gen.stamp
/compiler/cpp/Debug
/compiler/cpp/Release
-/compiler/cpp/src/libparse.a
-/compiler/cpp/src/thriftl.cc
-/compiler/cpp/src/thrifty.cc
-/compiler/cpp/src/thrifty.hh
-/compiler/cpp/src/windows/version.h
+/compiler/cpp/src/thrift/libparse.a
+/compiler/cpp/src/thrift/thriftl.cc
+/compiler/cpp/src/thrift/thrifty.cc
+/compiler/cpp/src/thrift/thrifty.hh
+/compiler/cpp/src/thrift/windows/version.h
/compiler/cpp/thrift
/compiler/cpp/thriftl.cc
/compiler/cpp/thrifty.cc
/compiler/cpp/lex.yythriftl.cc
/compiler/cpp/thrifty.h
/compiler/cpp/thrifty.hh
-/compiler/cpp/src/version.h
+/compiler/cpp/src/thrift/version.h
/config.*
/configure
/configure.lineno
diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt
index 48cadbc1d..2d9529a8f 100644
--- a/compiler/cpp/CMakeLists.txt
+++ b/compiler/cpp/CMakeLists.txt
@@ -19,52 +19,52 @@
# Windows has a different header
if(MSVC)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/windows/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/windows/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h)
else()
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h)
endif()
find_package(FLEX REQUIRED)
find_package(BISON REQUIRED)
# Create flex and bison files and build the lib parse static library
-BISON_TARGET(thrifty ${CMAKE_CURRENT_SOURCE_DIR}/src/thrifty.yy ${CMAKE_CURRENT_BINARY_DIR}/thrifty.cc)
-FLEX_TARGET(thriftl ${CMAKE_CURRENT_SOURCE_DIR}/src/thriftl.ll ${CMAKE_CURRENT_BINARY_DIR}/thriftl.cc)
+BISON_TARGET(thrifty ${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/thrifty.yy ${CMAKE_CURRENT_BINARY_DIR}/thrift/thrifty.cc)
+FLEX_TARGET(thriftl ${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/thriftl.ll ${CMAKE_CURRENT_BINARY_DIR}/thrift/thriftl.cc)
ADD_FLEX_BISON_DEPENDENCY(thriftl thrifty)
# HACK: Work around the fact that bison crates a .hh file but we need a .h file
-add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/thrifty.h
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/thrifty.hh ${CMAKE_CURRENT_BINARY_DIR}/thrifty.h
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/thrifty.hh
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/thrift/thrifty.h
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/thrift/thrifty.hh ${CMAKE_CURRENT_BINARY_DIR}/thrift/thrifty.h
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/thrift/thrifty.hh
)
set(libparse_SOURCES
- ${CMAKE_CURRENT_BINARY_DIR}/thrifty.cc
- ${CMAKE_CURRENT_BINARY_DIR}/thriftl.cc
- ${CMAKE_CURRENT_BINARY_DIR}/thrifty.h
+ ${CMAKE_CURRENT_BINARY_DIR}/thrift/thrifty.cc
+ ${CMAKE_CURRENT_BINARY_DIR}/thrift/thriftl.cc
+ ${CMAKE_CURRENT_BINARY_DIR}/thrift/thrifty.h
)
add_library(libparse STATIC ${libparse_SOURCES})
# Create the thrift compiler
set(compiler_core
- src/common.cc
- src/generate/t_generator.cc
- src/parse/t_typedef.cc
- src/parse/parse.cc
- ${CMAKE_CURRENT_BINARY_DIR}/version.h
+ src/thrift/common.cc
+ src/thrift/generate/t_generator.cc
+ src/thrift/parse/t_typedef.cc
+ src/thrift/parse/parse.cc
+ ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h
)
set(thrift-compiler_SOURCES
- src/main.cc
- src/audit/t_audit.cpp
+ src/thrift/main.cc
+ src/thrift/audit/t_audit.cpp
)
# This macro adds an option THRIFT_COMPILER_${NAME}
# that allows enabling or disabling certain languages
macro(THRIFT_ADD_COMPILER name description initial)
string(TOUPPER "THRIFT_COMPILER_${name}" enabler)
- set(src "src/generate/t_${name}_generator.cc")
+ set(src "src/thrift/generate/t_${name}_generator.cc")
option(${enabler} ${description} ${initial})
if(${enabler})
list(APPEND thrift-compiler_SOURCES ${src})
@@ -112,25 +112,25 @@ add_executable(thrift-compiler ${thrift-compiler_SOURCES})
if(${WITH_PLUGIN})
add_executable(thrift-bootstrap ${compiler_core}
- src/main.cc
- src/audit/t_audit.cpp
- src/generate/t_cpp_generator.cc
+ src/thrift/main.cc
+ src/thrift/audit/t_audit.cpp
+ src/thrift/generate/t_cpp_generator.cc
)
target_link_libraries(thrift-bootstrap libparse)
set(PLUGIN_GEN_SOURCES
- ${CMAKE_CURRENT_BINARY_DIR}/plugin/plugin_types.h
- ${CMAKE_CURRENT_BINARY_DIR}/plugin/plugin_types.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/plugin/plugin_constants.h
- ${CMAKE_CURRENT_BINARY_DIR}/plugin/plugin_constants.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/thrift/plugin/plugin_types.h
+ ${CMAKE_CURRENT_BINARY_DIR}/thrift/plugin/plugin_types.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/thrift/plugin/plugin_constants.h
+ ${CMAKE_CURRENT_BINARY_DIR}/thrift/plugin/plugin_constants.cpp
)
- file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plugin)
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/thrift/plugin)
add_custom_command(OUTPUT ${PLUGIN_GEN_SOURCES}
- DEPENDS thrift-bootstrap src/plugin/plugin.thrift
+ DEPENDS thrift-bootstrap src/thrift/plugin/plugin.thrift
COMMAND thrift-bootstrap -gen cpp
- -out ${CMAKE_CURRENT_BINARY_DIR}/plugin
- ${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/plugin.thrift
+ -out ${CMAKE_CURRENT_BINARY_DIR}/thrift/plugin
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/plugin/plugin.thrift
)
include_directories(../../lib/cpp/src)
@@ -139,9 +139,9 @@ if(${WITH_PLUGIN})
ADD_LIBRARY_THRIFT(thriftc
${compiler_core}
${PLUGIN_GEN_SOURCES}
- src/logging.cc
- src/plugin/plugin_output.cc
- src/plugin/plugin.cc
+ src/thrift/logging.cc
+ src/thrift/plugin/plugin_output.cc
+ src/thrift/plugin/plugin.cc
)
TARGET_INCLUDE_DIRECTORIES_THRIFT(thriftc PUBLIC ${Boost_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY(thriftc thrift PUBLIC)
@@ -155,6 +155,63 @@ target_link_libraries(thrift-compiler libparse)
install(TARGETS thrift-compiler DESTINATION "${BIN_INSTALL_DIR}")
+if(${WITH_PLUGIN})
+ # Install the headers
+ install(FILES
+ "src/thrift/common.h"
+ "src/thrift/globals.h"
+ "src/thrift/logging.h"
+ "src/thrift/main.h"
+ "src/thrift/platform.h"
+ DESTINATION "${INCLUDE_INSTALL_DIR}/thrift")
+ install(FILES
+ "src/thrift/audit/t_audit.h"
+ DESTINATION "${INCLUDE_INSTALL_DIR}/thrift/audit")
+ install(FILES
+ "src/thrift/generate/t_generator.h"
+ "src/thrift/generate/t_generator_registry.h"
+ "src/thrift/generate/t_html_generator.h"
+ "src/thrift/generate/t_oop_generator.h"
+ DESTINATION "${INCLUDE_INSTALL_DIR}/thrift/generate")
+ install(FILES
+ "src/thrift/parse/t_base_type.h"
+ "src/thrift/parse/t_const.h"
+ "src/thrift/parse/t_const_value.h"
+ "src/thrift/parse/t_container.h"
+ "src/thrift/parse/t_doc.h"
+ "src/thrift/parse/t_enum.h"
+ "src/thrift/parse/t_enum_value.h"
+ "src/thrift/parse/t_field.h"
+ "src/thrift/parse/t_function.h"
+ "src/thrift/parse/t_list.h"
+ "src/thrift/parse/t_map.h"
+ "src/thrift/parse/t_program.h"
+ "src/thrift/parse/t_scope.h"
+ "src/thrift/parse/t_service.h"
+ "src/thrift/parse/t_set.h"
+ "src/thrift/parse/t_struct.h"
+ "src/thrift/parse/t_typedef.h"
+ "src/thrift/parse/t_type.h"
+ DESTINATION "${INCLUDE_INSTALL_DIR}/thrift/parse")
+ install(FILES
+ "src/thrift/plugin/plugin.h"
+ "src/thrift/plugin/plugin_output.h"
+ "src/thrift/plugin/type_util.h"
+ DESTINATION "${INCLUDE_INSTALL_DIR}/thrift/plugin")
+if(MSVC)
+ install(FILES
+ "src/thrift/windows/config.h"
+ DESTINATION "${INCLUDE_INSTALL_DIR}/thrift/windows")
+ install(FILES
+ "${CMAKE_BINARY_DIR}/compiler/cpp/thrift/windows/version.h"
+ DESTINATION "${INCLUDE_INSTALL_DIR}/thrift/windows")
+else()
+ install(FILES
+ "${CMAKE_BINARY_DIR}/compiler/cpp/thrift/version.h"
+ DESTINATION "${INCLUDE_INSTALL_DIR}/thrift")
+endif()
+endif()
+
if(BUILD_TESTING)
add_subdirectory(test)
endif()
diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am
index f7a717165..9d830d7db 100644
--- a/compiler/cpp/Makefile.am
+++ b/compiler/cpp/Makefile.am
@@ -23,12 +23,12 @@
AUTOMAKE_OPTIONS = subdir-objects
-# Note on why we have src and src/plugin directories:
+# Note on why we have src/thrift and src/thrift/plugin directories:
# Since Automake supports only one set of BUILT_SOURCES per file and does not allow
# SUBDIRS built before BUILT_SOURCES, we end up separate Makefile.am for each source
# code generation, i.e. lex-yacc and Thrift, to achieve stable parallel make.
-SUBDIRS = src src/plugin .
+SUBDIRS = src src/thrift/plugin .
if WITH_TESTS
SUBDIRS += test
endif
@@ -37,82 +37,82 @@ bin_PROGRAMS = thrift
thrift_OBJDIR = obj
-plugin_gen = src/plugin/plugin_types.h \
- src/plugin/plugin_types.cpp \
- src/plugin/plugin_constants.h \
- src/plugin/plugin_constants.cpp
-
-compiler_core = src/common.h \
- src/common.cc \
- src/generate/t_generator.cc \
- src/generate/t_generator_registry.h \
- src/globals.h \
- src/platform.h \
- src/logging.h \
- src/parse/t_doc.h \
- src/parse/t_type.h \
- src/parse/t_base_type.h \
- src/parse/t_enum.h \
- src/parse/t_enum_value.h \
- src/parse/t_typedef.h \
- src/parse/t_typedef.cc \
- src/parse/t_container.h \
- src/parse/t_list.h \
- src/parse/t_set.h \
- src/parse/t_map.h \
- src/parse/t_struct.h \
- src/parse/t_field.h \
- src/parse/t_service.h \
- src/parse/t_function.h \
- src/parse/t_program.h \
- 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 \
- src/generate/t_html_generator.h \
- src/windows/config.h \
- src/windows/version.h
-
-thrift_SOURCES = src/main.h \
- src/main.cc \
- src/audit/t_audit.cpp \
- src/audit/t_audit.h
+plugin_gen = src/thrift/plugin/plugin_types.h \
+ src/thrift/plugin/plugin_types.cpp \
+ src/thrift/plugin/plugin_constants.h \
+ src/thrift/plugin/plugin_constants.cpp
+
+compiler_core = src/thrift/common.h \
+ src/thrift/common.cc \
+ src/thrift/generate/t_generator.cc \
+ src/thrift/generate/t_generator_registry.h \
+ src/thrift/globals.h \
+ src/thrift/platform.h \
+ src/thrift/logging.h \
+ src/thrift/parse/t_doc.h \
+ src/thrift/parse/t_type.h \
+ src/thrift/parse/t_base_type.h \
+ src/thrift/parse/t_enum.h \
+ src/thrift/parse/t_enum_value.h \
+ src/thrift/parse/t_typedef.h \
+ src/thrift/parse/t_typedef.cc \
+ src/thrift/parse/t_container.h \
+ src/thrift/parse/t_list.h \
+ src/thrift/parse/t_set.h \
+ src/thrift/parse/t_map.h \
+ src/thrift/parse/t_struct.h \
+ src/thrift/parse/t_field.h \
+ src/thrift/parse/t_service.h \
+ src/thrift/parse/t_function.h \
+ src/thrift/parse/t_program.h \
+ src/thrift/parse/t_scope.h \
+ src/thrift/parse/t_const.h \
+ src/thrift/parse/t_const_value.h \
+ src/thrift/parse/parse.cc \
+ src/thrift/generate/t_generator.h \
+ src/thrift/generate/t_oop_generator.h \
+ src/thrift/generate/t_html_generator.h \
+ src/thrift/windows/config.h \
+ src/thrift/windows/version.h
+
+thrift_SOURCES = src/thrift/main.h \
+ src/thrift/main.cc \
+ src/thrift/audit/t_audit.cpp \
+ src/thrift/audit/t_audit.h
# Specific client generator source
-thrift_SOURCES += src/generate/t_c_glib_generator.cc \
- src/generate/t_cpp_generator.cc \
- src/generate/t_java_generator.cc \
- src/generate/t_json_generator.cc \
- src/generate/t_as3_generator.cc \
- src/generate/t_dart_generator.cc \
- src/generate/t_haxe_generator.cc \
- src/generate/t_csharp_generator.cc \
- src/generate/t_py_generator.cc \
- src/generate/t_rb_generator.cc \
- src/generate/t_perl_generator.cc \
- src/generate/t_php_generator.cc \
- src/generate/t_erl_generator.cc \
- src/generate/t_cocoa_generator.cc \
- src/generate/t_swift_generator.cc \
- src/generate/t_st_generator.cc \
- src/generate/t_ocaml_generator.cc \
- src/generate/t_hs_generator.cc \
- src/generate/t_xsd_generator.cc \
- src/generate/t_xml_generator.cc \
- src/generate/t_html_generator.cc \
- src/generate/t_js_generator.cc \
- src/generate/t_javame_generator.cc \
- src/generate/t_delphi_generator.cc \
- src/generate/t_go_generator.cc \
- src/generate/t_gv_generator.cc \
- src/generate/t_d_generator.cc \
- src/generate/t_lua_generator.cc
+thrift_SOURCES += src/thrift/generate/t_c_glib_generator.cc \
+ src/thrift/generate/t_cpp_generator.cc \
+ src/thrift/generate/t_java_generator.cc \
+ src/thrift/generate/t_json_generator.cc \
+ src/thrift/generate/t_as3_generator.cc \
+ src/thrift/generate/t_dart_generator.cc \
+ src/thrift/generate/t_haxe_generator.cc \
+ src/thrift/generate/t_csharp_generator.cc \
+ src/thrift/generate/t_py_generator.cc \
+ src/thrift/generate/t_rb_generator.cc \
+ src/thrift/generate/t_perl_generator.cc \
+ src/thrift/generate/t_php_generator.cc \
+ src/thrift/generate/t_erl_generator.cc \
+ src/thrift/generate/t_cocoa_generator.cc \
+ src/thrift/generate/t_swift_generator.cc \
+ src/thrift/generate/t_st_generator.cc \
+ src/thrift/generate/t_ocaml_generator.cc \
+ src/thrift/generate/t_hs_generator.cc \
+ src/thrift/generate/t_xsd_generator.cc \
+ src/thrift/generate/t_xml_generator.cc \
+ src/thrift/generate/t_html_generator.cc \
+ src/thrift/generate/t_js_generator.cc \
+ src/thrift/generate/t_javame_generator.cc \
+ src/thrift/generate/t_delphi_generator.cc \
+ src/thrift/generate/t_go_generator.cc \
+ src/thrift/generate/t_gv_generator.cc \
+ src/thrift/generate/t_d_generator.cc \
+ src/thrift/generate/t_lua_generator.cc
thrift_CPPFLAGS = -I$(srcdir)/src
thrift_CXXFLAGS = -Wall -Wextra -pedantic
-thrift_LDADD = @LEXLIB@ src/libparse.a
+thrift_LDADD = @LEXLIB@ src/thrift/libparse.a
if !WITH_PLUGIN
thrift_SOURCES += $(compiler_core)
@@ -125,18 +125,64 @@ thrift_LDADD += libthriftc.la
nodist_libthriftc_la_SOURCES = $(plugin_gen)
libthriftc_la_SOURCES = $(compiler_core) \
- src/plugin/type_util.h \
- src/plugin/plugin.h \
- src/plugin/plugin.cc \
- src/plugin/plugin_output.h \
- src/plugin/plugin_output.cc \
- src/plugin/plugin.thrift \
- src/logging.cc
+ src/thrift/plugin/type_util.h \
+ src/thrift/plugin/plugin.h \
+ src/thrift/plugin/plugin.cc \
+ src/thrift/plugin/plugin_output.h \
+ src/thrift/plugin/plugin_output.cc \
+ src/thrift/plugin/plugin.thrift \
+ src/thrift/logging.cc
libthriftc_la_CPPFLAGS = -I$(srcdir)/src -Isrc -I$(top_builddir)/lib/cpp/src -DTHRIFT_ENABLE_PLUGIN=1
libthriftc_la_CXXFLAGS = -Wall -Wextra -pedantic
libthriftc_la_LIBADD = $(top_builddir)/lib/cpp/libthrift.la
+
+include_thriftdir = $(includedir)/thrift
+include_thrift_HEADERS = src/thrift/common.h \
+ src/thrift/globals.h \
+ src/thrift/logging.h \
+ src/thrift/main.h \
+ src/thrift/platform.h \
+ src/thrift/version.h
+
+include_auditdir = $(include_thriftdir)/windows
+include_audit_HEADERS = src/thrift/audit/t_audit.h
+
+include_generatedir = $(include_thriftdir)/generate
+include_generate_HEADERS = src/thrift/generate/t_generator.h \
+ src/thrift/generate/t_generator_registry.h \
+ src/thrift/generate/t_oop_generator.h \
+ src/thrift/generate/t_html_generator.h
+
+include_parsedir = $(include_thriftdir)/parse
+include_parse_HEADERS = src/thrift/parse/t_service.h \
+ src/thrift/parse/t_program.h \
+ src/thrift/parse/t_field.h \
+ src/thrift/parse/t_scope.h \
+ src/thrift/parse/t_typedef.h \
+ src/thrift/parse/t_set.h \
+ src/thrift/parse/t_const_value.h \
+ src/thrift/parse/t_enum_value.h \
+ src/thrift/parse/t_const.h \
+ src/thrift/parse/t_list.h \
+ src/thrift/parse/t_map.h \
+ src/thrift/parse/t_container.h \
+ src/thrift/parse/t_base_type.h \
+ src/thrift/parse/t_enum.h \
+ src/thrift/parse/t_function.h \
+ src/thrift/parse/t_type.h \
+ src/thrift/parse/t_doc.h \
+ src/thrift/parse/t_struct.h
+
+include_plugindir = $(include_thriftdir)/plugin
+include_plugin_HEADERS = src/thrift/plugin/plugin.h \
+ src/thrift/plugin/type_util.h \
+ src/thrift/plugin/plugin_output.h
+
+include_windowsdir = $(include_thriftdir)/windows
+include_windows_HEADERS = src/thrift/windows/version.h \
+ src/thrift/windows/config.h
endif
WINDOWS_DIST = \
@@ -153,7 +199,7 @@ EXTRA_DIST = \
clean-local:
$(RM) version.h windows/version.h $(plugin_gen)
-src/main.cc: src/version.h
+src/thrift/main.cc: src/thrift/version.h
style-local:
- $(CPPSTYLE_CMD)
+ $(CPPSTYLE_CMD)
diff --git a/compiler/cpp/src/Makefile.am b/compiler/cpp/src/Makefile.am
index e2fae709d..f1863d515 100644
--- a/compiler/cpp/src/Makefile.am
+++ b/compiler/cpp/src/Makefile.am
@@ -25,63 +25,63 @@ AUTOMAKE_OPTIONS = subdir-objects
AM_YFLAGS = -d
-BUILT_SOURCES = thrifty.cc
+BUILT_SOURCES = thrift/thrifty.cc
-noinst_LIBRARIES = libparse.a
+noinst_LIBRARIES = thrift/libparse.a
-libparse_a_CPPFLAGS = -I$(srcdir)
-libparse_a_CXXFLAGS = -Wall -Wno-sign-compare -Wno-unused
+thrift_libparse_a_CPPFLAGS = -I$(srcdir)
+thrift_libparse_a_CXXFLAGS = -Wall -Wno-sign-compare -Wno-unused
-libparse_a_SOURCES = thrifty.yy \
- thriftl.ll
+thrift_libparse_a_SOURCES = thrift/thrifty.yy \
+ thrift/thriftl.ll
clean-local:
- $(RM) thriftl.cc thrifty.cc thrifty.h thrifty.hh
+ $(RM) thrift/thriftl.cc thrift/thrifty.cc thrift/thrifty.h thrift/thrifty.hh
if WITH_PLUGIN
-noinst_PROGRAMS = thrift-bootstrap
+noinst_PROGRAMS = thrift/thrift-bootstrap
-thrift_bootstrap_SOURCES = \
- common.h \
- common.cc \
- audit/t_audit.h \
- audit/t_audit.cpp \
- generate/t_generator.cc \
- generate/t_generator_registry.h \
- globals.h \
- platform.h \
- logging.h \
- parse/t_doc.h \
- parse/t_type.h \
- parse/t_base_type.h \
- parse/t_enum.h \
- parse/t_enum_value.h \
- parse/t_typedef.h \
- parse/t_typedef.cc \
- parse/t_container.h \
- parse/t_list.h \
- parse/t_set.h \
- parse/t_map.h \
- parse/t_struct.h \
- parse/t_field.h \
- parse/t_service.h \
- parse/t_function.h \
- parse/t_program.h \
- parse/t_scope.h \
- parse/t_const.h \
- parse/t_const_value.h \
- parse/parse.cc \
- generate/t_generator.h \
- generate/t_oop_generator.h \
- generate/t_html_generator.h \
- windows/config.h \
- windows/version.h \
- generate/t_cpp_generator.cc \
- main.h \
- main.cc
+thrift_thrift_bootstrap_SOURCES = \
+ thrift/common.h \
+ thrift/common.cc \
+ thrift/audit/t_audit.h \
+ thrift/audit/t_audit.cpp \
+ thrift/generate/t_generator.cc \
+ thrift/generate/t_generator_registry.h \
+ thrift/globals.h \
+ thrift/platform.h \
+ thrift/logging.h \
+ thrift/parse/t_doc.h \
+ thrift/parse/t_type.h \
+ thrift/parse/t_base_type.h \
+ thrift/parse/t_enum.h \
+ thrift/parse/t_enum_value.h \
+ thrift/parse/t_typedef.h \
+ thrift/parse/t_typedef.cc \
+ thrift/parse/t_container.h \
+ thrift/parse/t_list.h \
+ thrift/parse/t_set.h \
+ thrift/parse/t_map.h \
+ thrift/parse/t_struct.h \
+ thrift/parse/t_field.h \
+ thrift/parse/t_service.h \
+ thrift/parse/t_function.h \
+ thrift/parse/t_program.h \
+ thrift/parse/t_scope.h \
+ thrift/parse/t_const.h \
+ thrift/parse/t_const_value.h \
+ thrift/parse/parse.cc \
+ thrift/generate/t_generator.h \
+ thrift/generate/t_oop_generator.h \
+ thrift/generate/t_html_generator.h \
+ thrift/windows/config.h \
+ thrift/windows/version.h \
+ thrift/generate/t_cpp_generator.cc \
+ thrift/main.h \
+ thrift/main.cc
main.cc: version.h
-thrift_bootstrap_CXXFLAGS = -Wall -Wextra -pedantic
-thrift_bootstrap_LDADD = @LEXLIB@ libparse.a
+thrift_thrift_bootstrap_CXXFLAGS = -Wall -Wextra -pedantic
+thrift_thrift_bootstrap_LDADD = @LEXLIB@ thrift/libparse.a
endif
diff --git a/compiler/cpp/src/audit/t_audit.cpp b/compiler/cpp/src/thrift/audit/t_audit.cpp
index afcbd5e1a..1386f3bd1 100644
--- a/compiler/cpp/src/audit/t_audit.cpp
+++ b/compiler/cpp/src/thrift/audit/t_audit.cpp
@@ -12,16 +12,16 @@
#include <limits.h>
// Careful: must include globals first for extern definitions
-#include "globals.h"
+#include "thrift/globals.h"
-#include "parse/t_program.h"
-#include "parse/t_scope.h"
-#include "parse/t_const.h"
-#include "parse/t_field.h"
+#include "thrift/parse/t_program.h"
+#include "thrift/parse/t_scope.h"
+#include "thrift/parse/t_const.h"
+#include "thrift/parse/t_field.h"
-#include "version.h"
+#include "thrift/version.h"
-#include "t_audit.h"
+#include "thrift/audit/t_audit.h"
extern int g_warn;
extern std::string g_curpath;
@@ -85,7 +85,7 @@ void compare_enum_values(t_enum* newEnum,t_enum* oldEnum)
if(enumName != newEnumValue->get_name())
{
thrift_audit_warning(1, "Name of the value %d changed in enum %s\n", enumValue, oldEnum->get_name().c_str());
- }
+ }
}
else
{
@@ -125,7 +125,7 @@ void compare_enums(const std::vector<t_enum*>& newEnumList, const std::vector<t_
bool compare_type(t_type* newType, t_type* oldType)
{
//Comparing names of two types will work when the newType and oldType are basic types or structs or enums.
- //However, when they are containers, get_name() returns empty for which we have to compare the type of
+ //However, when they are containers, get_name() returns empty for which we have to compare the type of
//their elements as well.
if((newType->get_name()).empty() && (oldType->get_name()).empty())
{
@@ -150,7 +150,7 @@ bool compare_type(t_type* newType, t_type* oldType)
{
t_type* newElementType = ((t_set*)newType)->get_elem_type();
t_type* oldElementType = ((t_set*)oldType)->get_elem_type();
- return compare_type(newElementType, oldElementType);
+ return compare_type(newElementType, oldElementType);
}
else
{
@@ -170,7 +170,7 @@ bool compare_type(t_type* newType, t_type* oldType)
bool compare_pair(std::pair<t_const_value*, t_const_value*> newMapPair, std::pair<t_const_value*, t_const_value*> oldMapPair)
{
return compare_defaults(newMapPair.first, oldMapPair.first) && compare_defaults(newMapPair.second, oldMapPair.second);
-}
+}
// This function returns 'true' if the default values are same. Returns false if they are different.
bool compare_defaults(t_const_value* newStructDefault, t_const_value* oldStructDefault)
@@ -259,7 +259,7 @@ void compare_single_struct(t_struct* newStruct, t_struct* oldStruct, const std::
std::vector<t_field*>::const_iterator newStructMemberIt = newStructMembersInIdOrder.begin();
// Since we have the struct members in their ID order, comparing their IDs can be done by traversing the two member
- // lists together.
+ // lists together.
while(!(oldStructMemberIt == oldStructMembersInIdOrder.end() && newStructMemberIt == newStructMembersInIdOrder.end()))
{
if(newStructMemberIt == newStructMembersInIdOrder.end() && oldStructMemberIt != oldStructMembersInIdOrder.end())
@@ -462,5 +462,3 @@ void compare_consts(const std::vector<t_const*>& newConst, const std::vector<t_c
}
}
}
-
-
diff --git a/compiler/cpp/src/audit/t_audit.h b/compiler/cpp/src/thrift/audit/t_audit.h
index be79e3124..be79e3124 100644
--- a/compiler/cpp/src/audit/t_audit.h
+++ b/compiler/cpp/src/thrift/audit/t_audit.h
diff --git a/compiler/cpp/src/common.cc b/compiler/cpp/src/thrift/common.cc
index 6e11bb241..3a2b9d359 100644
--- a/compiler/cpp/src/common.cc
+++ b/compiler/cpp/src/thrift/common.cc
@@ -17,8 +17,8 @@
* under the License.
*/
-#include "common.h"
-#include "parse/t_base_type.h"
+#include "thrift/common.h"
+#include "thrift/parse/t_base_type.h"
t_type* g_type_void;
t_type* g_type_string;
diff --git a/compiler/cpp/src/common.h b/compiler/cpp/src/thrift/common.h
index ab7c42327..694884636 100644
--- a/compiler/cpp/src/common.h
+++ b/compiler/cpp/src/thrift/common.h
@@ -20,7 +20,7 @@
#ifndef T_COMMON_H
#define T_COMMON_H
-#include "parse/t_type.h"
+#include "thrift/parse/t_type.h"
/**
* Global types for the parser to be able to reference
diff --git a/compiler/cpp/src/generate/t_as3_generator.cc b/compiler/cpp/src/thrift/generate/t_as3_generator.cc
index 67beaf640..5ae3f91d6 100644
--- a/compiler/cpp/src/generate/t_as3_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_as3_generator.cc
@@ -27,8 +27,8 @@
#include <sys/stat.h>
#include <stdexcept>
-#include "platform.h"
-#include "t_oop_generator.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -57,7 +57,7 @@ public:
if( iter->first.compare("bindable") == 0) {
bindable_ = true;
} else {
- throw "unknown option as3:" + iter->first;
+ throw "unknown option as3:" + iter->first;
}
}
diff --git a/compiler/cpp/src/generate/t_c_glib_generator.cc b/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc
index 3a3fe5407..7d4e4f03d 100644
--- a/compiler/cpp/src/generate/t_c_glib_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc
@@ -29,8 +29,8 @@
#include <ctype.h>
-#include "platform.h"
-#include "t_oop_generator.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -65,7 +65,7 @@ public:
/* no options yet */
for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
- throw "unknown option c_glib:" + iter->first;
+ throw "unknown option c_glib:" + iter->first;
}
/* set the namespace */
diff --git a/compiler/cpp/src/generate/t_cocoa_generator.cc b/compiler/cpp/src/thrift/generate/t_cocoa_generator.cc
index 794fb44ed..eba94c0a3 100644
--- a/compiler/cpp/src/generate/t_cocoa_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_cocoa_generator.cc
@@ -25,8 +25,8 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sstream>
-#include "t_oop_generator.h"
-#include "platform.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ostream;
@@ -72,7 +72,7 @@ public:
} else if( iter->first.compare("pods") == 0) {
pods_ = true;
} else {
- throw "unknown option cocoa:" + iter->first;
+ throw "unknown option cocoa:" + iter->first;
}
}
@@ -292,7 +292,7 @@ void t_cocoa_generator::init_generator() {
f_impl_ << cocoa_imports() << cocoa_thrift_imports() << "#import \"" << f_header_name << "\""
<< endl << endl;
-
+
error_constant_ = 60000;
}
@@ -335,9 +335,9 @@ string t_cocoa_generator::cocoa_thrift_imports() {
}
includes << endl;
}
-
+
includes << endl;
-
+
if (promise_kit_) {
includes << "#import ";
if (pods_) {
@@ -356,7 +356,7 @@ string t_cocoa_generator::cocoa_thrift_imports() {
<< capitalize(other_includes[i]->get_name())
<< ".h\"" << endl;
}
-
+
includes << endl;
return includes.str();
@@ -444,7 +444,7 @@ void t_cocoa_generator::generate_consts(std::vector<t_const*> consts) {
const_interface << "FOUNDATION_EXPORT NSString *" << cocoa_prefix_ << capitalize(program_name_) << "ErrorDomain;" << endl
<< endl;
-
+
bool needs_class = false;
@@ -460,12 +460,12 @@ void t_cocoa_generator::generate_consts(std::vector<t_const*> consts) {
needs_class = true;
}
}
-
-
+
+
string constants_class_name = cocoa_prefix_ + capitalize(program_name_) + "Constants";
if (needs_class) {
-
+
const_interface << endl;
const_interface << "@interface " << constants_class_name << " : NSObject ";
@@ -487,7 +487,7 @@ void t_cocoa_generator::generate_consts(std::vector<t_const*> consts) {
// this gets spit into the header file in ::close_generator
constants_declarations_ = const_interface.str();
-
+
f_impl_ << "NSString *" << cocoa_prefix_ << capitalize(program_name_) << "ErrorDomain = "
<< "@\"" << cocoa_prefix_ << capitalize(program_name_) << "ErrorDomain\";" << endl << endl;
@@ -571,14 +571,14 @@ void t_cocoa_generator::generate_xception(t_struct* txception) {
void t_cocoa_generator::generate_cocoa_struct_interface(ofstream& out,
t_struct* tstruct,
bool is_exception) {
-
+
if (is_exception) {
out << "enum {" << endl
<< " " << cocoa_prefix_ << capitalize(program_name_) << "Error" << tstruct->get_name() << " = -" << error_constant_++ << endl
<< "};" << endl
<< endl;
}
-
+
out << "@interface " << cocoa_prefix_ << tstruct->get_name() << " : ";
if (is_exception) {
@@ -587,7 +587,7 @@ void t_cocoa_generator::generate_cocoa_struct_interface(ofstream& out,
out << "NSObject ";
}
out << "<TBase, NSCoding, NSCopying> " << endl;
-
+
out << endl;
// properties
@@ -601,7 +601,7 @@ void t_cocoa_generator::generate_cocoa_struct_interface(ofstream& out,
out << endl;
}
}
-
+
out << endl;
// initializer for all fields
@@ -647,14 +647,14 @@ void t_cocoa_generator::generate_cocoa_struct_init_with_coder_method(ofstream& o
indent(out) << "- (instancetype) initWithCoder: (NSCoder *) decoder" << endl;
scope_up(out);
-
+
if (is_exception) {
// NSExceptions conform to NSCoding, so we can call super
indent(out) << "self = [super initWithCoder: decoder];" << endl;
} else {
indent(out) << "self = [super init];" << endl;
}
-
+
indent(out) << "if (self) ";
scope_up(out);
@@ -701,7 +701,7 @@ void t_cocoa_generator::generate_cocoa_struct_init_with_coder_method(ofstream& o
out << indent() << "_" << (*m_iter)->get_name() << "IsSet = YES;" << endl;
scope_down(out);
}
-
+
scope_down(out);
out << indent() << "return self;" << endl;
@@ -719,7 +719,7 @@ void t_cocoa_generator::generate_cocoa_struct_encode_with_coder_method(ofstream&
indent(out) << "- (void) encodeWithCoder: (NSCoder *) encoder" << endl;
scope_up(out);
-
+
if (is_exception) {
// NSExceptions conform to NSCoding, so we can call super
out << indent() << "[super encodeWithCoder: encoder];" << endl;
@@ -783,16 +783,16 @@ void t_cocoa_generator::generate_cocoa_struct_encode_with_coder_method(ofstream&
void t_cocoa_generator::generate_cocoa_struct_copy_method(ofstream& out, t_struct* tstruct, bool is_exception) {
out << indent() << "- (instancetype) copyWithZone:(NSZone *)zone" << endl;
scope_up(out);
-
+
if (is_exception) {
out << indent() << type_name(tstruct) << " val = [" << cocoa_prefix_ << tstruct->get_name() << " errorWithDomain: self.domain code: self.code userInfo: self.userInfo];" << endl;
} else {
out << indent() << type_name(tstruct) << " val = [" << cocoa_prefix_ << tstruct->get_name() << " new];" << endl;
}
-
+
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
-
+
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
t_type* t = get_true_type((*m_iter)->get_type());
out << indent() << "if (_" << (*m_iter)->get_name() << "IsSet)" << endl;
@@ -805,9 +805,9 @@ void t_cocoa_generator::generate_cocoa_struct_copy_method(ofstream& out, t_struc
out << endl;
scope_down(out);
}
-
+
out << indent() << "return val;" << endl;
-
+
scope_down(out);
out << endl;
}
@@ -878,7 +878,7 @@ void t_cocoa_generator::generate_cocoa_struct_is_equal_method(ofstream& out, t_s
if (!members.empty()) {
indent(out) << class_name << " *other = (" << class_name << " *)anObject;" << endl;
-
+
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
t_type* t = get_true_type((*m_iter)->get_type());
string name = (*m_iter)->get_name();
@@ -969,7 +969,7 @@ void t_cocoa_generator::generate_cocoa_struct_implementation(ofstream& out,
} else {
out << indent() << "self = [super init];" << endl;
}
-
+
indent(out) << "if (self)";
scope_up(out);
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
@@ -1069,7 +1069,7 @@ void t_cocoa_generator::generate_cocoa_struct_reader(ofstream& out, t_struct* ts
out << indent() << " NSLog(@\"%s: field ID %i has unexpected type %i. Skipping.\", "
"__PRETTY_FUNCTION__, (int)fieldID, (int)fieldType);" << endl;
}
-
+
out << indent() << " if (![TProtocolUtil skipType: fieldType onProtocol: inProtocol error: __thriftError]) return NO;" << endl;
out << indent() << "}" << endl << indent() << "break;" << endl;
indent_down();
@@ -1083,7 +1083,7 @@ void t_cocoa_generator::generate_cocoa_struct_reader(ofstream& out, t_struct* ts
}
out << indent() << " if (![TProtocolUtil skipType: fieldType onProtocol: inProtocol error: __thriftError]) return NO;" << endl;
-
+
out << indent() << " break;" << endl;
scope_down(out);
@@ -1101,7 +1101,7 @@ void t_cocoa_generator::generate_cocoa_struct_reader(ofstream& out, t_struct* ts
}
indent(out) << "return YES;" << endl;
-
+
indent_down();
out << indent() << "}" << endl << endl;
}
@@ -1150,7 +1150,7 @@ void t_cocoa_generator::generate_cocoa_struct_writer(ofstream& out, t_struct* ts
<< indent() << "if (![outProtocol writeStructEnd: __thriftError]) return NO;" << endl;
indent(out) << "return YES;" << endl;
-
+
indent_down();
out << indent() << "}" << endl << endl;
}
@@ -1214,7 +1214,7 @@ void t_cocoa_generator::generate_cocoa_struct_result_writer(ofstream& out, t_str
<< endl;
indent(out) << "return YES;" << endl;
-
+
indent_down();
out << indent() << "}" << endl << endl;
}
@@ -1299,7 +1299,7 @@ void t_cocoa_generator::generate_cocoa_struct_field_accessor_implementations(ofs
* @param tstruct The struct definition
*/
void t_cocoa_generator::generate_cocoa_struct_description(ofstream& out, t_struct* tstruct) {
-
+
// Allow use of debugDescription so the app can add description via a cateogory/extension
if (debug_descriptions_) {
out << indent() << "- (NSString *) debugDescription {" << endl;
@@ -1362,11 +1362,11 @@ void t_cocoa_generator::generate_cocoa_service_helpers(t_service* tservice) {
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::iterator f_iter;
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-
+
t_struct* ts = (*f_iter)->get_arglist();
-
+
string qname = function_args_helper_struct_type(tservice, *f_iter);
-
+
t_struct qname_ts = t_struct(ts->get_program(), qname);
const vector<t_field*>& members = ts->get_members();
@@ -1374,7 +1374,7 @@ void t_cocoa_generator::generate_cocoa_service_helpers(t_service* tservice) {
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
qname_ts.append(*m_iter);
}
-
+
generate_cocoa_struct_interface(f_impl_, &qname_ts, false);
generate_cocoa_struct_implementation(f_impl_, &qname_ts, false, false);
generate_function_helpers(tservice, *f_iter);
@@ -1534,7 +1534,7 @@ void t_cocoa_generator::generate_cocoa_service_client_send_function_implementati
// Open function
indent(out) << "- (BOOL) send_" << tfunction->get_name() << argument_list(tfunction->get_arglist(), needs_protocol ? "outProtocol" : "", true) << endl;
scope_up(out);
-
+
// Serialize the request
out << indent() << "if (![outProtocol writeMessageBeginWithName: @\"" << funname << "\""
<< (tfunction->is_oneway() ? " type: TMessageTypeONEWAY" : " type: TMessageTypeCALL")
@@ -1582,7 +1582,7 @@ void t_cocoa_generator::generate_cocoa_service_client_recv_function_implementati
t_function* tfunction,
bool needs_protocol) {
-
+
// Open function
indent(out) << "- (BOOL) recv_" << tfunction->get_name();
if (!tfunction->get_returntype()->is_void()) {
@@ -1668,7 +1668,7 @@ void t_cocoa_generator::generate_cocoa_service_client_recv_function_implementati
void t_cocoa_generator::generate_cocoa_service_client_send_function_invocation(
ofstream& out,
t_function* tfunction) {
-
+
t_struct* arg_struct = tfunction->get_arglist();
const vector<t_field*>& fields = arg_struct->get_members();
vector<t_field*>::const_iterator fld_iter;
@@ -1699,7 +1699,7 @@ void t_cocoa_generator::generate_cocoa_service_client_send_async_function_invoca
ofstream& out,
t_function* tfunction,
string failureBlockName) {
-
+
t_struct* arg_struct = tfunction->get_arglist();
const vector<t_field*>& fields = arg_struct->get_members();
vector<t_field*>::const_iterator fld_iter;
@@ -1732,9 +1732,9 @@ void t_cocoa_generator::generate_cocoa_service_client_send_async_function_invoca
*/
void t_cocoa_generator::generate_cocoa_service_client_implementation(ofstream& out,
t_service* tservice) {
-
+
string name = cocoa_prefix_ + tservice->get_name() + "Client";
-
+
out << "@interface " << name << " () ";
scope_up(out);
out << endl;
@@ -1744,7 +1744,7 @@ void t_cocoa_generator::generate_cocoa_service_client_implementation(ofstream& o
scope_down(out);
out << endl;
out << "@end" << endl << endl;
-
+
out << "@implementation " << name << endl;
// initializers
@@ -1816,7 +1816,7 @@ void t_cocoa_generator::generate_cocoa_service_client_implementation(ofstream& o
*/
void t_cocoa_generator::generate_cocoa_service_client_async_implementation(ofstream& out,
t_service* tservice) {
-
+
string name = cocoa_prefix_ + tservice->get_name() + "ClientAsync";
out << "@interface " << name << " () ";
@@ -1828,8 +1828,8 @@ void t_cocoa_generator::generate_cocoa_service_client_async_implementation(ofstr
scope_down(out);
out << endl;
out << "@end" << endl << endl;
-
-
+
+
out << "@implementation " << name << endl
<< endl << "- (id) initWithProtocolFactory: (id <TProtocolFactory>) aProtocolFactory "
"transportFactory: (id <TAsyncTransportFactory>) aTransportFactory;" << endl;
@@ -1858,12 +1858,12 @@ void t_cocoa_generator::generate_cocoa_service_client_async_implementation(ofstr
// Open function
indent(out) << "- " << async_function_signature(*f_iter, false) << endl;
scope_up(out);
-
+
out << indent() << "NSError *thriftError;" << endl
<< indent() << "id<TAsyncTransport> transport = [transportFactory newTransport];" << endl
<< indent() << "id<TProtocol> protocol = [protocolFactory newProtocolOnTransport:transport];" << endl
<< endl;
-
+
generate_cocoa_service_client_send_async_function_invocation(out, *f_iter, "failureBlock");
out << indent() << "[transport flushWithCompletion:^{" << endl;
@@ -1871,7 +1871,7 @@ void t_cocoa_generator::generate_cocoa_service_client_async_implementation(ofstr
if (!(*f_iter)->is_oneway()) {
out << indent() << "NSError *thriftError;" << endl;
-
+
if (!(*f_iter)->get_returntype()->is_void()) {
out << indent() << type_name((*f_iter)->get_returntype()) << " result;" << endl;
}
@@ -1885,7 +1885,7 @@ void t_cocoa_generator::generate_cocoa_service_client_async_implementation(ofstr
<< indent() << "return;" << endl;
scope_down(out);
}
-
+
out << indent() << "responseBlock(";
if (!(*f_iter)->is_oneway() && !(*f_iter)->get_returntype()->is_void()) {
out << "result";
@@ -1893,35 +1893,35 @@ void t_cocoa_generator::generate_cocoa_service_client_async_implementation(ofstr
out << ");" << endl;
indent_down();
-
+
out << indent() << "} failure:failureBlock];" << endl;
-
+
scope_down(out);
out << endl;
-
+
// Promise function
if (promise_kit_) {
-
+
indent(out) << "- " << promise_function_signature(*f_iter) << endl;
scope_up(out);
-
+
out << indent() << "return [AnyPromise promiseWithResolverBlock:^(PMKResolver resolver) {" << endl;
indent_up();
-
+
out << indent() << "NSError *thriftError;" << endl
<< indent() << "id<TAsyncTransport> transport = [transportFactory newTransport];" << endl
<< indent() << "id<TProtocol> protocol = [protocolFactory newProtocolOnTransport:transport];" << endl
<< endl;
-
+
generate_cocoa_service_client_send_async_function_invocation(out, *f_iter, "resolver");
-
+
out << indent() << "[transport flushWithCompletion:^{" << endl;
indent_up();
-
+
if (!(*f_iter)->is_oneway()) {
out << indent() << "NSError *thriftError;" << endl;
-
+
if (!(*f_iter)->get_returntype()->is_void()) {
out << indent() << type_name((*f_iter)->get_returntype()) << " result;" << endl;
}
@@ -1935,7 +1935,7 @@ void t_cocoa_generator::generate_cocoa_service_client_async_implementation(ofstr
<< indent() << "return;" << endl;
scope_down(out);
}
-
+
out << indent() << "resolver(";
if ((*f_iter)->is_oneway() || (*f_iter)->get_returntype()->is_void()) {
out << "@YES";
@@ -1945,24 +1945,24 @@ void t_cocoa_generator::generate_cocoa_service_client_async_implementation(ofstr
out << "@(result)";
}
out << ");" << endl;
-
+
indent_down();
-
+
out << indent() << "} failure:^(NSError *error) {" << endl;
indent_up();
out << indent() << "resolver(error);" << endl;
indent_down();
out << indent() << "}];" << endl;
-
+
indent_down();
out << indent() << "}];" << endl;
-
+
scope_down(out);
-
+
out << endl;
-
+
}
-
+
}
out << "@end" << endl << endl;
@@ -1976,18 +1976,18 @@ void t_cocoa_generator::generate_cocoa_service_client_async_implementation(ofstr
*/
void t_cocoa_generator::generate_cocoa_service_server_implementation(ofstream& out,
t_service* tservice) {
-
+
string name = cocoa_prefix_ + tservice->get_name() + "Processor";
-
+
out << "@interface " << name << " () ";
-
+
scope_up(out);
out << indent() << "id <" << cocoa_prefix_ << tservice->get_name() << "> service;" << endl;
out << indent() << "NSDictionary * methodMap;" << endl;
scope_down(out);
-
+
out << "@end" << endl << endl;
-
+
out << "@implementation " << name << endl;
// initializer
@@ -2125,7 +2125,7 @@ void t_cocoa_generator::generate_cocoa_service_server_implementation(ofstream& o
if (!(*f_iter)->get_returntype()->is_void()) {
out << indent() << "[result setSuccess: " << unbox((*f_iter)->get_returntype(), "serviceResult") << "];" << endl;
}
-
+
// write out the result if not oneway
if (!(*f_iter)->is_oneway()) {
out << indent() << "if (![outProtocol writeMessageBeginWithName: @\"" << funname << "\"" << endl;
@@ -2340,7 +2340,7 @@ string t_cocoa_generator::unbox(t_type* ttype, string field_name) {
break;
}
}
-
+
// do nothing
return field_name;
}
@@ -2627,17 +2627,17 @@ string t_cocoa_generator::type_name(t_type* ttype, bool class_ref, bool needs_mu
/**
* Returns an Objective-C type name for container types
- *
+ *
* @param ttype the type
*/
string t_cocoa_generator::element_type_name(t_type* etype) {
-
+
t_type* ttype = etype->get_true_type();
-
+
if (etype->is_typedef() && type_can_be_null(ttype)) {
return type_name(etype);
}
-
+
string result;
if (ttype->is_base_type()) {
t_base_type* tbase = (t_base_type*)ttype;
@@ -2655,7 +2655,7 @@ string t_cocoa_generator::element_type_name(t_type* etype) {
break;
}
} else if (ttype->is_enum()) {
- result = "NSNumber *";
+ result = "NSNumber *";
} else if (ttype->is_map()) {
t_map *map = (t_map *)ttype;
result = "NSDictionary<" + element_type_name(map->get_key_type()) + ", " + element_type_name(map->get_val_type()) + "> *";
@@ -2668,7 +2668,7 @@ string t_cocoa_generator::element_type_name(t_type* etype) {
} else if (ttype->is_struct() || ttype->is_xception()) {
result = cocoa_prefix_ + ttype->get_name() + " *";
}
-
+
return result;
}
@@ -3010,16 +3010,16 @@ string t_cocoa_generator::render_const_value(string name,
string t_cocoa_generator::declare_property(t_field* tfield) {
std::ostringstream render;
render << "@property (";
-
+
if (type_can_be_null(tfield->get_type())) {
render << "strong, ";
} else {
render << "assign, ";
}
-
+
render << "nonatomic) " << type_name(tfield->get_type(), false, true) << " "
<< tfield->get_name() << ";";
-
+
// Check if the property name is an Objective-C return +1 count signal
if ((tfield->get_name().length() >= 3 && tfield->get_name().substr(0,3) == "new") ||
(tfield->get_name().length() >= 6 && tfield->get_name().substr(0,6) == "create") ||
@@ -3030,7 +3030,7 @@ string t_cocoa_generator::declare_property(t_field* tfield) {
render << "- (" + type_name(tfield->get_type()) + ") " + decapitalize(tfield->get_name()) + " __attribute__((objc_method_family(none)));";
}
}
-
+
return render.str();
}
@@ -3241,7 +3241,7 @@ string t_cocoa_generator::format_string_for_type(t_type* type) {
*/
string t_cocoa_generator::format_cast_for_type(t_type* type) {
type = get_true_type(type);
-
+
if (type->is_base_type()) {
t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
switch (tbase) {
@@ -3273,7 +3273,7 @@ string t_cocoa_generator::format_cast_for_type(t_type* type) {
} else if (type->is_list()) {
return ""; // "%@";
}
-
+
throw "INVALID TYPE IN format_cast_for_type: " + type->get_name();
}
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/thrift/generate/t_cpp_generator.cc
index 6c0489902..cbe8da226 100644
--- a/compiler/cpp/src/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_cpp_generator.cc
@@ -31,8 +31,8 @@
#include <sys/stat.h>
-#include "platform.h"
-#include "t_oop_generator.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -81,7 +81,7 @@ public:
} else if( iter->first.compare("moveable_types") == 0) {
gen_moveable_ = true;
} else {
- throw "unknown option cpp:" + iter->first;
+ throw "unknown option cpp:" + iter->first;
}
}
@@ -2320,10 +2320,10 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
<< "boost::shared_ptr< ::apache::thrift::transport::TMemoryBuffer> otrans_;"
<< endl;
}
- f_header_ <<
- indent() << prot_ptr << " piprot_;" << endl <<
- indent() << prot_ptr << " poprot_;" << endl <<
- indent() << protocol_type << "* iprot_;" << endl <<
+ f_header_ <<
+ indent() << prot_ptr << " piprot_;" << endl <<
+ indent() << prot_ptr << " poprot_;" << endl <<
+ indent() << protocol_type << "* iprot_;" << endl <<
indent() << protocol_type << "* oprot_;" << endl;
if (style == "Concurrent") {
@@ -2438,7 +2438,7 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
}
}
// Serialize the request
- out <<
+ out <<
indent() << "int32_t cseqid = " << cseqidVal << ";" << endl;
if(style == "Concurrent") {
out <<
@@ -2449,10 +2449,10 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
indent() << _this << "otrans_->resetBuffer();" << endl;
}
out <<
- indent() << _this << "oprot_->writeMessageBegin(\"" <<
- (*f_iter)->get_name() <<
- "\", ::apache::thrift::protocol::" << ((*f_iter)->is_oneway() ? "T_ONEWAY" : "T_CALL") <<
- ", cseqid);" << endl << endl <<
+ indent() << _this << "oprot_->writeMessageBegin(\"" <<
+ (*f_iter)->get_name() <<
+ "\", ::apache::thrift::protocol::" << ((*f_iter)->is_oneway() ? "T_ONEWAY" : "T_CALL") <<
+ ", cseqid);" << endl << endl <<
indent() << argsname << " args;" << endl;
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
@@ -2498,9 +2498,9 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
indent(out) << function_signature(&recv_function, "", scope) << endl;
scope_up(out);
- out << endl <<
- indent() << "int32_t rseqid = 0;" << endl <<
- indent() << "std::string fname;" << endl <<
+ out << endl <<
+ indent() << "int32_t rseqid = 0;" << endl <<
+ indent() << "std::string fname;" << endl <<
indent() << "::apache::thrift::protocol::TMessageType mtype;" << endl;
if(style == "Concurrent") {
out <<
@@ -2529,10 +2529,10 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
indent_up();
}
out <<
- indent() << "if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {" << endl <<
- indent() << " ::apache::thrift::TApplicationException x;" << endl <<
- indent() << " x.read(" << _this << "iprot_);" << endl <<
- indent() << " " << _this << "iprot_->readMessageEnd();" << endl <<
+ indent() << "if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {" << endl <<
+ indent() << " ::apache::thrift::TApplicationException x;" << endl <<
+ indent() << " x.read(" << _this << "iprot_);" << endl <<
+ indent() << " " << _this << "iprot_->readMessageEnd();" << endl <<
indent() << " " << _this << "iprot_->getTransport()->readEnd();" << endl;
if (style == "Cob" && !gen_no_client_completion_) {
out << indent() << " completed = true;" << endl << indent() << " completed__(true);"
@@ -2541,22 +2541,22 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
if (style == "Concurrent") {
out << indent() << " sentry.commit();" << endl;
}
- out <<
- indent() << " throw x;" << endl <<
- indent() << "}" << endl <<
- indent() << "if (mtype != ::apache::thrift::protocol::T_REPLY) {" << endl <<
- indent() << " " << _this << "iprot_->skip(" << "::apache::thrift::protocol::T_STRUCT);" << endl <<
- indent() << " " << _this << "iprot_->readMessageEnd();" << endl <<
+ out <<
+ indent() << " throw x;" << endl <<
+ indent() << "}" << endl <<
+ indent() << "if (mtype != ::apache::thrift::protocol::T_REPLY) {" << endl <<
+ indent() << " " << _this << "iprot_->skip(" << "::apache::thrift::protocol::T_STRUCT);" << endl <<
+ indent() << " " << _this << "iprot_->readMessageEnd();" << endl <<
indent() << " " << _this << "iprot_->getTransport()->readEnd();" << endl;
if (style == "Cob" && !gen_no_client_completion_) {
out << indent() << " completed = true;" << endl << indent() << " completed__(false);"
<< endl;
}
- out <<
- indent() << "}" << endl <<
- indent() << "if (fname.compare(\"" << (*f_iter)->get_name() << "\") != 0) {" << endl <<
- indent() << " " << _this << "iprot_->skip(" << "::apache::thrift::protocol::T_STRUCT);" << endl <<
- indent() << " " << _this << "iprot_->readMessageEnd();" << endl <<
+ out <<
+ indent() << "}" << endl <<
+ indent() << "if (fname.compare(\"" << (*f_iter)->get_name() << "\") != 0) {" << endl <<
+ indent() << " " << _this << "iprot_->skip(" << "::apache::thrift::protocol::T_STRUCT);" << endl <<
+ indent() << " " << _this << "iprot_->readMessageEnd();" << endl <<
indent() << " " << _this << "iprot_->getTransport()->readEnd();" << endl;
if (style == "Cob" && !gen_no_client_completion_) {
out << indent() << " completed = true;" << endl << indent() << " completed__(false);"
@@ -2589,7 +2589,7 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
// Careful, only look for _result if not a void function
if (!(*f_iter)->get_returntype()->is_void()) {
if (is_complex_type((*f_iter)->get_returntype())) {
- out <<
+ out <<
indent() << "if (result.__isset.success) {" << endl;
out <<
indent() << " // _return pointer has now been filled" << endl;
@@ -2600,8 +2600,8 @@ void t_cpp_generator::generate_service_client(t_service* tservice, string style)
if (style == "Concurrent") {
out << indent() << " sentry.commit();" << endl;
}
- out <<
- indent() << " return;" << endl <<
+ out <<
+ indent() << " return;" << endl <<
indent() << "}" << endl;
} else {
out << indent() << "if (result.__isset.success) {" << endl;
diff --git a/compiler/cpp/src/generate/t_csharp_generator.cc b/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
index d356f2616..ae3c48b08 100644
--- a/compiler/cpp/src/generate/t_csharp_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
@@ -33,8 +33,8 @@
#include <sys/stat.h>
#include <sstream>
-#include "platform.h"
-#include "t_oop_generator.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -83,7 +83,7 @@ public:
wcf_ = true;
wcf_namespace_ = iter->second;
} else {
- throw "unknown option csharp:" + iter->first;
+ throw "unknown option csharp:" + iter->first;
}
}
@@ -268,7 +268,7 @@ void t_csharp_generator::init_generator() {
namespace_dir_ = subdir;
init_keywords();
-
+
while( ! member_mapping_scopes.empty()) {
cleanup_member_name_mapping( member_mapping_scopes.back().scope_member);
}
@@ -1005,7 +1005,7 @@ void t_csharp_generator::generate_csharp_struct_reader(ofstream& out, t_struct*
void t_csharp_generator::generate_csharp_struct_writer(ofstream& out, t_struct* tstruct) {
out << indent() << "public void Write(TProtocol oprot) {" << endl;
indent_up();
-
+
out << indent() << "oprot.IncrementRecursionDepth();" << endl;
out << indent() << "try" << endl;
scope_up(out);
@@ -1061,7 +1061,7 @@ void t_csharp_generator::generate_csharp_struct_writer(ofstream& out, t_struct*
scope_down(out);
indent_down();
-
+
indent(out) << "}" << endl << endl;
}
@@ -2857,7 +2857,7 @@ void t_csharp_generator::cleanup_member_name_mapping(void* scope) {
if( member_mapping_scopes.empty()) {
throw "internal error: cleanup_member_name_mapping() no scope active";
}
-
+
member_mapping_scope& active = member_mapping_scopes.back();
if (active.scope_member != scope) {
throw "internal error: cleanup_member_name_mapping() called for wrong struct";
@@ -2874,7 +2874,7 @@ string t_csharp_generator::get_mapped_member_name(string name) {
return iter->second;
}
}
-
+
pverbose("no mapping for member %s\n", name.c_str());
return name;
}
diff --git a/compiler/cpp/src/generate/t_d_generator.cc b/compiler/cpp/src/thrift/generate/t_d_generator.cc
index 1e0af7d51..481668146 100644
--- a/compiler/cpp/src/generate/t_d_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_d_generator.cc
@@ -32,8 +32,8 @@
#include <sys/stat.h>
-#include "platform.h"
-#include "t_oop_generator.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -64,7 +64,7 @@ public:
/* no options yet */
for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
- throw "unknown option d:" + iter->first;
+ throw "unknown option d:" + iter->first;
}
out_dir_base_ = "gen-d";
diff --git a/compiler/cpp/src/generate/t_dart_generator.cc b/compiler/cpp/src/thrift/generate/t_dart_generator.cc
index 7a744cf47..19bbb7b2f 100644
--- a/compiler/cpp/src/generate/t_dart_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_dart_generator.cc
@@ -27,8 +27,8 @@
#include <sys/stat.h>
#include <stdexcept>
-#include "platform.h"
-#include "t_oop_generator.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
diff --git a/compiler/cpp/src/generate/t_delphi_generator.cc b/compiler/cpp/src/thrift/generate/t_delphi_generator.cc
index fece1da96..8b1a44520 100644
--- a/compiler/cpp/src/generate/t_delphi_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_delphi_generator.cc
@@ -34,8 +34,8 @@
#include <sstream>
#include <cctype>
-#include "platform.h"
-#include "t_oop_generator.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -77,7 +77,7 @@ public:
} else if( iter->first.compare("xmldoc") == 0) {
xmldoc_ = true;
} else {
- throw "unknown option delphi:" + iter->first;
+ throw "unknown option delphi:" + iter->first;
}
}
@@ -3601,7 +3601,7 @@ void t_delphi_generator::generate_delphi_struct_reader_impl(ostream& out,
indent_impl(code_block) << "if not _req_isset_" << prop_name(*f_iter, is_exception) << endl;
indent_impl(code_block)
<< "then raise TProtocolExceptionInvalidData.Create("
- << "'required field " << prop_name(*f_iter, is_exception) << " not set');"
+ << "'required field " << prop_name(*f_iter, is_exception) << " not set');"
<< endl;
}
}
@@ -3641,7 +3641,7 @@ void t_delphi_generator::generate_delphi_struct_result_writer_impl(ostream& out,
indent_impl(local_vars) << "tracker : IProtocolRecursionTracker;" << endl;
indent_impl(code_block) << "tracker := oprot.NextRecursionLevel;" << endl;
-
+
indent_impl(code_block) << "struc := TStructImpl.Create('" << name << "');" << endl;
indent_impl(code_block) << "oprot.WriteStructBegin(struc);" << endl;
@@ -3722,7 +3722,7 @@ void t_delphi_generator::generate_delphi_struct_writer_impl(ostream& out,
null_allowed = false;
indent_impl(code_block) << "if (" << fieldname << " = nil)" << endl;
indent_impl(code_block) << "then raise TProtocolExceptionInvalidData.Create("
- << "'required field " << fieldname << " not set');"
+ << "'required field " << fieldname << " not set');"
<< endl;
}
if (null_allowed) {
diff --git a/compiler/cpp/src/generate/t_erl_generator.cc b/compiler/cpp/src/thrift/generate/t_erl_generator.cc
index 9ac908cbc..48694144a 100644
--- a/compiler/cpp/src/generate/t_erl_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_erl_generator.cc
@@ -26,9 +26,9 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sstream>
-#include "t_generator.h"
-#include "platform.h"
-#include "version.h"
+#include "thrift/platform.h"
+#include "thrift/version.h"
+#include "thrift/generate/t_generator.h"
using std::map;
using std::ofstream;
diff --git a/compiler/cpp/src/generate/t_generator.cc b/compiler/cpp/src/thrift/generate/t_generator.cc
index 7f5daf442..0c1f49daf 100644
--- a/compiler/cpp/src/generate/t_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_generator.cc
@@ -17,7 +17,7 @@
* under the License.
*/
-#include "t_generator.h"
+#include "thrift/generate/t_generator.h"
using namespace std;
/**
diff --git a/compiler/cpp/src/generate/t_generator.h b/compiler/cpp/src/thrift/generate/t_generator.h
index 590efdbae..051bbc423 100644
--- a/compiler/cpp/src/generate/t_generator.h
+++ b/compiler/cpp/src/thrift/generate/t_generator.h
@@ -24,10 +24,10 @@
#include <iostream>
#include <fstream>
#include <sstream>
-#include "parse/t_program.h"
-#include "common.h"
-#include "t_generator_registry.h"
-#include "version.h"
+#include "thrift/common.h"
+#include "thrift/version.h"
+#include "thrift/generate/t_generator_registry.h"
+#include "thrift/parse/t_program.h"
/**
* Base class for a thrift code generator. This class defines the basic
diff --git a/compiler/cpp/src/generate/t_generator_registry.h b/compiler/cpp/src/thrift/generate/t_generator_registry.h
index 1f02167bc..1f02167bc 100644
--- a/compiler/cpp/src/generate/t_generator_registry.h
+++ b/compiler/cpp/src/thrift/generate/t_generator_registry.h
diff --git a/compiler/cpp/src/generate/t_go_generator.cc b/compiler/cpp/src/thrift/generate/t_go_generator.cc
index b9429c182..9919cb1ee 100644
--- a/compiler/cpp/src/generate/t_go_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_go_generator.cc
@@ -36,9 +36,9 @@
#include <sstream>
#include <algorithm>
#include <clocale>
-#include "t_generator.h"
-#include "platform.h"
-#include "version.h"
+#include "thrift/platform.h"
+#include "thrift/version.h"
+#include "thrift/generate/t_generator.h"
using std::map;
using std::ofstream;
@@ -93,7 +93,7 @@ public:
} else if( iter->first.compare("ignore_initialisms") == 0) {
ignore_initialisms_ = true;
} else {
- throw "unknown option go:" + iter->first;
+ throw "unknown option go:" + iter->first;
}
}
@@ -3463,8 +3463,8 @@ string t_go_generator::module_name(t_type* ttype) {
t_program* program = ttype->get_program();
if (program != NULL && program != program_) {
- if (program->get_namespace("go").empty() ||
- program_->get_namespace("go").empty() ||
+ if (program->get_namespace("go").empty() ||
+ program_->get_namespace("go").empty() ||
program->get_namespace("go") != program_->get_namespace("go")) {
string module(get_real_go_module(program));
// for namespaced includes, only keep part after dot.
diff --git a/compiler/cpp/src/generate/t_gv_generator.cc b/compiler/cpp/src/thrift/generate/t_gv_generator.cc
index 61be8e686..72b7c822b 100644
--- a/compiler/cpp/src/generate/t_gv_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_gv_generator.cc
@@ -27,8 +27,8 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sstream>
-#include "t_generator.h"
-#include "platform.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_generator.h"
using std::map;
using std::ofstream;
@@ -57,7 +57,7 @@ public:
if( iter->first.compare("exceptions") == 0) {
exception_arrows = true;
} else {
- throw "unknown option gv:" + iter->first;
+ throw "unknown option gv:" + iter->first;
}
}
diff --git a/compiler/cpp/src/generate/t_haxe_generator.cc b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
index d15958e59..e7be1a5b3 100644
--- a/compiler/cpp/src/generate/t_haxe_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
@@ -27,8 +27,8 @@
#include <sys/stat.h>
#include <stdexcept>
-#include "platform.h"
-#include "t_oop_generator.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -63,7 +63,7 @@ public:
} else if( iter->first.compare("buildmacro") == 0) {
buildmacro_ = (iter->second);
} else {
- throw "unknown option haxe:" + iter->first;
+ throw "unknown option haxe:" + iter->first;
}
}
@@ -1007,10 +1007,10 @@ void t_haxe_generator::generate_haxe_struct_writer(ofstream& out, t_struct* tstr
indent(out) << "}" << endl;
}
}
-
+
indent(out) << "oprot.writeFieldStop();" << endl;
indent(out) << "oprot.writeStructEnd();" << endl;
-
+
indent(out) << "oprot.DecrementRecursionDepth();" << endl;
scope_down(out);
indent(out) << "catch(e:Dynamic)" << endl;
@@ -1018,7 +1018,7 @@ void t_haxe_generator::generate_haxe_struct_writer(ofstream& out, t_struct* tstr
indent(out) << "oprot.DecrementRecursionDepth();" << endl;
indent(out) << "throw e;" << endl;
scope_down(out);
-
+
indent_down();
out << indent() << "}" << endl << endl;
}
@@ -1042,7 +1042,7 @@ void t_haxe_generator::generate_haxe_struct_result_writer(ofstream& out, t_struc
indent(out) << "oprot.IncrementRecursionDepth();" << endl;
indent(out) << "try" << endl;
scope_up(out);
-
+
indent(out) << "oprot.writeStructBegin(STRUCT_DESC);" << endl;
bool first = true;
@@ -1070,11 +1070,11 @@ void t_haxe_generator::generate_haxe_struct_result_writer(ofstream& out, t_struc
indent_down();
indent(out) << "}";
}
-
+
indent(out) << endl;
indent(out) << "oprot.writeFieldStop();" << endl;
indent(out) << "oprot.writeStructEnd();" << endl;
-
+
indent(out) << "oprot.DecrementRecursionDepth();" << endl;
scope_down(out);
indent(out) << "catch(e:Dynamic)" << endl;
@@ -1082,7 +1082,7 @@ void t_haxe_generator::generate_haxe_struct_result_writer(ofstream& out, t_struc
indent(out) << "oprot.DecrementRecursionDepth();" << endl;
indent(out) << "throw e;" << endl;
scope_down(out);
-
+
indent_down();
out << indent() << "}" << endl << endl;
}
diff --git a/compiler/cpp/src/generate/t_hs_generator.cc b/compiler/cpp/src/thrift/generate/t_hs_generator.cc
index cef8cd010..a3ccd8d4b 100644
--- a/compiler/cpp/src/generate/t_hs_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_hs_generator.cc
@@ -27,10 +27,10 @@
#include <sys/types.h>
#include <sstream>
-#include "t_oop_generator.h"
+#include "thrift/platform.h"
+#include "thrift/version.h"
-#include "platform.h"
-#include "version.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -56,7 +56,7 @@ public:
/* no options yet */
for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
- throw "unknown option hs:" + iter->first;
+ throw "unknown option hs:" + iter->first;
}
out_dir_base_ = "gen-hs";
diff --git a/compiler/cpp/src/generate/t_html_generator.cc b/compiler/cpp/src/thrift/generate/t_html_generator.cc
index 9594d390f..ec78e1023 100644
--- a/compiler/cpp/src/generate/t_html_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_html_generator.cc
@@ -26,9 +26,9 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sstream>
-#include "t_generator.h"
-#include "t_html_generator.h"
-#include "platform.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_generator.h"
+#include "thrift/generate/t_html_generator.h"
using std::map;
using std::ofstream;
@@ -64,7 +64,7 @@ public:
} else if( iter->first.compare("noescape") == 0) {
unsafe_ = true;
} else {
- throw "unknown option html:" + iter->first;
+ throw "unknown option html:" + iter->first;
}
}
diff --git a/compiler/cpp/src/generate/t_html_generator.h b/compiler/cpp/src/thrift/generate/t_html_generator.h
index 600b17f17..600b17f17 100644
--- a/compiler/cpp/src/generate/t_html_generator.h
+++ b/compiler/cpp/src/thrift/generate/t_html_generator.h
diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/thrift/generate/t_java_generator.cc
index 2db8cb821..8b3c32626 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_java_generator.cc
@@ -31,8 +31,8 @@
#include <sys/stat.h>
#include <stdexcept>
-#include "platform.h"
-#include "t_oop_generator.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -97,10 +97,10 @@ public:
} else if(iter->second.compare("suppress") == 0) {
suppress_generated_annotations_ = true;
} else {
- throw "unknown option java:" + iter->first + "=" + iter->second;
+ throw "unknown option java:" + iter->first + "=" + iter->second;
}
} else {
- throw "unknown option java:" + iter->first;
+ throw "unknown option java:" + iter->first;
}
}
@@ -368,7 +368,7 @@ private:
bool use_option_type_;
bool undated_generated_annotations_;
bool suppress_generated_annotations_;
-
+
};
/**
diff --git a/compiler/cpp/src/generate/t_javame_generator.cc b/compiler/cpp/src/thrift/generate/t_javame_generator.cc
index e9a206b39..aa7eccf63 100644
--- a/compiler/cpp/src/generate/t_javame_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_javame_generator.cc
@@ -27,8 +27,8 @@
#include <sys/stat.h>
#include <stdexcept>
-#include "platform.h"
-#include "t_oop_generator.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -55,7 +55,7 @@ public:
/* no options yet */
for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
- throw "unknown option javame:" + iter->first;
+ throw "unknown option javame:" + iter->first;
}
out_dir_base_ = "gen-javame";
diff --git a/compiler/cpp/src/generate/t_js_generator.cc b/compiler/cpp/src/thrift/generate/t_js_generator.cc
index af0f28426..b0046a0da 100644
--- a/compiler/cpp/src/generate/t_js_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_js_generator.cc
@@ -28,8 +28,8 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sstream>
-#include "platform.h"
-#include "version.h"
+#include "thrift/platform.h"
+#include "thrift/version.h"
using std::map;
using std::ofstream;
@@ -40,7 +40,7 @@ using std::vector;
static const string endl = "\n"; // avoid ostream << std::endl flushes
-#include "t_oop_generator.h"
+#include "thrift/generate/t_oop_generator.h"
/**
@@ -66,7 +66,7 @@ public:
} else if( iter->first.compare("ts") == 0) {
gen_ts_ = true;
} else {
- throw "unknown option js:" + iter->first;
+ throw "unknown option js:" + iter->first;
}
}
diff --git a/compiler/cpp/src/generate/t_json_generator.cc b/compiler/cpp/src/thrift/generate/t_json_generator.cc
index 447bc6d00..36e921669 100644
--- a/compiler/cpp/src/generate/t_json_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_json_generator.cc
@@ -30,8 +30,8 @@
#include <sys/stat.h>
#include <sstream>
-#include "t_generator.h"
-#include "platform.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_generator.h"
using std::map;
using std::ofstream;
@@ -61,7 +61,7 @@ public:
if( iter->first.compare("merge") == 0) {
should_merge_includes_ = true;
} else {
- throw "unknown option json:" + iter->first;
+ throw "unknown option json:" + iter->first;
}
}
diff --git a/compiler/cpp/src/generate/t_lua_generator.cc b/compiler/cpp/src/thrift/generate/t_lua_generator.cc
index c6fb4934e..97b8aa3ef 100644
--- a/compiler/cpp/src/generate/t_lua_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_lua_generator.cc
@@ -18,8 +18,8 @@
*/
#include <sstream>
-#include "t_oop_generator.h"
-#include "platform.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::ofstream;
using std::string;
@@ -46,7 +46,7 @@ public:
if( iter->first.compare("omit_requires") == 0) {
gen_requires_ = false;
} else {
- throw "unknown option lua:" + iter->first;
+ throw "unknown option lua:" + iter->first;
}
}
diff --git a/compiler/cpp/src/generate/t_ocaml_generator.cc b/compiler/cpp/src/thrift/generate/t_ocaml_generator.cc
index fc82ebca4..594219ae5 100644
--- a/compiler/cpp/src/generate/t_ocaml_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_ocaml_generator.cc
@@ -26,9 +26,9 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sstream>
-#include "t_oop_generator.h"
-#include "platform.h"
-#include "version.h"
+#include "thrift/platform.h"
+#include "thrift/version.h"
+#include "thrift/generate/t_oop_generator.h"
using std::ios;
using std::map;
@@ -55,7 +55,7 @@ public:
/* no options yet */
for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
- throw "unknown option ocaml:" + iter->first;
+ throw "unknown option ocaml:" + iter->first;
}
out_dir_base_ = "gen-ocaml";
diff --git a/compiler/cpp/src/generate/t_oop_generator.h b/compiler/cpp/src/thrift/generate/t_oop_generator.h
index e5a469842..8fb580dfd 100644
--- a/compiler/cpp/src/generate/t_oop_generator.h
+++ b/compiler/cpp/src/thrift/generate/t_oop_generator.h
@@ -23,8 +23,8 @@
#include <string>
#include <iostream>
-#include "common.h"
-#include "t_generator.h"
+#include "thrift/common.h"
+#include "thrift/generate/t_generator.h"
#include <algorithm>
diff --git a/compiler/cpp/src/generate/t_perl_generator.cc b/compiler/cpp/src/thrift/generate/t_perl_generator.cc
index 45cfe4bec..bfe08f9f4 100644
--- a/compiler/cpp/src/generate/t_perl_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_perl_generator.cc
@@ -26,9 +26,9 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sstream>
-#include "t_oop_generator.h"
-#include "platform.h"
-#include "version.h"
+#include "thrift/platform.h"
+#include "thrift/version.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -54,7 +54,7 @@ public:
/* no options yet */
for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
- throw "unknown option perl:" + iter->first;
+ throw "unknown option perl:" + iter->first;
}
out_dir_base_ = "gen-perl";
diff --git a/compiler/cpp/src/generate/t_php_generator.cc b/compiler/cpp/src/thrift/generate/t_php_generator.cc
index 2fa9b24d8..ba5278101 100644
--- a/compiler/cpp/src/generate/t_php_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_php_generator.cc
@@ -25,8 +25,8 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sstream>
-#include "t_oop_generator.h"
-#include "platform.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
diff --git a/compiler/cpp/src/generate/t_py_generator.cc b/compiler/cpp/src/thrift/generate/t_py_generator.cc
index 1ee0fcb62..6401c283f 100644
--- a/compiler/cpp/src/generate/t_py_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_py_generator.cc
@@ -27,9 +27,9 @@
#include <sys/types.h>
#include <sstream>
#include <algorithm>
-#include "t_generator.h"
-#include "platform.h"
-#include "version.h"
+#include "thrift/platform.h"
+#include "thrift/version.h"
+#include "thrift/generate/t_generator.h"
using std::map;
using std::ofstream;
@@ -112,7 +112,7 @@ public:
} else if( iter->first.compare("coding") == 0) {
coding_ = iter->second;
} else {
- throw "unknown option py:" + iter->first;
+ throw "unknown option py:" + iter->first;
}
}
diff --git a/compiler/cpp/src/generate/t_rb_generator.cc b/compiler/cpp/src/thrift/generate/t_rb_generator.cc
index abd3320f8..924f6f6eb 100644
--- a/compiler/cpp/src/generate/t_rb_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_rb_generator.cc
@@ -32,9 +32,9 @@
#include <sys/types.h>
#include <sstream>
-#include "t_oop_generator.h"
-#include "platform.h"
-#include "version.h"
+#include "thrift/platform.h"
+#include "thrift/version.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -91,7 +91,7 @@ public:
} else if( iter->first.compare("namespaced") == 0) {
namespaced_ = true;
} else {
- throw "unknown option ruby:" + iter->first;
+ throw "unknown option ruby:" + iter->first;
}
}
diff --git a/compiler/cpp/src/generate/t_st_generator.cc b/compiler/cpp/src/thrift/generate/t_st_generator.cc
index bc15d24f3..ffd731820 100644
--- a/compiler/cpp/src/generate/t_st_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_st_generator.cc
@@ -32,9 +32,9 @@
#include <sys/types.h>
#include <sstream>
-#include "platform.h"
-#include "t_oop_generator.h"
-#include "version.h"
+#include "thrift/platform.h"
+#include "thrift/version.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ofstream;
@@ -60,7 +60,7 @@ public:
/* no options yet */
for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
- throw "unknown option st:" + iter->first;
+ throw "unknown option st:" + iter->first;
}
out_dir_base_ = "gen-st";
diff --git a/compiler/cpp/src/generate/t_swift_generator.cc b/compiler/cpp/src/thrift/generate/t_swift_generator.cc
index 6e48bca62..87dd2f020 100644
--- a/compiler/cpp/src/generate/t_swift_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_swift_generator.cc
@@ -26,8 +26,8 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sstream>
-#include "t_oop_generator.h"
-#include "platform.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_oop_generator.h"
using std::map;
using std::ostream;
@@ -69,7 +69,7 @@ public:
} else if( iter->first.compare("debug_descriptions") == 0) {
debug_descriptions_ = true;
} else {
- throw "unknown option swift:" + iter->first;
+ throw "unknown option swift:" + iter->first;
}
}
@@ -112,7 +112,7 @@ public:
t_struct* tstruct,
bool all,
bool is_private);
-
+
void generate_swift_struct_implementation(ofstream& out,
t_struct* tstruct,
bool is_result,
@@ -183,23 +183,23 @@ public:
void populate_reserved_words();
private:
-
+
void block_open(ostream& out) {
out << " {" << endl;
indent_up();
}
-
+
void block_close(ostream& out, bool end_line=true) {
indent_down();
indent(out) << "}";
if (end_line) out << endl;
}
-
+
bool field_is_optional(t_field* tfield) {
return tfield->get_req() == t_field::T_OPTIONAL;
}
-
+
bool struct_has_required_fields(t_struct* tstruct) {
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
@@ -210,7 +210,7 @@ private:
}
return false;
}
-
+
bool struct_has_optional_fields(t_struct* tstruct) {
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
@@ -221,7 +221,7 @@ private:
}
return false;
}
-
+
string constants_declarations_;
/**
@@ -278,16 +278,16 @@ string t_swift_generator::swift_imports() {
vector<string> includes_list;
includes_list.push_back("Foundation");
-
+
ostringstream includes;
-
+
vector<string>::const_iterator i_iter;
for (i_iter=includes_list.begin(); i_iter!=includes_list.end(); ++i_iter) {
includes << "import " << *i_iter << endl;
}
-
+
includes << endl;
-
+
return includes.str();
}
@@ -300,7 +300,7 @@ string t_swift_generator::swift_thrift_imports() {
vector<string> includes_list;
includes_list.push_back("Thrift");
-
+
if (promise_kit_) {
includes_list.push_back("PromiseKit");
}
@@ -311,7 +311,7 @@ string t_swift_generator::swift_thrift_imports() {
for (i_iter=includes_list.begin(); i_iter!=includes_list.end(); ++i_iter) {
includes << "import " << *i_iter << endl;
}
-
+
includes << endl;
return includes.str();
@@ -358,15 +358,15 @@ void t_swift_generator::generate_enum(t_enum* tenum) {
f_decl_ << endl;
f_decl_ << indent() << "public init() { self.init(rawValue: " << constants.front()->get_value() << ")! }" << endl;
-
+
block_close(f_decl_);
f_decl_ << endl;
-
+
f_impl_ << indent() << "extension " << tenum->get_name() << " : TEnum";
block_open(f_impl_);
f_impl_ << endl;
-
+
f_impl_ << indent() << "public static func readValueFromProtocol(proto: TProtocol) throws -> " << tenum->get_name();
block_open(f_impl_);
f_impl_ << indent() << "var raw = Int32()" << endl
@@ -374,20 +374,20 @@ void t_swift_generator::generate_enum(t_enum* tenum) {
<< indent() << "return " << tenum->get_name() << "(rawValue: raw)!" << endl;
block_close(f_impl_);
f_impl_ << endl;
-
+
f_impl_ << indent() << "public static func writeValue(value: " << tenum->get_name() << ", toProtocol proto: TProtocol) throws";
block_open(f_impl_);
f_impl_ << indent() << "try proto.writeI32(value.rawValue)" << endl;
block_close(f_impl_);
f_impl_ << endl;
-
+
block_close(f_impl_);
f_impl_ << endl;
}
/**
* Generates public constants for all Thrift constants.
- *
+ *
* @param consts Constants to generate
*/
void t_swift_generator::generate_consts(vector<t_const*> consts) {
@@ -402,10 +402,10 @@ void t_swift_generator::generate_consts(vector<t_const*> consts) {
render_const_value(const_interface, type, (*c_iter)->get_value());
const_interface << endl << endl;
}
-
+
// this gets spit into the header file in ::close_generator
constants_declarations_ = const_interface.str();
-
+
}
/**
@@ -413,7 +413,7 @@ void t_swift_generator::generate_consts(vector<t_const*> consts) {
* with public members. Optional types are used for optional properties to
* allow them to be tested for availability. Separate inits are included for
* required properties & all properties.
- *
+ *
* Generates extensions to provide conformance to TStruct, TSerializable,
* Hashable & Equatable
*
@@ -435,7 +435,7 @@ void t_swift_generator::generate_xception(t_struct* txception) {
}
/**
- * Generate the interface for a struct. Only properties and
+ * Generate the interface for a struct. Only properties and
* init methods are included.
*
* @param tstruct The struct definition
@@ -445,36 +445,36 @@ void t_swift_generator::generate_xception(t_struct* txception) {
void t_swift_generator::generate_swift_struct(ofstream& out,
t_struct* tstruct,
bool is_private) {
-
+
string visibility = is_private ? "private" : "public";
-
+
out << indent() << visibility << " final class " << tstruct->get_name();
if (tstruct->is_xception()) {
out << " : ErrorType";
}
-
+
block_open(out);
// properties
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
-
+
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
out << endl;
out << indent() << declare_property(*m_iter, is_private) << endl;
}
-
+
out << endl;
-
+
// init
-
+
indent(out) << visibility << " init()";
block_open(out);
block_close(out);
-
+
out << endl;
-
+
if (struct_has_required_fields(tstruct)) {
generate_swift_struct_init(out, tstruct, false, is_private);
}
@@ -483,7 +483,7 @@ void t_swift_generator::generate_swift_struct(ofstream& out,
}
block_close(out);
-
+
out << endl;
}
@@ -506,7 +506,7 @@ void t_swift_generator::generate_swift_struct_init(ofstream& out,
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
-
+
bool first=true;
for (m_iter = members.begin(); m_iter != members.end();) {
if (all || !field_is_optional(*m_iter)) {
@@ -522,18 +522,18 @@ void t_swift_generator::generate_swift_struct_init(ofstream& out,
++m_iter;
}
out << ")";
-
+
block_open(out);
-
+
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
if (all || (*m_iter)->get_req() == t_field::T_REQUIRED || (*m_iter)->get_req() == t_field::T_OPT_IN_REQ_OUT) {
out << indent() << "self." << maybe_escape_identifier((*m_iter)->get_name()) << " = "
<< maybe_escape_identifier((*m_iter)->get_name()) << endl;
}
}
-
+
block_close(out);
-
+
out << endl;
}
@@ -551,23 +551,23 @@ void t_swift_generator::generate_swift_struct_hashable_extension(ofstream& out,
string visibility = is_private ? "private" : "public";
indent(out) << "extension " << tstruct->get_name() << " : Hashable";
-
+
block_open(out);
-
+
out << endl;
-
+
indent(out) << visibility << " var hashValue : Int";
-
+
block_open(out);
-
-
+
+
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
if (!members.empty()) {
indent(out) << "let prime = 31" << endl;
indent(out) << "var result = 1" << endl;
-
+
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
t_field* tfield = *m_iter;
string accessor = field_is_optional(tfield) ? "?." : ".";
@@ -575,7 +575,7 @@ void t_swift_generator::generate_swift_struct_hashable_extension(ofstream& out,
indent(out) << "result = prime &* result &+ (" << maybe_escape_identifier(tfield->get_name()) << accessor
<< "hashValue" << defaultor << ")" << endl;
}
-
+
indent(out) << "return result" << endl;
}
else {
@@ -583,9 +583,9 @@ void t_swift_generator::generate_swift_struct_hashable_extension(ofstream& out,
}
block_close(out);
-
+
out << endl;
-
+
block_close(out);
out << endl;
@@ -603,22 +603,22 @@ void t_swift_generator::generate_swift_struct_equatable_extension(ofstream& out,
bool is_private) {
string visibility = is_private ? "private" : "public";
-
+
indent(out) << visibility << " func ==(lhs: " << type_name(tstruct) << ", rhs: " << type_name(tstruct) << ") -> Bool";
-
+
block_open(out);
-
+
indent(out) << "return";
-
+
const vector<t_field*>& members = tstruct->get_members();
vector<t_field*>::const_iterator m_iter;
if (members.size()) {
-
+
out << endl;
-
+
indent_up();
-
+
for (m_iter = members.begin(); m_iter != members.end();) {
t_field* tfield = *m_iter;
indent(out) << "(lhs." << maybe_escape_identifier(tfield->get_name())
@@ -628,16 +628,16 @@ void t_swift_generator::generate_swift_struct_equatable_extension(ofstream& out,
}
out << endl;
}
-
+
indent_down();
-
+
}
else {
out << " true" << endl;
}
-
+
block_close(out);
-
+
out << endl;
}
@@ -655,13 +655,13 @@ void t_swift_generator::generate_swift_struct_implementation(ofstream& out,
t_struct* tstruct,
bool is_result,
bool is_private) {
-
+
generate_swift_struct_equatable_extension(out, tstruct, is_private);
-
+
if (!is_private && !is_result) {
generate_swift_struct_printable_extension(out, tstruct);
}
-
+
generate_swift_struct_hashable_extension(out, tstruct, is_private);
generate_swift_struct_thrift_extension(out, tstruct, is_result, is_private);
@@ -681,24 +681,24 @@ void t_swift_generator::generate_swift_struct_thrift_extension(ofstream& out,
t_struct* tstruct,
bool is_result,
bool is_private) {
-
+
indent(out) << "extension " << tstruct->get_name() << " : TStruct";
-
+
block_open(out);
-
+
out << endl;
-
+
generate_swift_struct_reader(out, tstruct, is_private);
-
+
if (is_result) {
generate_swift_struct_result_writer(out, tstruct);
}
else {
generate_swift_struct_writer(out, tstruct, is_private);
}
-
+
block_close(out);
-
+
out << endl;
}
@@ -713,46 +713,46 @@ void t_swift_generator::generate_swift_struct_thrift_extension(ofstream& out,
void t_swift_generator::generate_swift_struct_reader(ofstream& out,
t_struct* tstruct,
bool is_private) {
-
+
string visibility = is_private ? "private" : "public";
-
+
indent(out) << visibility << " static func readValueFromProtocol(__proto: TProtocol) throws -> "
<< tstruct->get_name();
-
+
block_open(out);
-
+
out << endl;
-
+
indent(out) << "try __proto.readStructBegin()" << endl << endl;
const vector<t_field*>& fields = tstruct->get_members();
vector<t_field*>::const_iterator f_iter;
-
+
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
bool optional = field_is_optional(*f_iter);
indent(out) << "var " << maybe_escape_identifier((*f_iter)->get_name()) << " : "
<< type_name((*f_iter)->get_type(), optional, !optional) << endl;
}
-
+
out << endl;
-
+
// Loop over reading in fields
indent(out) << "fields: while true";
-
+
block_open(out);
-
+
out << endl;
indent(out) << "let (_, fieldType, fieldID) = try __proto.readFieldBegin()" << endl << endl;
indent(out) << "switch (fieldID, fieldType)";
-
+
block_open(out);
-
+
indent(out) << "case (_, .STOP):" << endl;
indent_up();
indent(out) << "break fields" << endl << endl;
indent_down();
-
+
// Generate deserialization code for known cases
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
@@ -761,33 +761,33 @@ void t_swift_generator::generate_swift_struct_reader(ofstream& out,
indent(out) << maybe_escape_identifier((*f_iter)->get_name()) << " = try __proto.readValue() as "
<< type_name((*f_iter)->get_type()) << endl << endl;
indent_down();
-
+
}
indent(out) << "case let (_, unknownType):" << endl;
indent_up();
indent(out) << "try __proto.skipType(unknownType)" << endl;
indent_down();
-
+
block_close(out);
-
+
out << endl;
// Read field end marker
indent(out) << "try __proto.readFieldEnd()" << endl;
-
+
block_close(out);
out << endl;
-
+
indent(out) << "try __proto.readStructEnd()" << endl;
out << endl;
-
+
if (struct_has_required_fields(tstruct)) {
// performs various checks (e.g. check that all required fields are set)
indent(out) << "// Required fields" << endl;
-
+
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
if (field_is_optional(*f_iter)) {
continue;
@@ -796,9 +796,9 @@ void t_swift_generator::generate_swift_struct_reader(ofstream& out,
<< "named: \"" << (*f_iter)->get_name() << "\")" << endl;
}
}
-
+
out << endl;
-
+
indent(out) << "return " << tstruct->get_name() << "(";
for (f_iter = fields.begin(); f_iter != fields.end();) {
out << (*f_iter)->get_name() << ": " << maybe_escape_identifier((*f_iter)->get_name());
@@ -824,13 +824,13 @@ void t_swift_generator::generate_swift_struct_reader(ofstream& out,
void t_swift_generator::generate_swift_struct_writer(ofstream& out,
t_struct* tstruct,
bool is_private) {
-
+
string visibility = is_private ? "private" : "public";
-
+
indent(out) << visibility << " static func writeValue(__value: " << tstruct->get_name() << ", toProtocol __proto: TProtocol) throws";
-
+
block_open(out);
-
+
out << endl;
string name = tstruct->get_name();
@@ -838,19 +838,19 @@ void t_swift_generator::generate_swift_struct_writer(ofstream& out,
vector<t_field*>::const_iterator f_iter;
indent(out) << "try __proto.writeStructBeginWithName(\"" << name << "\")" << endl;
-
+
out << endl;
-
+
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
t_field *tfield = *f_iter;
-
+
bool optional = field_is_optional(tfield);
if (optional) {
indent(out) << "if let " << maybe_escape_identifier(tfield->get_name())
<< " = __value." << maybe_escape_identifier(tfield->get_name());
block_open(out);
}
-
+
indent(out) << "try __proto.writeFieldValue("
<< (optional ? "" : "__value.") << maybe_escape_identifier(tfield->get_name()) << ", "
<< "name: \"" << tfield->get_name() << "\", "
@@ -865,7 +865,7 @@ void t_swift_generator::generate_swift_struct_writer(ofstream& out,
}
indent(out) << "try __proto.writeFieldStop()" << endl << endl;
-
+
indent(out) << "try __proto.writeStructEnd()" << endl;
block_close(out);
@@ -883,28 +883,28 @@ void t_swift_generator::generate_swift_struct_writer(ofstream& out,
* @param tstruct The structure definition
*/
void t_swift_generator::generate_swift_struct_result_writer(ofstream& out, t_struct* tstruct) {
-
+
indent(out) << "private static func writeValue(__value: " << tstruct->get_name() << ", toProtocol __proto: TProtocol) throws";
-
+
block_open(out);
-
+
out << endl;
-
+
string name = tstruct->get_name();
const vector<t_field*>& fields = tstruct->get_members();
vector<t_field*>::const_iterator f_iter;
-
+
indent(out) << "try __proto.writeStructBeginWithName(\"" << name << "\")" << endl;
-
+
out << endl;
-
+
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
t_field *tfield = *f_iter;
-
+
indent(out) << "if let result = __value." << (*f_iter)->get_name();
-
+
block_open(out);
-
+
indent(out) << "try __proto.writeFieldValue(result, "
<< "name: \"" << tfield->get_name() << "\", "
<< "type: " << type_to_enum(tfield->get_type()) << ", "
@@ -914,11 +914,11 @@ void t_swift_generator::generate_swift_struct_result_writer(ofstream& out, t_str
}
// Write the struct map
indent(out) << "try __proto.writeFieldStop()" << endl << endl;
-
+
indent(out) << "try __proto.writeStructEnd()" << endl;
block_close(out);
-
+
out << endl;
}
@@ -928,22 +928,22 @@ void t_swift_generator::generate_swift_struct_result_writer(ofstream& out, t_str
* @param tstruct The struct definition
*/
void t_swift_generator::generate_swift_struct_printable_extension(ofstream& out, t_struct* tstruct) {
-
+
// Allow use of debugDescription so the app can add description via a cateogory/extension
indent(out) << "extension " << tstruct->get_name() << " : "
<< (debug_descriptions_ ? "CustomDebugStringConvertible" : "CustomStringConvertible");
block_open(out);
-
+
out << endl;
-
+
indent(out) << "public var description : String";
-
+
block_open(out);
-
+
indent(out) << "var desc = \"" << tstruct->get_name() << "(\"" << endl;
-
+
const vector<t_field*>& fields = tstruct->get_members();
vector<t_field*>::const_iterator f_iter;
@@ -959,11 +959,11 @@ void t_swift_generator::generate_swift_struct_printable_extension(ofstream& out,
indent(out) << "return desc" << endl;
block_close(out);
-
+
out << endl;
-
+
block_close(out);
-
+
out << endl;
}
@@ -975,7 +975,7 @@ void t_swift_generator::generate_swift_struct_printable_extension(ofstream& out,
* @param tservice The service definition
*/
void t_swift_generator::generate_service(t_service* tservice) {
-
+
generate_swift_service_protocol(f_decl_, tservice);
generate_swift_service_client(f_decl_, tservice);
if (async_clients_) {
@@ -985,7 +985,7 @@ void t_swift_generator::generate_service(t_service* tservice) {
generate_swift_service_server(f_decl_, tservice);
generate_swift_service_helpers(tservice);
-
+
generate_swift_service_client_implementation(f_impl_, tservice);
if (async_clients_) {
generate_swift_service_client_async_implementation(f_impl_, tservice);
@@ -1002,11 +1002,11 @@ void t_swift_generator::generate_swift_service_helpers(t_service* tservice) {
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::iterator f_iter;
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-
+
t_struct* ts = (*f_iter)->get_arglist();
-
+
string qname = function_args_helper_struct_type(tservice, *f_iter);
-
+
t_struct qname_ts = t_struct(ts->get_program(), qname);
const vector<t_field*>& members = ts->get_members();
@@ -1014,7 +1014,7 @@ void t_swift_generator::generate_swift_service_helpers(t_service* tservice) {
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
qname_ts.append(*m_iter);
}
-
+
generate_swift_struct(f_impl_, &qname_ts, true);
generate_swift_struct_implementation(f_impl_, &qname_ts, false, true);
generate_function_helpers(tservice, *f_iter);
@@ -1065,7 +1065,7 @@ void t_swift_generator::generate_function_helpers(t_service *tservice, t_functio
// generate the result struct
generate_swift_struct(f_impl_, &result, true);
generate_swift_struct_implementation(f_impl_, &result, true, true);
-
+
for (f_iter = result.get_members().begin(); f_iter != result.get_members().end(); ++f_iter) {
delete *f_iter;
}
@@ -1081,10 +1081,10 @@ void t_swift_generator::generate_swift_service_protocol(ofstream& out, t_service
indent(out) << "public protocol " << tservice->get_name();
block_open(out);
-
+
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::iterator f_iter;
-
+
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
out << endl;
indent(out) << function_signature(*f_iter) << " // exceptions: ";
@@ -1096,9 +1096,9 @@ void t_swift_generator::generate_swift_service_protocol(ofstream& out, t_service
}
out << endl;
}
-
+
block_close(out);
-
+
out << endl;
}
@@ -1108,14 +1108,14 @@ void t_swift_generator::generate_swift_service_protocol(ofstream& out, t_service
* @param tservice The service to generate a protocol definition for
*/
void t_swift_generator::generate_swift_service_protocol_async(ofstream& out, t_service* tservice) {
-
+
indent(out) << "public protocol " << tservice->get_name() << "Async";
block_open(out);
-
+
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::iterator f_iter;
-
+
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
out << endl;
indent(out) << async_function_signature(*f_iter) << endl;
@@ -1124,9 +1124,9 @@ void t_swift_generator::generate_swift_service_protocol_async(ofstream& out, t_s
}
out << endl;
}
-
+
block_close(out);
-
+
out << endl;
}
@@ -1137,43 +1137,43 @@ void t_swift_generator::generate_swift_service_protocol_async(ofstream& out, t_s
*/
void t_swift_generator::generate_swift_service_client(ofstream& out,
t_service* tservice) {
-
+
indent(out) << "public class " << tservice->get_name() << "Client /* : " << tservice->get_name() << " */";
-
+
block_open(out);
-
+
out << endl;
indent(out) << "let __inProtocol : TProtocol" << endl << endl;
-
+
indent(out) << "let __outProtocol : TProtocol" << endl << endl;
-
+
indent(out) << "public init(inoutProtocol: TProtocol)";
-
+
block_open(out);
-
+
indent(out) << "__inProtocol = inoutProtocol" << endl;
-
+
indent(out) << "__outProtocol = inoutProtocol" << endl;
-
+
block_close(out);
-
+
out << endl;
-
+
indent(out) << "public init(inProtocol: TProtocol, outProtocol: TProtocol)";
-
+
block_open(out);
-
+
indent(out) << "__inProtocol = inProtocol" << endl;
-
+
indent(out) << "__outProtocol = outProtocol" << endl;
-
+
block_close(out);
-
+
out << endl;
-
+
block_close(out);
-
+
out << endl;
}
@@ -1184,49 +1184,49 @@ void t_swift_generator::generate_swift_service_client(ofstream& out,
*/
void t_swift_generator::generate_swift_service_client_async(ofstream& out,
t_service* tservice) {
-
+
indent(out) << "public class " << tservice->get_name() << "AsyncClient /* : " << tservice->get_name() << " */";
-
+
block_open(out);
-
+
out << endl;
-
+
indent(out) << "let __protocolFactory : TProtocolFactory" << endl << endl;
-
+
indent(out) << "let __transportFactory : TAsyncTransportFactory" << endl << endl;
-
+
indent(out) << "public init(protocolFactory: TProtocolFactory, transportFactory: TAsyncTransportFactory)";
-
+
block_open(out);
-
+
indent(out) << "__protocolFactory = protocolFactory" << endl;
-
+
indent(out) << "__transportFactory = transportFactory" << endl;
-
+
block_close(out);
-
+
out << endl;
-
+
block_close(out);
-
+
out << endl;
}
/**
- * Generates a service server interface definition. In other words,
+ * Generates a service server interface definition. In other words,
* the TProcess implementation for the service definition.
*
* @param tservice The service to generate a client interface definition for
*/
void t_swift_generator::generate_swift_service_server(ofstream& out,
t_service* tservice) {
-
+
indent(out) << "public class " << tservice->get_name() << "Processor : NSObject /* " << tservice->get_name() << " */";
block_open(out);
-
+
out << endl;
-
+
out << indent() << "typealias ProcessorHandlerDictionary = "
<< "[String: (Int, TProtocol, TProtocol, " << tservice->get_name() << ") throws -> Void]" << endl
<< endl
@@ -1240,7 +1240,7 @@ void t_swift_generator::generate_swift_service_server(ofstream& out,
out << endl;
block_close(out);
-
+
out << endl;
}
@@ -1258,7 +1258,7 @@ void t_swift_generator::generate_swift_service_client_send_function_implementati
t_service *tservice,
t_function* tfunction,
bool needs_protocol) {
-
+
string funname = tfunction->get_name();
t_function send_function(g_type_bool,
@@ -1267,11 +1267,11 @@ void t_swift_generator::generate_swift_service_client_send_function_implementati
string argsname = function_args_helper_struct_type(tservice, tfunction);
t_struct* arg_struct = tfunction->get_arglist();
-
+
// Open function
indent(out) << "private func " << send_function.get_name() << "(" << argument_list(tfunction->get_arglist(), needs_protocol ? "__outProtocol" : "", true) << ") throws";
block_open(out);
-
+
out << endl;
// Serialize the request
@@ -1280,14 +1280,14 @@ void t_swift_generator::generate_swift_service_client_send_function_implementati
<< "sequenceID: 0)" << endl;
out << endl;
-
+
indent(out) << "let __args = " << argsname << "(";
-
+
// write out function parameters
-
+
const vector<t_field*>& fields = arg_struct->get_members();
vector<t_field*>::const_iterator f_iter;
-
+
for (f_iter = fields.begin(); f_iter != fields.end();) {
t_field *tfield = (*f_iter);
out << tfield->get_name() << ": " << tfield->get_name();
@@ -1297,11 +1297,11 @@ void t_swift_generator::generate_swift_service_client_send_function_implementati
}
out << ")" << endl;
indent(out) << "try " << argsname << ".writeValue(__args, toProtocol: __outProtocol)" << endl << endl;
-
+
indent(out) << "try __outProtocol.writeMessageEnd()" << endl;
block_close(out);
-
+
out << endl;
}
@@ -1319,35 +1319,35 @@ void t_swift_generator::generate_swift_service_client_recv_function_implementati
t_service* tservice,
t_function* tfunction,
bool needs_protocol) {
-
+
// Open function
indent(out) << "private func recv_" << tfunction->get_name() << "(";
-
+
if (needs_protocol) {
out << "__inProtocol: TProtocol";
}
-
+
out << ") throws";
-
+
if (!tfunction->get_returntype()->is_void()) {
out << " -> " << type_name(tfunction->get_returntype());
}
-
+
block_open(out);
// check for an exception
-
+
out << endl;
-
+
indent(out) << "try __inProtocol.readResultMessageBegin() " << endl << endl;
-
+
string resultname = function_result_helper_struct_type(tservice, tfunction);
indent(out);
if (!tfunction->get_returntype()->is_void() || !tfunction->get_xceptions()->get_members().empty()) {
out << "let __result = ";
}
out << "try " << resultname << ".readValueFromProtocol(__inProtocol)" << endl << endl;
-
+
indent(out) << "try __inProtocol.readMessageEnd()" << endl << endl;
// Careful, only return _result if not a void function
@@ -1361,7 +1361,7 @@ void t_swift_generator::generate_swift_service_client_recv_function_implementati
t_struct* xs = tfunction->get_xceptions();
const vector<t_field*>& xceptions = xs->get_members();
vector<t_field*>::const_iterator x_iter;
-
+
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
indent(out) << "if let " << (*x_iter)->get_name() << " = __result." << (*x_iter)->get_name();
block_open(out);
@@ -1381,7 +1381,7 @@ void t_swift_generator::generate_swift_service_client_recv_function_implementati
// Close function
block_close(out);
-
+
out << endl;
}
@@ -1393,21 +1393,21 @@ void t_swift_generator::generate_swift_service_client_recv_function_implementati
*/
void t_swift_generator::generate_swift_service_client_send_function_invocation(ofstream& out,
t_function* tfunction) {
-
+
indent(out) << "try send_" << tfunction->get_name() << "(";
-
+
t_struct* arg_struct = tfunction->get_arglist();
-
+
const vector<t_field*>& fields = arg_struct->get_members();
vector<t_field*>::const_iterator f_iter;
-
+
for (f_iter = fields.begin(); f_iter != fields.end();) {
out << (*f_iter)->get_name() << ": " << (*f_iter)->get_name();
if (++f_iter != fields.end()) {
out << ", ";
}
}
-
+
out << ")" << endl;
}
@@ -1419,17 +1419,17 @@ void t_swift_generator::generate_swift_service_client_send_function_invocation(o
*/
void t_swift_generator::generate_swift_service_client_send_async_function_invocation(ofstream& out,
t_function* tfunction) {
-
+
t_struct* arg_struct = tfunction->get_arglist();
const vector<t_field*>& fields = arg_struct->get_members();
vector<t_field*>::const_iterator f_iter;
-
+
indent(out) << "try send_" << tfunction->get_name() << "(__protocol";
-
+
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
out << ", " << (*f_iter)->get_name() << ": " << (*f_iter)->get_name();
}
-
+
out << ")" << endl;
}
@@ -1440,15 +1440,15 @@ void t_swift_generator::generate_swift_service_client_send_async_function_invoca
*/
void t_swift_generator::generate_swift_service_client_implementation(ofstream& out,
t_service* tservice) {
-
+
string name = tservice->get_name() + "Client";
-
+
indent(out) << "extension " << name << " : " << tservice->get_name();
-
+
block_open(out);
-
+
out << endl;
-
+
// generate client method implementations
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::const_iterator f_iter;
@@ -1462,17 +1462,17 @@ void t_swift_generator::generate_swift_service_client_implementation(ofstream& o
// Open function
indent(out) << "public " << function_signature(*f_iter);
-
+
block_open(out);
-
+
out << endl;
-
+
generate_swift_service_client_send_function_invocation(out, *f_iter);
out << endl;
indent(out) << "try __outProtocol.transport().flush()" << endl << endl;
-
+
if (!(*f_iter)->is_oneway()) {
if ((*f_iter)->get_returntype()->is_void()) {
indent(out) << "try recv_" << (*f_iter)->get_name() << "()" << endl;
@@ -1480,14 +1480,14 @@ void t_swift_generator::generate_swift_service_client_implementation(ofstream& o
indent(out) << "return try recv_" << (*f_iter)->get_name() << "()" << endl;
}
}
-
+
block_close(out);
-
+
out << endl;
}
block_close(out);
-
+
out << endl;
}
@@ -1498,16 +1498,16 @@ void t_swift_generator::generate_swift_service_client_implementation(ofstream& o
*/
void t_swift_generator::generate_swift_service_client_async_implementation(ofstream& out,
t_service* tservice) {
-
+
string name = tservice->get_name() + "AsyncClient";
string protocol_name = tservice->get_name() + "Async";
indent(out) << "extension " << name << " : " << protocol_name;
-
+
block_open(out);
-
+
out << endl;
-
+
// generate client method implementations
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::const_iterator f_iter;
@@ -1518,10 +1518,10 @@ void t_swift_generator::generate_swift_service_client_async_implementation(ofstr
if (!(*f_iter)->is_oneway()) {
generate_swift_service_client_recv_function_implementation(out, tservice, *f_iter, true);
}
-
+
indent(out) << "public " << async_function_signature(*f_iter);
block_open(out);
-
+
out << endl;
out << indent() << "let __transport = __transportFactory.newTransport()" << endl
@@ -1529,11 +1529,11 @@ void t_swift_generator::generate_swift_service_client_async_implementation(ofstr
<< endl;
generate_swift_service_client_send_async_function_invocation(out, *f_iter);
-
+
out << endl;
-
+
indent(out) << "__transport.flushWithCompletion(";
-
+
if ((*f_iter)->is_oneway()) {
out << "success, failure: failure)" << endl;
}
@@ -1547,13 +1547,13 @@ void t_swift_generator::generate_swift_service_client_async_implementation(ofstr
out << "let result = ";
}
out << "try self.recv_" << (*f_iter)->get_name() << "(__protocol)" << endl;
-
+
out << indent() << "success(";
if (!(*f_iter)->get_returntype()->is_void()) {
out << "result";
}
out << ")" << endl;
-
+
block_close(out);
indent(out) << "catch let error";
block_open(out);
@@ -1562,29 +1562,29 @@ void t_swift_generator::generate_swift_service_client_async_implementation(ofstr
block_close(out);
indent(out) << ", failure: failure)" << endl;
}
-
-
+
+
block_close(out);
-
+
out << endl;
// Promise function
if (promise_kit_) {
-
+
indent(out) << "public " << promise_function_signature(*f_iter);
block_open(out);
-
+
out << indent() << "let (__promise, __fulfill, __reject) = Promise<" << type_name((*f_iter)->get_returntype()) << ">.pendingPromise()" << endl << endl
<< indent() << "let __transport = __transportFactory.newTransport()" << endl
<< indent() << "let __protocol = __protocolFactory.newProtocolOnTransport(__transport)" << endl
<< endl;
-
+
generate_swift_service_client_send_async_function_invocation(out, *f_iter);
-
+
out << endl;
-
+
indent(out) << "__transport.flushWithCompletion(";
-
+
if ((*f_iter)->is_oneway()) {
out << "{ __fulfill() }, failure: { __reject($0) })" << endl;
}
@@ -1592,26 +1592,26 @@ void t_swift_generator::generate_swift_service_client_async_implementation(ofstr
block_open(out);
indent(out) << "do";
block_open(out);
-
+
indent(out);
if (!(*f_iter)->get_returntype()->is_void()) {
out << "let result = ";
}
out << "try self.recv_" << (*f_iter)->get_name() << "(__protocol)" << endl;
-
+
out << indent() << "__fulfill(";
if (!(*f_iter)->get_returntype()->is_void()) {
out << "result";
}
out << ")" << endl;
-
+
block_close(out);
indent(out) << "catch let error";
block_open(out);
indent(out) << "__reject(error)" << endl;
block_close(out);
block_close(out);
-
+
indent(out) << ", failure: { error in " << endl;
indent_up();
indent(out) << "__reject(error)" << endl;
@@ -1622,11 +1622,11 @@ void t_swift_generator::generate_swift_service_client_async_implementation(ofstr
indent(out) << "return __promise" << endl;
block_close(out);
-
+
out << endl;
-
+
}
-
+
}
block_close(out);
@@ -1645,52 +1645,52 @@ void t_swift_generator::generate_swift_service_client_async_implementation(ofstr
*/
void t_swift_generator::generate_swift_service_server_implementation(ofstream& out,
t_service* tservice) {
-
+
string name = tservice->get_name() + "Processor";
indent(out) << "extension " << name << " : TProcessor";
block_open(out);
-
+
out << endl;
-
+
indent(out) << "static let processorHandlers : ProcessorHandlerDictionary =";
block_open(out);
-
+
out << endl;
-
+
out << indent() << "var processorHandlers = ProcessorHandlerDictionary()" << endl << endl;
-
+
// generate method map for routing incoming calls
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::const_iterator f_iter;
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
-
+
t_function* tfunction = *f_iter;
-
+
string args_type = function_args_helper_struct_type(tservice, *f_iter);
-
+
out << indent() << "processorHandlers[\"" << tfunction->get_name() << "\"] = { sequenceID, inProtocol, outProtocol, handler in" << endl
<< endl;
-
+
indent_up();
out << indent() << "let args = try " << args_type << ".readValueFromProtocol(inProtocol)" << endl
<< endl
<< indent() << "try inProtocol.readMessageEnd()" << endl
<< endl;
-
+
if (!tfunction->is_oneway() ) {
string result_type = function_result_helper_struct_type(tservice, tfunction);
indent(out) << "var result = " << result_type << "()" << endl;
-
+
indent(out) << "do";
block_open(out);
-
+
indent(out);
if (!tfunction->get_returntype()->is_void()) {
out << "result.success = ";
}
out << "try handler." << function_name(tfunction) << "(";
-
+
t_struct* arg_struct = tfunction->get_arglist();
const vector<t_field*>& fields = arg_struct->get_members();
vector<t_field*>::const_iterator f_iter;
@@ -1705,29 +1705,29 @@ void t_swift_generator::generate_swift_service_server_implementation(ofstream& o
out << ", ";
}
}
-
+
out << ")" << endl;
-
+
block_close(out);
-
+
t_struct* xs = tfunction->get_xceptions();
const vector<t_field*>& xfields = xs->get_members();
vector<t_field*>::const_iterator x_iter;
-
+
for (x_iter = xfields.begin(); x_iter != xfields.end(); ++x_iter) {
indent(out) << "catch let error as " << (*x_iter)->get_type()->get_name();
block_open(out);
indent(out) << "result." << (*x_iter)->get_name() << " = error" << endl;
block_close(out);
}
-
+
indent(out) << "catch let error";
block_open(out);
out << indent() << "throw error" << endl;
block_close(out);
-
+
out << endl;
-
+
if (!tfunction->is_oneway()) {
out << indent() << "try outProtocol.writeMessageBeginWithName(\"" << tfunction->get_name() << "\", type: .REPLY, sequenceID: sequenceID)" << endl
<< indent() << "try " << result_type << ".writeValue(result, toProtocol: outProtocol)" << endl
@@ -1735,21 +1735,21 @@ void t_swift_generator::generate_swift_service_server_implementation(ofstream& o
}
}
block_close(out);
-
+
}
-
+
indent(out) << "return processorHandlers" << endl;
-
+
block_close(out,false);
out << "()" << endl;
-
+
out << endl;
-
+
indent(out) << "public func processOnInputProtocol(inProtocol: TProtocol, outputProtocol outProtocol: TProtocol) throws";
block_open(out);
-
+
out << endl;
-
+
out << indent() << "let (messageName, _, sequenceID) = try inProtocol.readMessageBegin()" << endl
<< endl
<< indent() << "if let processorHandler = " << name << ".processorHandlers[messageName]";
@@ -1778,9 +1778,9 @@ void t_swift_generator::generate_swift_service_server_implementation(ofstream& o
indent_down();
indent_down();
block_close(out);
-
+
block_close(out);
-
+
block_close(out);
out << endl;
}
@@ -1809,15 +1809,15 @@ string t_swift_generator::type_name(t_type* ttype, bool is_optional, bool is_for
else {
result = ttype->get_name();
}
-
+
if (is_optional) {
result += "?";
}
-
+
if (is_forced) {
result += "!";
}
-
+
return result;
}
@@ -1863,7 +1863,7 @@ void t_swift_generator::render_const_value(ostream& out,
t_type* type,
t_const_value* value) {
type = get_true_type(type);
-
+
if (type->is_base_type()) {
t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
switch (tbase) {
@@ -1894,12 +1894,12 @@ void t_swift_generator::render_const_value(ostream& out,
} else if (type->is_enum()) {
out << value->get_identifier();
} else if (type->is_struct() || type->is_xception()) {
-
+
out << type_name(type) << "(";
-
+
const vector<t_field*>& fields = ((t_struct*)type)->get_members();
vector<t_field*>::const_iterator f_iter;
-
+
const map<t_const_value*, t_const_value*>& val = value->get_map();
map<t_const_value*, t_const_value*>::const_iterator v_iter;
@@ -1911,7 +1911,7 @@ void t_swift_generator::render_const_value(ostream& out,
value = v_iter->second;
}
}
-
+
if (value) {
out << tfield->get_name() << ": ";
render_const_value(out, tfield->get_type(), value);
@@ -1919,18 +1919,18 @@ void t_swift_generator::render_const_value(ostream& out,
else if (!field_is_optional(tfield)) {
throw "constant error: required field " + type->get_name() + "." + tfield->get_name() + " has no value";
}
-
+
if (++f_iter != fields.end()) {
out << ", ";
}
}
-
+
out << ")";
-
+
} else if (type->is_map()) {
-
+
out << "[";
-
+
t_type* ktype = ((t_map*)type)->get_key_type();
t_type* vtype = ((t_map*)type)->get_val_type();
@@ -1938,58 +1938,58 @@ void t_swift_generator::render_const_value(ostream& out,
map<t_const_value*, t_const_value*>::const_iterator v_iter;
for (v_iter = val.begin(); v_iter != val.end();) {
-
+
render_const_value(out, ktype, v_iter->first);
out << ": ";
render_const_value(out, vtype, v_iter->second);
-
+
if (++v_iter != val.end()) {
out << ", ";
}
}
-
+
out << "]";
-
+
} else if (type->is_list()) {
-
+
out << "[";
-
+
t_type* etype = ((t_list*)type)->get_elem_type();
-
+
const map<t_const_value*, t_const_value*>& val = value->get_map();
map<t_const_value*, t_const_value*>::const_iterator v_iter;
-
+
for (v_iter = val.begin(); v_iter != val.end();) {
-
+
render_const_value(out, etype, v_iter->first);
-
+
if (++v_iter != val.end()) {
out << ", ";
}
}
-
+
out << "]";
} else if (type->is_set()) {
out << "[";
-
+
t_type* etype = ((t_set*)type)->get_elem_type();
-
+
const map<t_const_value*, t_const_value*>& val = value->get_map();
map<t_const_value*, t_const_value*>::const_iterator v_iter;
-
+
for (v_iter = val.begin(); v_iter != val.end();) {
-
+
render_const_value(out, etype, v_iter->first);
-
+
if (++v_iter != val.end()) {
out << ", ";
}
}
-
+
out << "]";
-
+
} else {
throw "compiler error: no const of type " + type->get_name();
}
@@ -2002,20 +2002,20 @@ void t_swift_generator::render_const_value(ostream& out,
* @param tfield The field to declare a property for
*/
string t_swift_generator::declare_property(t_field* tfield, bool is_private) {
-
+
string visibility = is_private ? "private" : "public";
-
+
ostringstream render;
render << visibility << " var " << maybe_escape_identifier(tfield->get_name());
-
+
if (field_is_optional(tfield)) {
render << " : " << type_name(tfield->get_type(), true);
}
else {
render << " = " << type_name(tfield->get_type(), false) << "()";
}
-
+
return render.str();
}
@@ -2026,16 +2026,16 @@ string t_swift_generator::declare_property(t_field* tfield, bool is_private) {
* @return String of rendered function definition
*/
string t_swift_generator::function_signature(t_function* tfunction) {
-
+
string result = "func " + function_name(tfunction);
-
+
result += "(" + argument_list(tfunction->get_arglist(), "", false) + ") throws";
-
+
t_type* ttype = tfunction->get_returntype();
if (!ttype->is_void()) {
result += " -> " + type_name(ttype);
}
-
+
return result;
}
@@ -2092,7 +2092,7 @@ string t_swift_generator::argument_list(t_struct* tstruct, string protocol_name,
const vector<t_field*>& fields = tstruct->get_members();
vector<t_field*>::const_iterator f_iter;
-
+
if (include_protocol) {
result += protocol_name + ": TProtocol";
if (!fields.empty()) {
@@ -2103,11 +2103,11 @@ string t_swift_generator::argument_list(t_struct* tstruct, string protocol_name,
// Force first argument to be named
result += fields.front()->get_name() + " ";
}
-
+
for (f_iter = fields.begin(); f_iter != fields.end();) {
t_field* arg = *f_iter;
result += arg->get_name() + ": " + type_name(arg->get_type());
-
+
if (++f_iter != fields.end()) {
result += ", ";
}
@@ -2160,7 +2160,7 @@ string t_swift_generator::maybe_escape_identifier(const string& identifier) {
*/
string t_swift_generator::type_to_enum(t_type* type, bool qualified) {
type = get_true_type(type);
-
+
string result = qualified ? "TType." : ".";
if (type->is_base_type()) {
diff --git a/compiler/cpp/src/generate/t_xml_generator.cc b/compiler/cpp/src/thrift/generate/t_xml_generator.cc
index 5465b49f7..b35f35107 100644
--- a/compiler/cpp/src/generate/t_xml_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_xml_generator.cc
@@ -26,8 +26,8 @@
#include <sys/stat.h>
#include <sstream>
-#include "t_generator.h"
-#include "platform.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_generator.h"
using std::map;
using std::ofstream;
@@ -72,7 +72,7 @@ public:
} else if( iter->first.compare("no_namespaces") == 0) {
should_use_namespaces_ = false;
} else {
- throw "unknown option xml:" + iter->first;
+ throw "unknown option xml:" + iter->first;
}
}
@@ -102,7 +102,7 @@ private:
bool should_use_namespaces_;
std::ofstream f_xml_;
-
+
std::set<string> programs_;
std::stack<string> elements_;
bool top_element_is_empty;
@@ -188,8 +188,8 @@ void t_xml_generator::write_xml_comment(string msg) {
close_top_element();
// TODO: indent any EOLs that may occur with msg
// TODO: proper msg escaping needed?
- f_xml_ << indent() << "<!-- " << msg << " -->" << endl;
- top_element_is_empty = false;
+ f_xml_ << indent() << "<!-- " << msg << " -->" << endl;
+ top_element_is_empty = false;
}
void t_xml_generator::close_top_element() {
@@ -238,7 +238,7 @@ void t_xml_generator::write_element_string(string name, string val) {
}
close_top_element();
top_element_is_empty = false;
- f_xml_ << indent()
+ f_xml_ << indent()
<< "<" << name << ">" << escape_xml_string(val) << "</" << name << ">"
<< endl;
}
@@ -287,9 +287,9 @@ void t_xml_generator::generate_program() {
}
write_xml_comment( xml_autogen_comment());
-
+
iterate_program(program_);
-
+
write_element_end();
close_generator();
@@ -297,7 +297,7 @@ void t_xml_generator::generate_program() {
}
void t_xml_generator::iterate_program(t_program* program) {
-
+
write_element_start("document");
write_attribute("name", program->get_name());
if (should_use_namespaces_) {
@@ -548,7 +548,7 @@ void t_xml_generator::generate_struct(t_struct* tstruct) {
}
generate_annotations(tstruct->annotations_);
-
+
write_element_end();
}
@@ -556,7 +556,7 @@ void t_xml_generator::generate_struct(t_struct* tstruct) {
void t_xml_generator::generate_field(t_field* field) {
write_attribute("name", field->get_name());
write_int_attribute("field-id", field->get_key());
- write_doc(field);
+ write_doc(field);
string requiredness;
switch (field->get_req()) {
case t_field::T_REQUIRED:
@@ -582,7 +582,7 @@ void t_xml_generator::generate_field(t_field* field) {
}
void t_xml_generator::generate_service(t_service* tservice) {
-
+
write_element_start("service");
write_attribute("name", tservice->get_name());
@@ -595,7 +595,7 @@ void t_xml_generator::generate_service(t_service* tservice) {
write_attribute("targetNamespace", tns);
write_attribute("xmlns:tns", tns);
}
-
+
if (tservice->get_extends()) {
const t_service* extends = tservice->get_extends();
write_attribute("parent-module", extends->get_program()->get_name());
@@ -609,15 +609,15 @@ void t_xml_generator::generate_service(t_service* tservice) {
for (; fn_iter != functions.end(); fn_iter++) {
generate_function(*fn_iter);
}
-
+
generate_annotations(tservice->annotations_);
-
+
write_element_end();
}
void t_xml_generator::generate_function(t_function* tfunc) {
-
+
write_element_start("method");
write_attribute("name", tfunc->get_name());
@@ -638,7 +638,7 @@ void t_xml_generator::generate_function(t_function* tfunc) {
generate_field(*mem_iter);
write_element_end();
}
-
+
vector<t_field*> excepts = tfunc->get_xceptions()->get_members();
vector<t_field*>::iterator ex_iter = excepts.begin();
for (; ex_iter != excepts.end(); ex_iter++) {
@@ -648,7 +648,7 @@ void t_xml_generator::generate_function(t_function* tfunc) {
}
generate_annotations(tfunc->annotations_);
-
+
write_element_end();
}
@@ -663,9 +663,9 @@ string t_xml_generator::get_type_name(t_type* ttype) {
if (ttype->is_map()) {
return "map";
}
- if ((ttype->is_enum() )||
- (ttype->is_struct() )||
- (ttype->is_typedef() )||
+ if ((ttype->is_enum() )||
+ (ttype->is_struct() )||
+ (ttype->is_typedef() )||
(ttype->is_xception())){
return "id";
}
diff --git a/compiler/cpp/src/generate/t_xsd_generator.cc b/compiler/cpp/src/thrift/generate/t_xsd_generator.cc
index 2de860a39..fa51ba0a8 100644
--- a/compiler/cpp/src/generate/t_xsd_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_xsd_generator.cc
@@ -24,9 +24,9 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sstream>
-#include "t_generator.h"
-#include "version.h"
-#include "platform.h"
+#include "thrift/version.h"
+#include "thrift/platform.h"
+#include "thrift/generate/t_generator.h"
using std::map;
using std::ofstream;
@@ -53,7 +53,7 @@ public:
/* no options yet */
for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
- throw "unknown option xsd:" + iter->first;
+ throw "unknown option xsd:" + iter->first;
}
out_dir_base_ = "gen-xsd";
diff --git a/compiler/cpp/src/globals.h b/compiler/cpp/src/thrift/globals.h
index 961c6ef8a..961c6ef8a 100644
--- a/compiler/cpp/src/globals.h
+++ b/compiler/cpp/src/thrift/globals.h
diff --git a/compiler/cpp/src/logging.cc b/compiler/cpp/src/thrift/logging.cc
index 2daaaec10..f821f5fc5 100644
--- a/compiler/cpp/src/logging.cc
+++ b/compiler/cpp/src/thrift/logging.cc
@@ -21,8 +21,8 @@
* Logging functions copied from main.cc to avoid link errors for plugins
*/
-#include "logging.h"
-#include "globals.h"
+#include "thrift/logging.h"
+#include "thrift/globals.h"
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
diff --git a/compiler/cpp/src/logging.h b/compiler/cpp/src/thrift/logging.h
index ebefbf229..ebefbf229 100644
--- a/compiler/cpp/src/logging.h
+++ b/compiler/cpp/src/thrift/logging.h
diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/thrift/main.cc
index 510d69f47..84218405b 100644
--- a/compiler/cpp/src/main.cc
+++ b/compiler/cpp/src/thrift/main.cc
@@ -44,20 +44,20 @@
#endif
// Careful: must include globals first for extern definitions
-#include "common.h"
-#include "globals.h"
-
-#include "platform.h"
-#include "main.h"
-#include "parse/t_program.h"
-#include "parse/t_scope.h"
-#include "generate/t_generator.h"
-#include "audit/t_audit.h"
+#include "thrift/common.h"
+#include "thrift/globals.h"
+
+#include "thrift/platform.h"
+#include "thrift/main.h"
+#include "thrift/parse/t_program.h"
+#include "thrift/parse/t_scope.h"
+#include "thrift/generate/t_generator.h"
+#include "thrift/audit/t_audit.h"
#ifdef THRIFT_ENABLE_PLUGIN
-#include "plugin/plugin_output.h"
+#include "thrift/plugin/plugin_output.h"
#endif
-#include "version.h"
+#include "thrift/version.h"
using namespace std;
diff --git a/compiler/cpp/src/main.h b/compiler/cpp/src/thrift/main.h
index b0af5a758..54abb03c3 100644
--- a/compiler/cpp/src/main.h
+++ b/compiler/cpp/src/thrift/main.h
@@ -23,10 +23,10 @@
#include <string>
#include <cstdio>
-#include "logging.h"
+#include "thrift/logging.h"
-#include "parse/t_const.h"
-#include "parse/t_field.h"
+#include "thrift/parse/t_const.h"
+#include "thrift/parse/t_field.h"
/**
* Defined in the flex library
diff --git a/compiler/cpp/src/parse/parse.cc b/compiler/cpp/src/thrift/parse/parse.cc
index 81a557b15..01f763751 100644
--- a/compiler/cpp/src/parse/parse.cc
+++ b/compiler/cpp/src/thrift/parse/parse.cc
@@ -17,10 +17,10 @@
* under the License.
*/
-#include "t_type.h"
-#include "t_typedef.h"
+#include "thrift/parse/t_type.h"
+#include "thrift/parse/t_typedef.h"
-#include "main.h"
+#include "thrift/main.h"
t_type* t_type::get_true_type() {
t_type* type = this;
diff --git a/compiler/cpp/src/parse/t_base_type.h b/compiler/cpp/src/thrift/parse/t_base_type.h
index 11d73e015..32523cb9d 100644
--- a/compiler/cpp/src/parse/t_base_type.h
+++ b/compiler/cpp/src/thrift/parse/t_base_type.h
@@ -21,7 +21,7 @@
#define T_BASE_TYPE_H
#include <cstdlib>
-#include "t_type.h"
+#include "thrift/parse/t_type.h"
/**
* A thrift base type, which must be one of the defined enumerated types inside
diff --git a/compiler/cpp/src/parse/t_const.h b/compiler/cpp/src/thrift/parse/t_const.h
index 0f64bb14a..3c08e0dec 100644
--- a/compiler/cpp/src/parse/t_const.h
+++ b/compiler/cpp/src/thrift/parse/t_const.h
@@ -20,8 +20,8 @@
#ifndef T_CONST_H
#define T_CONST_H
-#include "t_type.h"
-#include "t_const_value.h"
+#include "thrift/parse/t_type.h"
+#include "thrift/parse/t_const_value.h"
/**
* A const is a constant value defined across languages that has a type and
diff --git a/compiler/cpp/src/parse/t_const_value.h b/compiler/cpp/src/thrift/parse/t_const_value.h
index 15366ad77..550780328 100644
--- a/compiler/cpp/src/parse/t_const_value.h
+++ b/compiler/cpp/src/thrift/parse/t_const_value.h
@@ -20,7 +20,7 @@
#ifndef T_CONST_VALUE_H
#define T_CONST_VALUE_H
-#include "t_enum.h"
+#include "thrift/parse/t_enum.h"
#include <stdint.h>
#include <map>
#include <vector>
diff --git a/compiler/cpp/src/parse/t_container.h b/compiler/cpp/src/thrift/parse/t_container.h
index 2cdcf7edd..5bdab70a7 100644
--- a/compiler/cpp/src/parse/t_container.h
+++ b/compiler/cpp/src/thrift/parse/t_container.h
@@ -20,7 +20,7 @@
#ifndef T_CONTAINER_H
#define T_CONTAINER_H
-#include "t_type.h"
+#include "thrift/parse/t_type.h"
class t_container : public t_type {
public:
diff --git a/compiler/cpp/src/parse/t_doc.h b/compiler/cpp/src/thrift/parse/t_doc.h
index 621513a3d..7bcb8f5e4 100644
--- a/compiler/cpp/src/parse/t_doc.h
+++ b/compiler/cpp/src/thrift/parse/t_doc.h
@@ -20,8 +20,8 @@
#ifndef T_DOC_H
#define T_DOC_H
-#include "globals.h"
-#include "logging.h"
+#include "thrift/globals.h"
+#include "thrift/logging.h"
/**
* Documentation stubs
diff --git a/compiler/cpp/src/parse/t_enum.h b/compiler/cpp/src/thrift/parse/t_enum.h
index 268f89ff0..9e23780cb 100644
--- a/compiler/cpp/src/parse/t_enum.h
+++ b/compiler/cpp/src/thrift/parse/t_enum.h
@@ -22,8 +22,8 @@
#include <vector>
-#include "t_enum_value.h"
-#include "t_type.h"
+#include "thrift/parse/t_enum_value.h"
+#include "thrift/parse/t_type.h"
/**
* An enumerated type. A list of constant objects with a name for the type.
diff --git a/compiler/cpp/src/parse/t_enum_value.h b/compiler/cpp/src/thrift/parse/t_enum_value.h
index 296029b24..c0bf3adfc 100644
--- a/compiler/cpp/src/parse/t_enum_value.h
+++ b/compiler/cpp/src/thrift/parse/t_enum_value.h
@@ -22,7 +22,7 @@
#include <map>
#include <string>
-#include "t_doc.h"
+#include "thrift/parse/t_doc.h"
/**
* A constant. These are used inside of enum definitions. Constants are just
diff --git a/compiler/cpp/src/parse/t_field.h b/compiler/cpp/src/thrift/parse/t_field.h
index 8b459a351..c5f1f800c 100644
--- a/compiler/cpp/src/parse/t_field.h
+++ b/compiler/cpp/src/thrift/parse/t_field.h
@@ -24,8 +24,8 @@
#include <string>
#include <sstream>
-#include "t_doc.h"
-#include "t_type.h"
+#include "thrift/parse/t_doc.h"
+#include "thrift/parse/t_type.h"
// Forward declare for xsd_attrs
class t_struct;
diff --git a/compiler/cpp/src/parse/t_function.h b/compiler/cpp/src/thrift/parse/t_function.h
index 96886f326..05dc930fc 100644
--- a/compiler/cpp/src/parse/t_function.h
+++ b/compiler/cpp/src/thrift/parse/t_function.h
@@ -21,9 +21,9 @@
#define T_FUNCTION_H
#include <string>
-#include "t_type.h"
-#include "t_struct.h"
-#include "t_doc.h"
+#include "thrift/parse/t_type.h"
+#include "thrift/parse/t_struct.h"
+#include "thrift/parse/t_doc.h"
/**
* Representation of a function. Key parts are return type, function name,
diff --git a/compiler/cpp/src/parse/t_list.h b/compiler/cpp/src/thrift/parse/t_list.h
index ac0d98152..acf68653b 100644
--- a/compiler/cpp/src/parse/t_list.h
+++ b/compiler/cpp/src/thrift/parse/t_list.h
@@ -20,7 +20,7 @@
#ifndef T_LIST_H
#define T_LIST_H
-#include "t_container.h"
+#include "thrift/parse/t_container.h"
/**
* A list is a lightweight container type that just wraps another data type.
diff --git a/compiler/cpp/src/parse/t_map.h b/compiler/cpp/src/thrift/parse/t_map.h
index 269aeab58..dd3f089c1 100644
--- a/compiler/cpp/src/parse/t_map.h
+++ b/compiler/cpp/src/thrift/parse/t_map.h
@@ -20,7 +20,7 @@
#ifndef T_MAP_H
#define T_MAP_H
-#include "t_container.h"
+#include "thrift/parse/t_container.h"
/**
* A map is a lightweight container type that just wraps another two data
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/thrift/parse/t_program.h
index 563e9e038..43dd45a61 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/thrift/parse/t_program.h
@@ -25,21 +25,21 @@
#include <vector>
// For program_name()
-#include "main.h"
-
-#include "t_doc.h"
-#include "t_scope.h"
-#include "t_base_type.h"
-#include "t_typedef.h"
-#include "t_enum.h"
-#include "t_const.h"
-#include "t_struct.h"
-#include "t_service.h"
-#include "t_list.h"
-#include "t_map.h"
-#include "t_set.h"
-#include "generate/t_generator_registry.h"
-//#include "t_doc.h"
+#include "thrift/main.h"
+
+#include "thrift/parse/t_doc.h"
+#include "thrift/parse/t_scope.h"
+#include "thrift/parse/t_base_type.h"
+#include "thrift/parse/t_typedef.h"
+#include "thrift/parse/t_enum.h"
+#include "thrift/parse/t_const.h"
+#include "thrift/parse/t_struct.h"
+#include "thrift/parse/t_service.h"
+#include "thrift/parse/t_list.h"
+#include "thrift/parse/t_map.h"
+#include "thrift/parse/t_set.h"
+#include "thrift/generate/t_generator_registry.h"
+//#include "thrift/parse/t_doc.h"
/**
* Top level class representing an entire thrift program. A program consists
diff --git a/compiler/cpp/src/parse/t_scope.h b/compiler/cpp/src/thrift/parse/t_scope.h
index 565fd8fde..e19620023 100644
--- a/compiler/cpp/src/parse/t_scope.h
+++ b/compiler/cpp/src/thrift/parse/t_scope.h
@@ -24,13 +24,13 @@
#include <string>
#include <sstream>
-#include "t_type.h"
-#include "t_service.h"
-#include "t_const.h"
-#include "t_const_value.h"
-#include "t_base_type.h"
-#include "t_map.h"
-#include "t_list.h"
+#include "thrift/parse/t_type.h"
+#include "thrift/parse/t_service.h"
+#include "thrift/parse/t_const.h"
+#include "thrift/parse/t_const_value.h"
+#include "thrift/parse/t_base_type.h"
+#include "thrift/parse/t_map.h"
+#include "thrift/parse/t_list.h"
namespace plugin_output {
template <typename From, typename To>
diff --git a/compiler/cpp/src/parse/t_service.h b/compiler/cpp/src/thrift/parse/t_service.h
index 6fa8398f1..e2204caee 100644
--- a/compiler/cpp/src/parse/t_service.h
+++ b/compiler/cpp/src/thrift/parse/t_service.h
@@ -20,7 +20,7 @@
#ifndef T_SERVICE_H
#define T_SERVICE_H
-#include "t_function.h"
+#include "thrift/parse/t_function.h"
#include <vector>
class t_program;
diff --git a/compiler/cpp/src/parse/t_set.h b/compiler/cpp/src/thrift/parse/t_set.h
index 8a4648050..f913be4fa 100644
--- a/compiler/cpp/src/parse/t_set.h
+++ b/compiler/cpp/src/thrift/parse/t_set.h
@@ -20,7 +20,7 @@
#ifndef T_SET_H
#define T_SET_H
-#include "t_container.h"
+#include "thrift/parse/t_container.h"
/**
* A set is a lightweight container type that just wraps another data type.
diff --git a/compiler/cpp/src/parse/t_struct.h b/compiler/cpp/src/thrift/parse/t_struct.h
index 1f48f91bf..4102da7be 100644
--- a/compiler/cpp/src/parse/t_struct.h
+++ b/compiler/cpp/src/thrift/parse/t_struct.h
@@ -25,8 +25,8 @@
#include <utility>
#include <string>
-#include "t_type.h"
-#include "t_field.h"
+#include "thrift/parse/t_type.h"
+#include "thrift/parse/t_field.h"
// Forward declare that puppy
class t_program;
diff --git a/compiler/cpp/src/parse/t_type.h b/compiler/cpp/src/thrift/parse/t_type.h
index bea4ee171..30f8c1f7e 100644
--- a/compiler/cpp/src/parse/t_type.h
+++ b/compiler/cpp/src/thrift/parse/t_type.h
@@ -24,7 +24,7 @@
#include <map>
#include <cstring>
#include <stdint.h>
-#include "t_doc.h"
+#include "thrift/parse/t_doc.h"
class t_program;
diff --git a/compiler/cpp/src/parse/t_typedef.cc b/compiler/cpp/src/thrift/parse/t_typedef.cc
index ddbe74987..99ffdb8bd 100644
--- a/compiler/cpp/src/parse/t_typedef.cc
+++ b/compiler/cpp/src/thrift/parse/t_typedef.cc
@@ -18,8 +18,8 @@
*/
#include <cstdio>
-#include "t_typedef.h"
-#include "t_program.h"
+#include "thrift/parse/t_typedef.h"
+#include "thrift/parse/t_program.h"
t_type* t_typedef::get_type() const {
if (type_ == NULL) {
diff --git a/compiler/cpp/src/parse/t_typedef.h b/compiler/cpp/src/thrift/parse/t_typedef.h
index a39a246d2..0cccc265e 100644
--- a/compiler/cpp/src/parse/t_typedef.h
+++ b/compiler/cpp/src/thrift/parse/t_typedef.h
@@ -21,7 +21,7 @@
#define T_TYPEDEF_H
#include <string>
-#include "t_type.h"
+#include "thrift/parse/t_type.h"
/**
* A typedef is a mapping from a symbolic name to another type. In dymanically
diff --git a/compiler/cpp/src/platform.h b/compiler/cpp/src/thrift/platform.h
index 8cbe9dbe8..7a8edaea4 100644
--- a/compiler/cpp/src/platform.h
+++ b/compiler/cpp/src/thrift/platform.h
@@ -23,7 +23,7 @@
*/
#ifdef _MSC_VER
-#include "windows/config.h"
+#include "thrift/windows/config.h"
#endif
#ifdef _WIN32
diff --git a/compiler/cpp/src/plugin/Makefile.am b/compiler/cpp/src/thrift/plugin/Makefile.am
index 7e3c82d8b..e84cdbd9c 100644
--- a/compiler/cpp/src/plugin/Makefile.am
+++ b/compiler/cpp/src/thrift/plugin/Makefile.am
@@ -30,10 +30,10 @@ plugin_gen = plugin_types.h \
plugin_constants.cpp
BUILT_SOURCES = $(plugin_gen)
-gen.stamp: plugin.thrift $(top_builddir)/compiler/cpp/src/thrift-bootstrap
+gen.stamp: plugin.thrift $(top_builddir)/compiler/cpp/src/thrift/thrift-bootstrap
@$(RM) -f gen.tmp
@touch gen.tmp
- $(top_builddir)/compiler/cpp/src/thrift-bootstrap -gen cpp -out . $<
+ $(top_builddir)/compiler/cpp/src/thrift/thrift-bootstrap -gen cpp -out . $<
@mv -f gen.tmp $@
$(plugin_gen): gen.stamp
diff --git a/compiler/cpp/src/plugin/plugin.cc b/compiler/cpp/src/thrift/plugin/plugin.cc
index d969f5028..1d45d89c7 100644
--- a/compiler/cpp/src/plugin/plugin.cc
+++ b/compiler/cpp/src/thrift/plugin/plugin.cc
@@ -17,7 +17,7 @@
* under the License.
*/
-#include "plugin/plugin.h"
+#include "thrift/plugin/plugin.h"
#ifdef _WIN32
#include <fcntl.h>
@@ -32,13 +32,13 @@
#include <boost/range/algorithm/for_each.hpp>
#include <boost/smart_ptr.hpp>
-#include "generate/t_generator.h"
-#include "plugin/type_util.h"
+#include "thrift/generate/t_generator.h"
+#include "thrift/plugin/type_util.h"
#include "thrift/protocol/TBinaryProtocol.h"
#include "thrift/transport/TBufferTransports.h"
#include "thrift/transport/TFDTransport.h"
-#include "plugin/plugin_types.h"
+#include "thrift/plugin/plugin_types.h"
namespace apache {
namespace thrift {
diff --git a/compiler/cpp/src/plugin/plugin.h b/compiler/cpp/src/thrift/plugin/plugin.h
index 705cd41ff..705cd41ff 100644
--- a/compiler/cpp/src/plugin/plugin.h
+++ b/compiler/cpp/src/thrift/plugin/plugin.h
diff --git a/compiler/cpp/src/plugin/plugin.thrift b/compiler/cpp/src/thrift/plugin/plugin.thrift
index a93873da1..a93873da1 100644
--- a/compiler/cpp/src/plugin/plugin.thrift
+++ b/compiler/cpp/src/thrift/plugin/plugin.thrift
diff --git a/compiler/cpp/src/plugin/plugin_output.cc b/compiler/cpp/src/thrift/plugin/plugin_output.cc
index 1ab015e84..168a4a660 100644
--- a/compiler/cpp/src/plugin/plugin_output.cc
+++ b/compiler/cpp/src/thrift/plugin/plugin_output.cc
@@ -29,21 +29,21 @@
#define THRIFT_PCLOSE pclose
#endif
-#include "plugin/plugin_output.h"
+#include "thrift/plugin/plugin_output.h"
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/range/algorithm/transform.hpp>
#include <boost/smart_ptr.hpp>
-#include "generate/t_generator.h"
-#include "plugin/plugin.h"
-#include "plugin/type_util.h"
+#include "thrift/generate/t_generator.h"
+#include "thrift/plugin/plugin.h"
+#include "thrift/plugin/type_util.h"
#include "thrift/protocol/TBinaryProtocol.h"
#include "thrift/transport/TBufferTransports.h"
#include "thrift/transport/TFDTransport.h"
-#include "plugin/plugin_types.h"
+#include "thrift/plugin/plugin_types.h"
namespace plugin_output {
diff --git a/compiler/cpp/src/plugin/plugin_output.h b/compiler/cpp/src/thrift/plugin/plugin_output.h
index eab2d1bfc..eab2d1bfc 100644
--- a/compiler/cpp/src/plugin/plugin_output.h
+++ b/compiler/cpp/src/thrift/plugin/plugin_output.h
diff --git a/compiler/cpp/src/plugin/type_util.h b/compiler/cpp/src/thrift/plugin/type_util.h
index 508b74181..508b74181 100644
--- a/compiler/cpp/src/plugin/type_util.h
+++ b/compiler/cpp/src/thrift/plugin/type_util.h
diff --git a/compiler/cpp/src/thriftl.ll b/compiler/cpp/src/thrift/thriftl.ll
index f47928013..bf7e8a56c 100644
--- a/compiler/cpp/src/thriftl.ll
+++ b/compiler/cpp/src/thrift/thriftl.ll
@@ -53,21 +53,21 @@
#include <stdlib.h>
#ifdef _MSC_VER
-#include "windows/config.h"
+#include "thrift/windows/config.h"
#endif
-#include "main.h"
-#include "common.h"
-#include "globals.h"
-#include "parse/t_program.h"
+#include "thrift/main.h"
+#include "thrift/common.h"
+#include "thrift/globals.h"
+#include "thrift/parse/t_program.h"
/**
* Must be included AFTER parse/t_program.h, but I can't remember why anymore
* because I wrote this a while ago.
*/
#if defined(BISON_USE_PARSER_H_EXTENSION)
-#include "thrifty.h"
+#include "thrift/thrifty.h"
#else
-#include "thrifty.hh"
+#include "thrift/thrifty.hh"
#endif
void thrift_reserved_keyword(char* keyword) {
@@ -223,7 +223,7 @@ literal_begin (['\"])
"include" { return tok_include; }
"void" { return tok_void; }
"bool" { return tok_bool; }
-"byte" {
+"byte" {
emit_byte_type_warning();
return tok_i8;
}
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrift/thrifty.yy
index 51de58f8e..b7a7f72e7 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrift/thrifty.yy
@@ -35,13 +35,13 @@
#endif
#include <limits.h>
#ifdef _MSC_VER
-#include "windows/config.h"
+#include "thrift/windows/config.h"
#endif
-#include "main.h"
-#include "common.h"
-#include "globals.h"
-#include "parse/t_program.h"
-#include "parse/t_scope.h"
+#include "thrift/main.h"
+#include "thrift/common.h"
+#include "thrift/globals.h"
+#include "thrift/parse/t_program.h"
+#include "thrift/parse/t_scope.h"
#ifdef _MSC_VER
//warning C4065: switch statement contains 'default' but no 'case' labels
diff --git a/compiler/cpp/src/version.h.in b/compiler/cpp/src/thrift/version.h.in
index 5770ec9b9..5770ec9b9 100644
--- a/compiler/cpp/src/version.h.in
+++ b/compiler/cpp/src/thrift/version.h.in
diff --git a/compiler/cpp/src/windows/config.h b/compiler/cpp/src/thrift/windows/config.h
index a60008032..a60008032 100644
--- a/compiler/cpp/src/windows/config.h
+++ b/compiler/cpp/src/thrift/windows/config.h
diff --git a/compiler/cpp/src/windows/version.h.in b/compiler/cpp/src/thrift/windows/version.h.in
index 00ebca6dd..00ebca6dd 100644
--- a/compiler/cpp/src/windows/version.h.in
+++ b/compiler/cpp/src/thrift/windows/version.h.in
diff --git a/compiler/cpp/test/CMakeLists.txt b/compiler/cpp/test/CMakeLists.txt
index 047e23ec5..c1fe914c3 100644
--- a/compiler/cpp/test/CMakeLists.txt
+++ b/compiler/cpp/test/CMakeLists.txt
@@ -43,7 +43,7 @@ if(${WITH_PLUGIN})
add_test(NAME PluginUnitTest COMMAND plugintest)
set(thrift-gen-mycpp_SOURCES
- ../src/generate/t_cpp_generator.cc
+ ../src/thrift/generate/t_cpp_generator.cc
plugin/cpp_plugin.cc
)
add_executable(thrift-gen-mycpp ${thrift-gen-mycpp_SOURCES})
diff --git a/compiler/cpp/test/plugin/conversion_test.cc b/compiler/cpp/test/plugin/conversion_test.cc
index f2d140797..5159ba484 100644
--- a/compiler/cpp/test/plugin/conversion_test.cc
+++ b/compiler/cpp/test/plugin/conversion_test.cc
@@ -17,9 +17,9 @@
* under the License.
*/
-#include "parse/t_program.h"
-#include "plugin/type_util.h"
-#include "plugin/plugin_types.h"
+#include "thrift/parse/t_program.h"
+#include "thrift/plugin/type_util.h"
+#include "thrift/plugin/plugin_types.h"
#include <map>
#include <vector>
diff --git a/compiler/cpp/test/plugin/cpp_plugin.cc b/compiler/cpp/test/plugin/cpp_plugin.cc
index 43a62d4a8..6cc19f2a3 100644
--- a/compiler/cpp/test/plugin/cpp_plugin.cc
+++ b/compiler/cpp/test/plugin/cpp_plugin.cc
@@ -17,8 +17,8 @@
* under the License.
*/
-#include "plugin/plugin.h"
-#include "generate/t_generator.h"
+#include "thrift/plugin/plugin.h"
+#include "thrift/generate/t_generator.h"
namespace apache {
namespace thrift {
diff --git a/configure.ac b/configure.ac
index e11636f95..94e7a8b45 100755
--- a/configure.ac
+++ b/configure.ac
@@ -528,7 +528,7 @@ if test "$enable_plugin" = "no"; then
have_plugin="no"
fi
if test "$have_plugin" = "yes" ; then
- AC_CONFIG_LINKS([compiler/cpp/test/plugin/t_cpp_generator.cc:compiler/cpp/src/generate/t_cpp_generator.cc])
+ AC_CONFIG_LINKS([compiler/cpp/test/plugin/t_cpp_generator.cc:compiler/cpp/src/thrift/generate/t_cpp_generator.cc])
fi
AM_CONDITIONAL(WITH_PLUGIN, [test "$have_plugin" = "yes"])
@@ -729,10 +729,10 @@ AC_CONFIG_FILES([
Makefile
compiler/cpp/Makefile
compiler/cpp/src/Makefile
- compiler/cpp/src/plugin/Makefile
+ compiler/cpp/src/thrift/plugin/Makefile
compiler/cpp/test/Makefile
- compiler/cpp/src/version.h
- compiler/cpp/src/windows/version.h
+ compiler/cpp/src/thrift/version.h
+ compiler/cpp/src/thrift/windows/version.h
lib/Makefile
lib/cpp/Makefile
lib/cpp/test/Makefile