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

#include <SlashRoot.h>

Public Member Functions

 SlashRoot (const std::string &name)
 
bool operator== (const SlashRoot &other) const
 
PitchClass orDefault (PitchClass dpc) const
 
bool has_value () const
 
std::string display (Accidental withOptional) const
 

Static Public Member Functions

static SlashRoot of (const std::string &name)
 
static SlashRoot none ()
 
static std::string computePre (const std::string &description)
 
static bool has_value (const std::string &name)
 

Public Attributes

std::optional< PitchClasspitchClass
 
std::string pre
 
std::string post
 

Detailed Description

Root can be the root of a Chord, Key or Scale.

Constructor & Destructor Documentation

◆ SlashRoot()

SlashRoot::SlashRoot ( const std::string &  name)
explicit

Parse slash root string, using regular expressions

Parameters
nameto parse slash root

Member Function Documentation

◆ computePre()

std::string SlashRoot::computePre ( const std::string &  description)
static

Returns the pre-slash content, or whole string if no slash is present

Parameters
descriptionto search for pre-slash content

◆ display()

std::string SlashRoot::display ( Accidental  withOptional) const

Display the slash root, with an adjustment symbol if it's a clean note, otherwise as-is

Parameters
withOptionaladjustment symbol
Returns
displayed slash root

◆ has_value() [1/2]

bool SlashRoot::has_value ( ) const
Returns
true if any slash info is present

◆ has_value() [2/2]

bool SlashRoot::has_value ( const std::string &  name)
static

Return true if a slash is present in the given chord name

Parameters
nameto test for slash
Returns
true if slash is found

◆ none()

SlashRoot SlashRoot::none ( )
static

No slash root

Returns
no slash root

◆ of()

SlashRoot SlashRoot::of ( const std::string &  name)
static

Instantiate a Root by name

XJ understands the root of a slash chord https://www.pivotaltracker.com/story/show/176728338

Parameters
nameof root
Returns
root

◆ operator==()

bool SlashRoot::operator== ( const SlashRoot other) const

Compare two slash roots for equality

Parameters
otherto compare
Returns
true if equal

◆ orDefault()

PitchClass SlashRoot::orDefault ( PitchClass  dpc) const

Get the pitch class of a slash root, or a default value

Parameters
dpcdefault pitch class
Returns
pitch class or default

Member Data Documentation

◆ pitchClass

std::optional<PitchClass> XJ::SlashRoot::pitchClass

◆ post

std::string XJ::SlashRoot::post

◆ pre

std::string XJ::SlashRoot::pre

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