Orcus
Loading...
Searching...
No Matches
orcus::memory_content Class Reference

#include <stream.hpp>

Public Member Functions

 memory_content (const file_content &)=delete
 
memory_contentoperator= (const file_content &)=delete
 
 memory_content (std::string_view s)
 
 memory_content (memory_content &&other)
 
const char * data () const
 
size_t size () const
 
bool empty () const
 
void swap (memory_content &other)
 
void convert_to_utf8 ()
 
std::string_view str () const
 

Detailed Description

Represents the content of an in-memory buffer. Note that this class will NOT own the content of the source buffer but simply will reference it, except when the original buffer is a non-utf-8 stream and the caller chooses to convert it to utf-8 by calling its convert_to_utf8() method.

Member Function Documentation

◆ convert_to_utf8()

void orcus::memory_content::convert_to_utf8 ( )

Convert a non-utf-8 stream to a utf-8 one if the source stream contains a byte order mark. If not, it does nothing. When the conversion happens, the converted content will be owned by the object.