Skip to content

Commit

Permalink
Support create_type_w_document
Browse files Browse the repository at this point in the history
Signed-off-by: Yangbo Long <yangbo.long.mav@gmail.com>
  • Loading branch information
YangboLong committed Sep 6, 2024
1 parent bad1562 commit 96418f6
Show file tree
Hide file tree
Showing 8 changed files with 417 additions and 364 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,6 @@ class DynamicTypeBuilderFactory : public std::enable_shared_from_this<DynamicTyp
FASTDDS_EXPORTED_API virtual traits<DynamicTypeBuilder>::ref_type create_bitmask_type(
uint32_t bound) = 0;

/*!
* Creates a new @ref DynamicTypeBuilder reference based on the given IDL string.
* @param[in] idl representing an IDL string to be parsed.
* @return New @ref DynamicTypeBuilder reference. Nil reference returned in error case.
*/
FASTDDS_EXPORTED_API virtual traits<DynamicTypeBuilder>::ref_type create_type_w_idl(
const std::string& idl) = 0;

/*!
* Creates a new @ref DynamicTypeBuilder reference by parsing the type description at the given URL.
* @remark Not implemented yet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <fastdds/xtypes/type_representation/TypeObjectRegistry.hpp>
#include <rtps/RTPSDomainImpl.hpp>

#include "idl_parser/IdlParser.hpp"
#include "idl_parser/Idl.hpp"

namespace eprosima {
namespace fastdds {
Expand Down Expand Up @@ -67,21 +67,9 @@ traits<DynamicTypeBuilder>::ref_type DynamicTypeBuilderFactoryImpl::create_type_
const std::string& type_name,
const IncludePathSeq& include_paths) noexcept
{
traits<DynamicTypeBuilder>::ref_type nil;
static_cast<void>(document);
static_cast<void>(type_name);
static_cast<void>(include_paths);
return nil;
}

traits<DynamicTypeBuilder>::ref_type DynamicTypeBuilderFactoryImpl::create_type_w_idl(
const std::string& idl) noexcept
{
using namespace idlparser;

traits<DynamicTypeBuilder>::ref_type ret_val;

Context context = Parser::instance()->parse_string(idl);
idlparser::Context context = idlparser::parse_file(document, type_name, include_paths);
ret_val = context.builder;

return ret_val;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ class DynamicTypeBuilderFactoryImpl : public traits<DynamicTypeBuilderFactory>::
const std::string& type_name,
const IncludePathSeq& include_paths) noexcept override;

traits<DynamicTypeBuilder>::ref_type create_type_w_idl(
const std::string& idl) noexcept override;

traits<DynamicTypeBuilder>::ref_type create_type_w_type_object(
const xtypes::TypeObject& type_object) noexcept override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ struct float_literal : seq<
opt<one<'-'>>,
not_at<seq<dot, kw_exp>>,
star<digit>,
opt<seq<dot, star<digit>>>,
decimal_exponent
sor<
seq<opt<seq<dot, star<digit>>>, decimal_exponent>,
seq<dot, star<digit>>
>
> {};

// fixed-point literals
Expand Down
Loading

0 comments on commit 96418f6

Please sign in to comment.