XJ music engine  1.9.6
In-game runtime engine for XJ music.
Static Public Member Functions | List of all members
XJ::CsvUtils Class Reference

#include <CsvUtils.h>

Static Public Member Functions

static std::vector< std::string > split (const std::string &csv)
 
static std::vector< std::string > splitProperSlug (const std::string &csv)
 
static std::string join (const std::vector< std::string > &parts)
 
static std::string join (const std::set< std::string > &parts)
 
static std::string prettyFrom (const std::vector< std::string > &ids, const std::string &beforeFinalItem)
 
static std::string from (const std::map< std::string, std::string > &properties)
 
static std::string toProperCsvAnd (const std::vector< std::string > &items)
 
static std::string toProperCsvOr (const std::vector< std::string > &items)
 
static std::string toProperCsv (std::vector< std::string > items, const std::string &finalSeparator)
 

Member Function Documentation

◆ from()

std::string CsvUtils::from ( const std::map< std::string, std::string > &  properties)
static

Get a CSV string of key=value properties

Parameters
propertieskey=value
Returns
CSV string

◆ join() [1/2]

std::string CsvUtils::join ( const std::set< std::string > &  parts)
static

Join a set of items in alphabetical order

Parameters
parts
Returns

◆ join() [2/2]

std::string CsvUtils::join ( const std::vector< std::string > &  parts)
static

Join a list of items

Parameters
parts
Returns

◆ prettyFrom()

std::string CsvUtils::prettyFrom ( const std::vector< std::string > &  ids,
const std::string &  beforeFinalItem 
)
static

Join a list of items properly, e.g. "One, Two, Three, and Four"

Parameters
idsto write
beforeFinalItemtext after last comma
Returns
CSV of ids

◆ split()

std::vector< std::string > CsvUtils::split ( const std::string &  csv)
static

Split a CSV string into a vector of strings

Parameters
csvCSV string
Returns
vector of strings

◆ splitProperSlug()

std::vector< std::string > CsvUtils::splitProperSlug ( const std::string &  csv)
static

Split a CSV string into a vector of proper slugs

Parameters
csvCSV string
Returns
vector of proper slugs

◆ toProperCsv()

std::string CsvUtils::toProperCsv ( std::vector< std::string >  items,
const std::string &  finalSeparator 
)
static

Format a list of items as a proper CSV list, with the given final separator word

Parameters
itemslist of items
finalSeparatorfinal separator word
Returns
formatted list like "One, Two, ___ Three"

◆ toProperCsvAnd()

std::string CsvUtils::toProperCsvAnd ( const std::vector< std::string > &  items)
static

Format a list of items as a proper CSV list, with the given final separator word "and"

Parameters
itemslist of items
Returns
formatted list like "One, Two, and Three"

◆ toProperCsvOr()

std::string CsvUtils::toProperCsvOr ( const std::vector< std::string > &  items)
static

Format a list of items as a proper CSV list, with the given final separator word "or"

Parameters
itemslist of items
Returns
formatted list like "One, Two, or Three"

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