Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ add_library(${PROJECT_NAME} INTERFACE)

# Download the cpp-peglib header file needed
file(DOWNLOAD
https://raw.githubusercontent.com/yhirose/cpp-peglib/master/peglib.h
https://raw.githubusercontent.com/yhirose/cpp-peglib/v1.8.2/peglib.h
${PROJECT_SOURCE_DIR}/thirdparty/cpp-peglib/peglib.h
)

Expand All @@ -40,7 +40,7 @@ target_include_directories(${PROJECT_NAME}
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/thirdparty/cpp-peglib>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:thirdparty/cpp-peglib/include>
# $<INSTALL_INTERFACE:thirdparty/cpp-peglib/include>
)

target_compile_features(${PROJECT_NAME}
Expand Down Expand Up @@ -231,12 +231,13 @@ set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Installation dir
set(DATA_INSTALL_DIR ${CMAKE_INSTALL_DATADIR} CACHE PATH "Installation directory for data")

include(CMakePackageConfigHelpers)
string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}")

configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/config.cmake.in
${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config.cmake
INSTALL_DESTINATION
${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake
${CMAKE_INSTALL_LIBDIR_ARCHIND}/cmake/${PROJECT_NAME}
PATH_VARS
BIN_INSTALL_DIR
INCLUDE_INSTALL_DIR
Expand Down Expand Up @@ -278,7 +279,7 @@ install(
DIRECTORY
${PROJECT_SOURCE_DIR}/thirdparty/cpp-peglib/
DESTINATION
thirdparty/cpp-peglib/include
${INCLUDE_INSTALL_DIR} # this is a hack, but it's still more appropriate than thirdparty
FILES_MATCHING
PATTERN "*.h"
)
Expand All @@ -295,5 +296,5 @@ install(
${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config.cmake
${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config-version.cmake
DESTINATION
${DATA_INSTALL_DIR}/${PROJECT_NAME}/cmake
${CMAKE_INSTALL_LIBDIR_ARCHIND}/cmake/${PROJECT_NAME}
)
8 changes: 4 additions & 4 deletions include/xtypes/DynamicDataImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,16 @@ inline std::string ReadableDynamicDataRef::to_string() const
ss << "<" << type_name << "> " << node.data().value<char>();
break;
case TypeKind::CHAR_16_TYPE:
ss << "<" << type_name << "> " << node.data().value<char16_t>();
ss << "<" << type_name << "> " << static_cast<int16_t>(node.data().value<char16_t>());
break;
case TypeKind::WIDE_CHAR_TYPE:
ss << "<" << type_name << "> " << node.data().value<wchar_t>();
ss << "<" << type_name << "> " << static_cast<int32_t>(node.data().value<wchar_t>());
break;
case TypeKind::INT_8_TYPE:
ss << "<" << type_name << "> " << node.data().value<int8_t>();
ss << "<" << type_name << "> " << static_cast<int>(node.data().value<int8_t>());
break;
case TypeKind::UINT_8_TYPE:
ss << "<" << type_name << "> " << node.data().value<uint8_t>();
ss << "<" << type_name << "> " << static_cast<int>(node.data().value<uint8_t>());
break;
case TypeKind::INT_16_TYPE:
ss << "<" << type_name << "> " << node.data().value<int16_t>();
Expand Down
2 changes: 1 addition & 1 deletion include/xtypes/StringType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class TStringType : public MutableCollectionType
virtual void destroy_instance(
uint8_t* instance) const override
{
reinterpret_cast<std::basic_string<CHAR_T>*>(instance)->std::basic_string<CHAR_T>::~basic_string<CHAR_T>();
reinterpret_cast<std::basic_string<CHAR_T>*>(instance)->std::template basic_string<CHAR_T>::~basic_string<CHAR_T>();
}

virtual bool compare_instance(
Expand Down
1 change: 1 addition & 0 deletions include/xtypes/UnionType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <codecvt>
#include <cwchar>
#include <cuchar>
#include <limits>

namespace eprosima {
namespace xtypes {
Expand Down
4 changes: 2 additions & 2 deletions include/xtypes/idl/generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,14 @@ inline std::string label_value(
{
char16_t temp = static_cast<char16_t>(value);
std::stringstream ss;
ss << "L'" << temp << "'";
ss << "L'" << static_cast<int16_t>(temp) << "'";
return ss.str();
}
case TypeKind::WIDE_CHAR_TYPE:
{
wchar_t temp = static_cast<wchar_t>(value);
std::stringstream ss;
ss << "L'" << temp << "'";
ss << "L'" << static_cast<int32_t>(temp) << "'";
return ss.str();
}
case TypeKind::INT_8_TYPE:
Expand Down
6 changes: 4 additions & 2 deletions include/xtypes/idl/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,9 @@ class Parser
, context_(nullptr)
{
parser_.enable_ast();
parser_.log = std::bind(&Parser::parser_log_cb_, this, std::placeholders::_1,
peg::Log log = std::bind(&Parser::parser_log_cb_, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
parser_.set_logger(log);
}

Context parse(
Expand Down Expand Up @@ -675,8 +676,9 @@ class Parser
to_lower(aux_id);
}

for (const std::string& name : parser_.get_rule_names())
for (const auto &item : parser_.get_grammar())
{
const auto &name = item.first;
if (name.find("KW_") == 0) // If it starts with "KW_", is a reserved word. You are welcome.
{
if (parser_[name.c_str()].parse(aux_id.c_str()).ret)
Expand Down