Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
double_conversion::StringBuilder Class Reference

#include <utils.h>

Public Member Functions

 StringBuilder (char *buffer, int buffer_size)
 
 ~StringBuilder ()
 
int size () const
 
int position () const
 
void Reset ()
 
void AddCharacter (char c)
 
void AddString (const char *s)
 
void AddSubstring (const char *s, int n)
 
void AddPadding (char c, int count)
 
char * Finalize ()
 

Detailed Description

Definition at line 298 of file utils.h.

Constructor & Destructor Documentation

◆ StringBuilder()

double_conversion::StringBuilder::StringBuilder ( char *  buffer,
int  buffer_size 
)
inline

Definition at line 300 of file utils.h.

301 : buffer_(buffer, buffer_size), position_(0) { }
static uint32_t buffer_size(uint32_t offset, uint32_t maxAlignment)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ ~StringBuilder()

double_conversion::StringBuilder::~StringBuilder ( )
inline

Definition at line 303 of file utils.h.

303{ if (!is_finalized()) Finalize(); }

Member Function Documentation

◆ AddCharacter()

void double_conversion::StringBuilder::AddCharacter ( char  c)
inline

Definition at line 319 of file utils.h.

319 {
320 DOUBLE_CONVERSION_ASSERT(c != '\0');
321 DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ < buffer_.length());
322 buffer_[position_++] = c;
323 }
int length() const
Definition: utils.h:266
#define DOUBLE_CONVERSION_ASSERT(condition)
Definition: utils.h:46

◆ AddPadding()

void double_conversion::StringBuilder::AddPadding ( char  c,
int  count 
)
inline

Definition at line 343 of file utils.h.

343 {
344 for (int i = 0; i < count; i++) {
345 AddCharacter(c);
346 }
347 }
int count
Definition: FontMgrTest.cpp:50

◆ AddString()

void double_conversion::StringBuilder::AddString ( const char *  s)
inline

Definition at line 327 of file utils.h.

327 {
329 }
void AddSubstring(const char *s, int n)
Definition: utils.h:333
struct MyStruct s
int StrLength(const char *string)
Definition: utils.h:241

◆ AddSubstring()

void double_conversion::StringBuilder::AddSubstring ( const char *  s,
int  n 
)
inline

Definition at line 333 of file utils.h.

333 {
334 DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ + n < buffer_.length());
335 DOUBLE_CONVERSION_ASSERT(static_cast<size_t>(n) <= strlen(s));
336 memmove(&buffer_[position_], s, static_cast<size_t>(n));
337 position_ += n;
338 }

◆ Finalize()

char * double_conversion::StringBuilder::Finalize ( )
inline

Definition at line 350 of file utils.h.

350 {
351 DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ < buffer_.length());
352 buffer_[position_] = '\0';
353 // Make sure nobody managed to add a 0-character to the
354 // buffer while building the string.
355 DOUBLE_CONVERSION_ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_));
356 position_ = -1;
357 DOUBLE_CONVERSION_ASSERT(is_finalized());
358 return buffer_.start();
359 }
T * start() const
Definition: utils.h:272

◆ position()

int double_conversion::StringBuilder::position ( ) const
inline

Definition at line 308 of file utils.h.

308 {
309 DOUBLE_CONVERSION_ASSERT(!is_finalized());
310 return position_;
311 }

◆ Reset()

void double_conversion::StringBuilder::Reset ( )
inline

Definition at line 314 of file utils.h.

314{ position_ = 0; }

◆ size()

int double_conversion::StringBuilder::size ( ) const
inline

Definition at line 305 of file utils.h.

305{ return buffer_.length(); }

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