RTI Connext Modern C++ API Version 7.2.0
rti::core::xtypes::DynamicTypePrintFormatProperty Class Reference

<<extension>> <<value-type>> A collection of attributes used to configure how DynamicTypes will be formatted when converted to strings. More...

#include <rti/core/xtypes/DynamicTypePrintFormat.hpp>

Public Member Functions

 DynamicTypePrintFormatProperty (unsigned int indent_in=0, bool print_ordinals_in=false, const DynamicTypePrintKind print_kind_in=rti::core::xtypes::DynamicTypePrintKind::idl, bool print_complete_type_in=false)
 Initializes the properties. More...
 
unsigned int indent () const
 Get the value of indent. More...
 
DynamicTypePrintFormatPropertyindent (unsigned int value)
 Set the amount of additional indent to be included when converting a DynamicType to a string. More...
 
bool print_ordinals () const
 Get the value of print_ordinals. More...
 
DynamicTypePrintFormatPropertyprint_ordinals (bool value)
 Set whether or not to print ordinal values when printing EnumTypes. More...
 
DynamicTypePrintKind print_kind () const
 Get the value of print_kind. More...
 
DynamicTypePrintFormatPropertyprint_kind (DynamicTypePrintKind value)
 Sets the format to use when printing the TypeCode. More...
 
bool print_complete_type () const
 Get the value of print_complete_type. More...
 
DynamicTypePrintFormatPropertyprint_complete_type (bool value)
 Set whether or not to print the complete type. More...
 

Detailed Description

<<extension>> <<value-type>> A collection of attributes used to configure how DynamicTypes will be formatted when converted to strings.

See also
rti::core::xtypes::to_string

Constructor & Destructor Documentation

◆ DynamicTypePrintFormatProperty()

rti::core::xtypes::DynamicTypePrintFormatProperty::DynamicTypePrintFormatProperty ( unsigned int  indent_in = 0,
bool  print_ordinals_in = false,
const DynamicTypePrintKind  print_kind_in = rti::core::xtypes::DynamicTypePrintKind::idl,
bool  print_complete_type_in = false 
)
inlineexplicit

Initializes the properties.

Member Function Documentation

◆ indent() [1/2]

unsigned int rti::core::xtypes::DynamicTypePrintFormatProperty::indent ( ) const
inline

Get the value of indent.

See also
indent(unsigned int value)

◆ indent() [2/2]

DynamicTypePrintFormatProperty & rti::core::xtypes::DynamicTypePrintFormatProperty::indent ( unsigned int  value)
inline

Set the amount of additional indent to be included when converting a DynamicType to a string.

Configures how much additional indent is applied when converting a TypeCode to a string. This value acts as a total offset on the string, increasing the indent applied to all elements by the same amount. With an indent of 0, a string representation of a TypeCode may appear as:

 struct myType {
  
     long x;
  
 };

Using an indent of 1, the same TypeCode would be printed as:

     struct myType {
  
         long x;
  
     };

I.e., the entire structure is indented.

Parameters
valueThe value to set for indent

◆ print_ordinals() [1/2]

bool rti::core::xtypes::DynamicTypePrintFormatProperty::print_ordinals ( ) const
inline

Get the value of print_ordinals.

See also
print_ordinals(bool value)

◆ print_ordinals() [2/2]

DynamicTypePrintFormatProperty & rti::core::xtypes::DynamicTypePrintFormatProperty::print_ordinals ( bool  value)
inline

Set whether or not to print ordinal values when printing EnumTypes.

When set to true, the ordinal value of each enumerator within an enum will be printed, otherwise only non-default ordinals are printed. Take for example the following enum:

 enum myEnum {
  
     RED,
  
     GREEN = 3,
  
     BLUE,
  
 };

When print_ordinals is set to false it would be printed as:

 enum myEnum {
  
     RED,
  
     GREEN = 3,
  
     BLUE,
  
 };

But with print_ordinals set to true it would be printed as:

 enum myEnum {
  
     RED = 0,
  
     GREEN = 3,
  
     BLUE = 4,
  
 };
Parameters
valueThe value to set for print_ordinals

◆ print_kind() [1/2]

DynamicTypePrintKind rti::core::xtypes::DynamicTypePrintFormatProperty::print_kind ( ) const
inline

Get the value of print_kind.

See also
print_kind(DynamicTypePrintKind value)

◆ print_kind() [2/2]

DynamicTypePrintFormatProperty & rti::core::xtypes::DynamicTypePrintFormatProperty::print_kind ( DynamicTypePrintKind  value)
inline

Sets the format to use when printing the TypeCode.

When print_kind is DDS_TYPE_CODE_PRINT_KIND_IDL, the type will be printed in IDL format. For example:

 struct Foo { 
     float32 bar; 
 }; 

When print_kind is DDS_TYPE_CODE_PRINT_KIND_XML, the type will be printed in XML format. For example:

 <struct name="Foo"> 
     <member name="bar" type="float32"/> 
 </struct> 
Parameters
valueThe value to set for print_kind

◆ print_complete_type() [1/2]

bool rti::core::xtypes::DynamicTypePrintFormatProperty::print_complete_type ( ) const
inline

Get the value of print_complete_type.

See also
print_complete_type(bool value)

◆ print_complete_type() [2/2]

DynamicTypePrintFormatProperty & rti::core::xtypes::DynamicTypePrintFormatProperty::print_complete_type ( bool  value)
inline

Set whether or not to print the complete type.

When print_complete_type is true, the complete type will be printed. When print_complete_type is false, only the top level will be printed.

Take for example the following types:

 struct Foo { 
     float32 member; 
 }; 
 struct Bar { 
     Foo foo; 
 }; 

When print_complete_type is false, this is printed as:

 struct Bar { 
     Foo foo; 
 }; 

When print_complete_type is true, this is printed as:

 struct Foo { 
     float32 member; 
 }; 
 struct Bar { 
     Foo foo; 
 }; 
Parameters
valueThe value to set for print_complete_type