HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_MIME Class Reference

#include <UT_MIME.h>

Classes

struct  TextFilter
 

Public Types

typedef bool(* TextFilterFunc )(const UT_WorkBuffer &in_data, UT_WorkBuffer &out_data, void *filter_data)
 
typedef UT_StringMap< TextFilterTextFilterList
 Map of section name pattern to a text filter. More...
 

Public Member Functions

UT_MIME_Status open (UT_IStream &is)
 
UT_MIME_Status readPart (UT_IStream &is, UT_String &path, UT_WorkBuffer &data, exint *modtime=nullptr, const char *ext_src=nullptr)
 
void close (UT_IStream &is)
 
void open (std::ostream &os, const char *boundaryText=nullptr)
 
void writePart (std::ostream &os, const UT_StringHolder &path, const UT_WorkBuffer &data, const exint modtime=-1)
 Create a new MIME part in the file with the data specified. More...
 
void writeExternalReference (std::ostream &os, const UT_StringHolder &path, const exint modtime=-1)
 Create a new MIME part in the file to indicate externally stored data. More...
 
void close (std::ostream &os)
 
const UT_WorkBuffergetBoundaryText () const
 

Static Public Member Functions

static bool filter (UT_IStream &is, std::ostream &os, const char *inclusions, const char *exclusions, const TextFilterList *filters=nullptr)
 
static bool StatusOK (UT_MIME_Status status)
 
static UT_MIME_Status getAllExternalRefs (UT_IStream &is, UT_StringArray &external_files, const char *ext_src=nullptr)
 
static UT_MIME_Status getAllExternalRefs (const UT_StringHolder &filename, UT_StringArray &external_files, const char *ext_src=nullptr)
 

Static Public Attributes

static const char *const theDefaultBoundaryString
 

Detailed Description

Definition at line 39 of file UT_MIME.h.

Member Typedef Documentation

typedef bool(* UT_MIME::TextFilterFunc)(const UT_WorkBuffer &in_data, UT_WorkBuffer &out_data, void *filter_data)

Function signature for functions used to process MIME sections. This does all processing in-memory.

Parameters
in_dataArbitrary input data.
out_dataPost processed data output stream which will be MIME data.
filter_dataopaque pointer to data used by the filter func.
Returns
False if there was a problem with the filtering.

Definition at line 87 of file UT_MIME.h.

Map of section name pattern to a text filter.

Definition at line 102 of file UT_MIME.h.

Member Function Documentation

void UT_MIME::close ( UT_IStream is)
inline

Definition at line 58 of file UT_MIME.h.

void UT_MIME::close ( std::ostream &  os)
static bool UT_MIME::filter ( UT_IStream is,
std::ostream &  os,
const char *  inclusions,
const char *  exclusions,
const TextFilterList filters = nullptr 
)
static

Runs through a MIME archive and apply the TextFilterList filters to the sections as appropriate. The complete input mime file is is read. Packets matching inclusions but not matching exclusions are written to the output stream os as MIME data.

All patterns follow UT_String::multiMatch() except as noted.

Parameters
isinput text stream of MIME data.
osoutput stream which will be MIME data.
inclusionsOnly include these sections. nullptr to include all sections.
exclusionsExclude these sections from sections that pass inclusions.
filtersFilters to apply.
Returns
False if there was a problem with the stream or parameters.
static UT_MIME_Status UT_MIME::getAllExternalRefs ( UT_IStream is,
UT_StringArray external_files,
const char *  ext_src = nullptr 
)
static

Return a list of all the files stored externally from this MIME file. 'external_src' is optionally the directory the files are stored in.

static UT_MIME_Status UT_MIME::getAllExternalRefs ( const UT_StringHolder filename,
UT_StringArray external_files,
const char *  ext_src = nullptr 
)
static

Return a list of all the files stored externally from this MIME file. 'external_src' is optionally the directory the files are stored in.

const UT_WorkBuffer& UT_MIME::getBoundaryText ( ) const
inline

Definition at line 131 of file UT_MIME.h.

UT_MIME_Status UT_MIME::open ( UT_IStream is)
void UT_MIME::open ( std::ostream &  os,
const char *  boundaryText = nullptr 
)
UT_MIME_Status UT_MIME::readPart ( UT_IStream is,
UT_String path,
UT_WorkBuffer data,
exint modtime = nullptr,
const char *  ext_src = nullptr 
)

Read the next part of the MIME file. 'external_src' is optionally the directory the external files are stored in. If this is not specified then UT_MIME_EXTERNAL_OK is returned for parts that are stored externally. If the external can be read its contents will be placed in 'data'.

static bool UT_MIME::StatusOK ( UT_MIME_Status  status)
static

Given a UT_MIME_Status, return 'true' if the status is not an error condition.

void UT_MIME::writeExternalReference ( std::ostream &  os,
const UT_StringHolder path,
const exint  modtime = -1 
)

Create a new MIME part in the file to indicate externally stored data.

void UT_MIME::writePart ( std::ostream &  os,
const UT_StringHolder path,
const UT_WorkBuffer data,
const exint  modtime = -1 
)

Create a new MIME part in the file with the data specified.

Member Data Documentation

const char* const UT_MIME::theDefaultBoundaryString
static

Definition at line 144 of file UT_MIME.h.


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