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

#include <MemeTaxonomy.h>

Public Member Functions

 MemeTaxonomy ()=default
 
 MemeTaxonomy (const std::string &raw)
 
 MemeTaxonomy (const std::set< MapStringToOneOrManyString > &data)
 
std::string toString () const
 
std::set< MapStringToOneOrManyStringtoList () const
 
std::map< std::string, std::vector< std::string > > toMap () const
 
std::set< MemeCategorygetCategories ()
 
bool isAllowed (std::set< std::string > memes) const
 

Static Public Member Functions

static MemeTaxonomy empty ()
 
static MemeTaxonomy fromSet (std::set< MapStringToOneOrManyString > &data)
 
static MemeTaxonomy fromList (const std::vector< std::map< std::string, std::variant< std::string, std::vector< std::string >>>> &list)
 
static MemeTaxonomy fromString (const std::string &raw)
 

Detailed Description

TemplateConfig has Meme categories https://www.pivotaltracker.com/story/show/181801646

A template configuration has a field called memeTaxonomy which defines the taxonomy of memes.

For example, this might look like

memeTaxonomy=CITY[CHICAGO,DENVER,PHILADELPHIA]

That would tell XJ about the existence of a meme category called City with values CHICAGO, DENVER, and PHILADELPHIA. And these would function as exclusion like numeric memes, e.g. after content having CHICAGO is chosen, we can choose nothing with DENVER or PHILADELPHIA.

Constructor & Destructor Documentation

◆ MemeTaxonomy() [1/3]

XJ::MemeTaxonomy::MemeTaxonomy ( )
default

◆ MemeTaxonomy() [2/3]

MemeTaxonomy::MemeTaxonomy ( const std::string &  raw)
explicit

Construct a taxonomy from a raw string like "CATEGORY1[MEME1, MEME2],CATEGORY2[MEME3, MEME4]"

Parameters
rawThe raw string

◆ MemeTaxonomy() [3/3]

MemeTaxonomy::MemeTaxonomy ( const std::set< MapStringToOneOrManyString > &  data)
explicit

Construct a taxonomy from a list of maps like [{name: "CATEGORY1", memes: ["MEME1", "MEME2"]}, {name: "CATEGORY2", memes: ["MEME3", "MEME4"]}]

Parameters
dataThe list of maps

Member Function Documentation

◆ empty()

MemeTaxonomy MemeTaxonomy::empty ( )
static

Construct an empty taxonomy

◆ fromList()

MemeTaxonomy MemeTaxonomy::fromList ( const std::vector< std::map< std::string, std::variant< std::string, std::vector< std::string >>>> &  list)
static

Construct a taxonomy from a list of maps like [{name: "CATEGORY1", memes: ["MEME1", "MEME2"]}, {name: "CATEGORY2", memes: ["MEME3", "MEME4"]}]

Parameters
listThe list of maps

◆ fromSet()

MemeTaxonomy MemeTaxonomy::fromSet ( std::set< MapStringToOneOrManyString > &  data)
static

Construct a taxonomy from a set of maps like [{name: "CATEGORY1", memes: ["MEME1", "MEME2"]}, {name: "CATEGORY2", memes: ["MEME3", "MEME4"]}]

Parameters
dataThe set of maps

◆ fromString()

MemeTaxonomy MemeTaxonomy::fromString ( const std::string &  raw)
static

Construct an empty taxonomy

◆ getCategories()

std::set< MemeCategory > MemeTaxonomy::getCategories ( )

Get the categories

Returns
The categories

◆ isAllowed()

bool MemeTaxonomy::isAllowed ( std::set< std::string >  memes) const

Whether a list of memes is allowed because they are allowed by all taxonomy categories

Parameters
memesThe list of memes to check
Returns
True if the list is allowed

◆ toList()

std::set< MapStringToOneOrManyString > MemeTaxonomy::toList ( ) const

Convert the taxonomy to a list of maps like [{name: "CATEGORY1", memes: ["MEME1", "MEME2"]}, {name: "CATEGORY2", memes: ["MEME3", "MEME4"]}]

Returns
The list of maps

◆ toMap()

std::map< std::string, std::vector< std::string > > MemeTaxonomy::toMap ( ) const

Convert the taxonomy to a map like "{CATEGORY1:[MEME1, MEME2],CATEGORY2:[MEME3, MEME4]}"

Returns
The string

◆ toString()

std::string MemeTaxonomy::toString ( ) const

Convert the taxonomy to a string like "CATEGORY1[MEME1, MEME2],CATEGORY2[MEME3, MEME4]"

Returns
The string

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