Skip to content

Commit

Permalink
Merge pull request RemedyIT#359 from jwillemsen/jwi-idlstringigied
Browse files Browse the repository at this point in the history
Add Annotation mixin to add idl_stringified
  • Loading branch information
jwillemsen authored Feb 18, 2024
2 parents 134e6b5 + 1cee4a3 commit c00f463
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions ridlbe/c++11/config/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,37 @@ def scoped_skel_cxxname
include ValuetypeMixin
end

module AnnotationMixin
def idl_stringified
s = '@' + id.to_s
unless fields.empty?
s += '('
fields.each_with_index do |_, index|
if fields.size > 1
s += fields.keys[index].to_s + '='
end
case fields.values[index]
when TrueClass
s += 'TRUE'
when FalseClass
s += 'FALSE'
else
s += fields.values[index].to_s
end
if index < fields.size - 1
s += ','
end
end
s += ')'
end
s
end
end

IDL::AST::Annotation.class_eval do
include AnnotationMixin
end

module ScannerMixin
CXXKW = [
:alignas,
Expand Down

0 comments on commit c00f463

Please sign in to comment.