libCombine
C++ library for working with the COMBINE Archive format
Loading...
Searching...
No Matches
KnownFormats Class Reference

Static Public Member Functions

static bool isFormat (const std::string &formatKey, std::string format)
 this function tests whether the provided format matches the given formatKey More...
 
static std::string lookupFormat (const std::string &formatKey)
 returns the first format string for the given key More...
 
static std::string guessFormat (const std::string &fileName)
 Guesses the format from the filename. More...
 
static void addKnownFormat (const std::string &formatKey, const std::string &format)
 adds a new entry to the list of known formats More...
 
static std::vector< std::string > getFormatKeys ()
 
static std::map< std::string, std::vector< std::string > > & getKnownFormats ()
 

Static Public Attributes

static const std::string PURL_MEDIATYPES_URL
 

Static Protected Member Functions

static std::map< std::string, std::vector< std::string > > initializeMap ()
 

Static Protected Attributes

static std::map< std::string, std::vector< std::string > > mKnownFormats
 

Member Function Documentation

◆ addKnownFormat()

static void KnownFormats::addKnownFormat ( const std::string &  formatKey,
const std::string &  format 
)
static

adds a new entry to the list of known formats

Parameters
formatKeythe key for the new known format
formatthe format string (mime type or identifiers.org reference)

◆ getFormatKeys()

static std::vector< std::string > KnownFormats::getFormatKeys ( )
static
Returns
a vector of all known format keys

◆ getKnownFormats()

static std::map< std::string, std::vector< std::string > > & KnownFormats::getKnownFormats ( )
static
Returns
the map of known format

◆ guessFormat()

static std::string KnownFormats::guessFormat ( const std::string &  fileName)
static

Guesses the format from the filename.

Parameters
fileNamethe filename, if it is an xml file, the first 128 characters will be looked through to find some of the known xml formats.
Returns
the format if found, empty string otherwise

◆ isFormat()

static bool KnownFormats::isFormat ( const std::string &  formatKey,
std::string  format 
)
static

this function tests whether the provided format matches the given formatKey

Parameters
formatKeythe key
formatthe full format string
Returns
boolean indicating whether the format matches the key or not.

◆ lookupFormat()

static std::string KnownFormats::lookupFormat ( const std::string &  formatKey)
static

returns the first format string for the given key

Parameters
formatKeythe key
Returns
the found format string or empty string if not found.