RTI Connext Modern C++ API  Version 6.1.0
rti::flat::StringBuilder Class Reference

Builds a string. More...

#include <SequenceBuilders.hpp>

Inheritance diagram for rti::flat::StringBuilder:
rti::flat::PrimitiveSequenceBuilder< char > rti::flat::AbstractSequenceBuilder rti::flat::AbstractListBuilder rti::flat::AbstractBuilder

Public Member Functions

StringBuilderset_string (const char *value)
 Sets the string value. More...
 
Offset finish ()
 Finishes building the string. More...
 
- Public Member Functions inherited from rti::flat::PrimitiveSequenceBuilder< char >
PrimitiveSequenceBuilderadd_next (char value)
 Adds the next element. More...
 
PrimitiveSequenceBuilderadd_n (const char *array, unsigned int count)
 Adds all the elements in an array. More...
 
PrimitiveSequenceBuilderadd_n (unsigned int count, char value)
 Adds a number of elements with the same value. More...
 
PrimitiveSequenceBuilderadd_n (unsigned int count)
 Adds a number of uninitialized elements. More...
 
Offset finish ()
 Finishes building the sequence. More...
 
- Public Member Functions inherited from rti::flat::AbstractBuilder
void discard ()
 Discards a member in process of being built. More...
 
bool is_nested () const
 Returns whether this is a member Builder. More...
 
bool is_valid () const
 Whether this Builder is valid. More...
 
rti::xcdr::length_t capacity () const
 Returns the total capacity in bytes. More...
 

Additional Inherited Members

- Protected Member Functions inherited from rti::flat::AbstractListBuilder
unsigned int element_count () const
 Returns the current number of elements that have been added. More...
 
- Protected Member Functions inherited from rti::flat::AbstractBuilder
virtual ~AbstractBuilder ()
 If this is a member Builder, it calls finish(). More...
 

Detailed Description

Builds a string.

A StringBuilder only provides one method, set_string(), so it can be typically used as follows:

MyFlatMutableBuilder my_builder = ...;
my_builder.build_my_string().set_string("Hello!");

Note that by relying on the builder destructor, there is no need to call finish() on the object returned by build_my_string().

Member Function Documentation

◆ set_string()

StringBuilder& rti::flat::StringBuilder::set_string ( const char *  value)
inline

Sets the string value.

◆ finish()

Offset rti::flat::StringBuilder::finish ( )
inline

Finishes building the string.

Returns
An Offset to the member that has been built.
See also
discard()