xdrpp
RFC4506 XDR compiler and message library
Public Types | Public Member Functions | Static Public Member Functions | List of all members
xdr::xstring< N > Struct Template Reference

A string with a maximum length (returned by xstring::max_size()). More...

#include <types.h>

Inheritance diagram for xdr::xstring< N >:
Inheritance graph
[legend]
Collaboration diagram for xdr::xstring< N >:
Collaboration graph
[legend]

Public Types

using string = std::string
 

Public Member Functions

void validate () const
 Check that the string length is not greater than the maximum size. More...
 
 xstring (const xstring &)=default
 
 xstring (xstring &&)=default
 
xstringoperator= (const xstring &)=default
 
xstringoperator= (xstring &&)=default
 
template<typename... Args>
 xstring (Args &&...args)
 
char * data ()
 
void resize (size_type n)
 
void resize (size_type n, char ch)
 

Static Public Member Functions

static Constexpr uint32_t max_size ()
 Return the maximum size allowed by the type.
 
static void check_size (size_t n)
 Check whether a size is in bounds.
 

Detailed Description

template<uint32_t N = XDR_MAX_LEN>
struct xdr::xstring< N >

A string with a maximum length (returned by xstring::max_size()).

Note that you can exceed the size, but an error will happen when marshaling or unmarshaling the data structure.

Definition at line 473 of file types.h.

Member Function Documentation

◆ validate()

template<uint32_t N = XDR_MAX_LEN>
void xdr::xstring< N >::validate ( ) const
inline

Check that the string length is not greater than the maximum size.

Exceptions
std::out_of_rangeand clears the contents of the string if it is too long.

Definition at line 488 of file types.h.


The documentation for this struct was generated from the following file: