XJ music engine  1.9.6
In-game runtime engine for XJ music.
SlashRoot.h
Go to the documentation of this file.
1 // Copyright (c) XJ Music Inc. (https://xjmusic.com) All Rights Reserved.
2 
3 #ifndef XJMUSIC_MUSIC_SLASH_ROOT_H
4 #define XJMUSIC_MUSIC_SLASH_ROOT_H
5 
6 #include <optional>
7 #include <regex>
8 #include <string>
9 
10 #include "PitchClass.h"
11 
12 namespace XJ {
13 
17  class SlashRoot {
18  private:
19  static std::regex rgxSlashPost;
20  static std::regex rgxSlashNote;
21  static std::regex rgxSlashNoteModified;
22  static std::regex rgxSlashPre;
23 
24  public:
25  std::optional<PitchClass> pitchClass;
26  std::string pre;
27  std::string post;
28 
33  explicit SlashRoot(const std::string& name);
34 
43  static SlashRoot of(const std::string &name);
44 
50  bool operator==(const SlashRoot &other) const;
51 
56  static SlashRoot none();
57 
63  [[nodiscard]] PitchClass orDefault(PitchClass dpc) const;
64 
69  static std::string computePre(const std::string &description);
70 
76  static bool has_value(const std::string &name);
77 
81  [[nodiscard]] bool has_value() const;
82 
88  [[nodiscard]] std::string display(Accidental withOptional) const;
89  };
90 
91 }// namespace XJ
92 
93 #endif// XJMUSIC_MUSIC_SLASH_ROOT_H
Definition: SlashRoot.h:17
std::string pre
Definition: SlashRoot.h:26
std::string post
Definition: SlashRoot.h:27
std::optional< PitchClass > pitchClass
Definition: SlashRoot.h:25
bool has_value() const
Definition: SlashRoot.cpp:61
SlashRoot(const std::string &name)
Definition: SlashRoot.cpp:17
PitchClass orDefault(PitchClass dpc) const
Definition: SlashRoot.cpp:43
std::string display(Accidental withOptional) const
Definition: SlashRoot.cpp:66
static SlashRoot none()
Definition: SlashRoot.cpp:38
static SlashRoot of(const std::string &name)
Definition: SlashRoot.cpp:33
static std::string computePre(const std::string &description)
Definition: SlashRoot.cpp:49
bool operator==(const SlashRoot &other) const
Definition: SlashRoot.cpp:83
Definition: ActiveAudio.h:11
Accidental
Definition: Accidental.h:12
PitchClass
Definition: PitchClass.h:19