LegacyPhonologySync.h header

#include <ew/app/LegacyPhonologySync.h>

Namespace ew::app

LegacySounds struct

struct ew::app::LegacySounds

The flat consonant/vowel strings that describe inventory: every phoneme's written form, space-separated, split by whether it is classed a vowel.

The flat strings are the only phonology the app's Phonology tab shows, so a caller that sets the structured inventory directly and leaves them alone has made the language lie about itself in the one place the writer reads it. This is how that drift is prevented going forward, as reconciledInventory is how the drift already saved is repaired.

Members

QString ew::app::conlang::LegacySounds::consonants

Every phoneme not classed a vowel, in inventory order.

QString ew::app::conlang::LegacySounds::vowels

Every phoneme classed a vowel, in inventory order.

Functions

LegacySounds ew::app::conlang::legacySoundsOf(const ew::core::conlang::PhonemeInventory &inventory)

Builds the flat strings for inventory. See LegacySounds.

ew::core::conlang::PhonemeInventory ew::app::conlang::reconciledInventory(const ew::core::conlang::PhonemeInventory &inventory, const QString &consonants, const QString &vowels)

The inventory that inventory and the flat consonants / vowels strings jointly describe, for a language loaded with the two already disagreeing.

syncStructuredPhonology only fires when an edit is made, so a project saved while the two had drifted apart stays drifted for good, and everything reading the structured side sees a language smaller than the one its own Phonology tab shows. One real project declared twelve consonants and seven vowels while its stored inventory held nine sounds in total, which is what the script editor offered glyph slots for.

The result is the UNION and can never drop a sound. It is ordered as the flat strings declare – that string is what the writer arranged and what the app shows them – with each surviving phoneme keeping the IPA, class, features and weight it already had, and any sound held only by the inventory appended after. Two languages that already agree reconcile to themselves.

void ew::app::conlang::syncStructuredPhonology(const ew::core::conlang::LanguageFields &before, ew::core::conlang::LanguageFields &edited)

Brings edited's structured inventory and phonotactics back into agreement with its flat consonant/vowel/pattern strings, given the before state the edit was made against.

The two models coexist: the flat strings are the original phonology fields, and the structured PhonemeInventory / Phonotactics superseded them. They were reconciled only ONCE, on load, and only when the structured side was absent – so every later edit to a flat string changed nothing that reads the structured side. Two visible consequences: the reference grammar printed a Phonology table from the old inventory beside a Phonotactics section from the new state, so the shareable document contradicted itself; and editing the syllable patterns did not change what the word generator produced, because generation obeys the structured templates. Neither reported an error – the edit simply had no effect on the half of the system that matters.

Regeneration preserves what the flat strings cannot express, so nothing hand-authored is lost: a phoneme keeps its IPA, class, articulatory features and weight when its written form survives the edit; the inventory keeps its stress rule and tones; and the phonotactics keep their constraints, harmony groups, rewrite rules and length distribution. Only what the flat string DOES describe is rebuilt from it.

A field the caller did not touch is left alone, so this is safe to call on every edit.