Language.h header

#include <ew/core/Language.h>

Namespace ew::core

Language class

class ew::core::Language

A constructed language ("conlang") as first-class worldbuilding content: its sound system (phonology), a persistent lexicon/dictionary of coined words with their meanings, and free-form grammar notes. Being a content object – not hidden metadata – a language can be listed, searched, shared through a mounted library, and edited undoably like anything else in the world, so the invented language behind the prose is a durable, first-class part of the project rather than a throwaway word list. The phonology fields mirror the app's conlang word generator so a language can seed fresh vocabulary consistent with its own sounds.

Members

ew::core::conlang::Language::Language(ew::core::foundation::ContentId id, QString name)

Creates a language with identity id and display name name. The phonology starts empty (the UI seeds sensible defaults), grammar notes start empty, and the lexicon starts empty.

const QString & ew::core::conlang::Language::name() const

The language's display name.

void ew::core::conlang::Language::setName(QString name)

Sets the language's display name.

const QString & ew::core::conlang::Language::consonants() const

Space-separated consonant phonemes the language is built from.

void ew::core::conlang::Language::setConsonants(QString consonants)

Sets the consonant phonemes.

const QString & ew::core::conlang::Language::vowels() const

Space-separated vowel phonemes.

void ew::core::conlang::Language::setVowels(QString vowels)

Sets the vowel phonemes.

const QString & ew::core::conlang::Language::patterns() const

Space-separated syllable patterns (C = consonant slot, V = vowel slot; others literal).

void ew::core::conlang::Language::setPatterns(QString patterns)

Sets the syllable patterns.

int ew::core::conlang::Language::minSyllables() const

The fewest syllables a generated word may have.

void ew::core::conlang::Language::setMinSyllables(int minSyllables)

Sets the minimum syllable count per generated word.

int ew::core::conlang::Language::maxSyllables() const

The most syllables a generated word may have.

void ew::core::conlang::Language::setMaxSyllables(int maxSyllables)

Sets the maximum syllable count per generated word.

const QString & ew::core::conlang::Language::grammarNotes() const

Free-form grammar notes (Markdown permitted).

void ew::core::conlang::Language::setGrammarNotes(QString grammarNotes)

Sets the free-form grammar notes.

const std::vector< QString > & ew::core::conlang::Language::speakerIds() const

The ids of the codex entities that speak this language.

void ew::core::conlang::Language::setSpeakerIds(std::vector< QString > speakerIds)

Sets the speaking peoples, as a real reference rather than a name coincidence, so renaming a people cannot silently orphan its language.

const std::vector< LexiconEntry > & ew::core::conlang::Language::lexicon() const

The language's dictionary, in display order.

void ew::core::conlang::Language::setLexicon(std::vector< LexiconEntry > lexicon)

Sets the language's dictionary.

const PhonemeInventory & ew::core::conlang::Language::inventory() const

The structured sound inventory (phonemes + suprasegmentals).

void ew::core::conlang::Language::setInventory(PhonemeInventory inventory)

Sets the structured sound inventory.

const Phonotactics & ew::core::conlang::Language::phonotactics() const

The structured phonotactics (categories, syllable templates, constraints, rewrite rules).

void ew::core::conlang::Language::setPhonotactics(Phonotactics phonotactics)

Sets the structured phonotactics.

const Orthography & ew::core::conlang::Language::orthography() const

The orthography (named romanization schemes over the inventory's default spelling).

void ew::core::conlang::Language::setOrthography(Orthography orthography)

Sets the orthography.

const std::vector< SoundChangeRuleset > & ew::core::conlang::Language::soundChanges() const

The diachronic sound-change rulesets that evolve this language into its daughters/dialects.

void ew::core::conlang::Language::setSoundChanges(std::vector< SoundChangeRuleset > soundChanges)

Sets the diachronic sound-change rulesets.

const Grammar & ew::core::conlang::Language::grammar() const

The structured grammar (typology, word order, paradigms, pronouns, number system).

void ew::core::conlang::Language::setGrammar(Grammar grammar)

Sets the structured grammar.

const WritingSystem & ew::core::conlang::Language::writingSystem() const

The constructed writing system (conscript): glyphs, direction, and ligatures.

void ew::core::conlang::Language::setWritingSystem(WritingSystem writing)

Sets the constructed writing system.

const std::vector< GlyphArticulation > & ew::core::conlang::Language::articulations() const

The articulation each generated glyph was derived from.

void ew::core::conlang::Language::setArticulations(std::vector< GlyphArticulation > articulations)

Sets the articulations, so a generated script can be re-derived and adjusted later.

void ew::core::conlang::Language::addEntry(LexiconEntry entry)

Appends entry to the lexicon (a newly coined or glossed word).

LanguageFields ew::core::conlang::Language::fields() const

Returns the whole editable payload as a value snapshot (for undo/redo and serialization).

void ew::core::conlang::Language::setFields(LanguageFields fields)

Replaces the whole editable payload from fields in one step.

LanguageFields struct

struct ew::core::LanguageFields

The complete editable payload of a Language – everything a user can change – captured as a value so it can be snapshotted and restored in one step. Used by SetLanguageCommand for undo/redo and by the store for round-tripping.

Members

QString ew::core::conlang::LanguageFields::name

The language's display name (e.g. "High Elvish").

std::vector<QString> ew::core::conlang::LanguageFields::speakerIds

The ids of the codex entities that speak this language (its peoples), so the link is a real reference rather than a name coincidence – a renamed people no longer silently orphans its language, and the connection is visible to the continuity checks.

QString ew::core::conlang::LanguageFields::consonants

Space-separated consonant phonemes the language draws on (e.g. "p t k s m n l r").

QString ew::core::conlang::LanguageFields::vowels

Space-separated vowel phonemes (e.g. "a e i o u").

QString ew::core::conlang::LanguageFields::patterns

Space-separated syllable patterns, where C is a consonant slot and V a vowel slot (e.g. "CV CVC V"); any other character is literal.

int ew::core::conlang::LanguageFields::minSyllables = 1

The fewest syllables a generated word may have (at least one).

int ew::core::conlang::LanguageFields::maxSyllables = 3

The most syllables a generated word may have (at least minSyllables).

QString ew::core::conlang::LanguageFields::grammarNotes

Free-form grammar notes for the language (Markdown permitted).

std::vector<LexiconEntry> ew::core::conlang::LanguageFields::lexicon

The language's dictionary, in display order.

PhonemeInventory ew::core::conlang::LanguageFields::inventory

The structured sound inventory (phonemes + suprasegmentals). Supersedes the flat consonants / vowels strings, which still parse into it on load; empty for a language that has not been given a structured inventory yet.

Phonotactics ew::core::conlang::LanguageFields::phonotactics

The structured phonotactics (sound categories, weighted syllable templates, constraints, and rewrite rules) that drive the word generator. Supersedes the flat patterns string, which still parses into it on load; empty for a language that has not been given structured phonotactics yet.

Orthography ew::core::conlang::LanguageFields::orthography

The orthography (named romanization schemes over the inventory's default spelling); empty for a language written only in its inventory graphemes.

std::vector<SoundChangeRuleset> ew::core::conlang::LanguageFields::soundChanges

The diachronic sound-change rulesets that evolve this language into its daughters/dialects; empty for a language with no recorded sound history.

Grammar ew::core::conlang::LanguageFields::grammar

The structured grammar (typology, word order, inflection paradigms, pronouns, number system); supplements the free-form grammarNotes and is empty for a language without one.

WritingSystem ew::core::conlang::LanguageFields::writingSystem

The constructed writing system (conscript): glyphs, direction, and ligatures; empty for a language written only in the Latin alphabet.

std::vector<GlyphArticulation> ew::core::conlang::LanguageFields::articulations

The articulation each generated glyph was derived from, by glyph name; empty for a script drawn entirely by hand.

Beside the writing system rather than inside it so the whole model travels together on every save. The prototype this feature comes from lost an afternoon of work because the generator's inputs and the drawn glyphs lived in separate places and the save path covered only one of them – so keeping the inputs is not an extra, it is the fix.

bool ew::core::conlang::LanguageFields::operator==(const LanguageFields &other) const =default

Value equality over all fields, so an edit dialog can detect a no-op change.

LexiconEntry struct

struct ew::core::LexiconEntry

One dictionary entry in a constructed language's lexicon: a headword in the invented language paired with its meaning and optional grammatical detail. This is the unit a worldbuilder accumulates as they flesh a language out – generate or coin a word, then record what it means.

Members

QString ew::core::conlang::LexiconEntry::word

The word as written in the constructed language (the headword).

QString ew::core::conlang::LexiconEntry::gloss

Its meaning in the writer's own language (the gloss/definition).

QString ew::core::conlang::LexiconEntry::partOfSpeech

Optional grammatical category (e.g. "noun", "verb", "adjective"); empty if unclassified.

QString ew::core::conlang::LexiconEntry::notes

Optional etymology, usage, or pronunciation notes; empty if none.

QString ew::core::conlang::LexiconEntry::id

A stable identifier for this entry, so other entries and cross-references can point at it (for derivation and cognate links). Empty for an entry that has not been assigned one yet.

QString ew::core::conlang::LexiconEntry::ipa

The word's pronunciation in IPA; empty when unspecified (the orthography can render it instead).

QString ew::core::conlang::LexiconEntry::semanticField

The semantic field or tag this word belongs to (e.g. "kinship", "colour", "weather"), for grouping and generation; empty if unclassified.

QString ew::core::conlang::LexiconEntry::inflectionClass

The inflection class / declension or conjugation group this word follows (e.g. "strong verb", "a-stem"); empty if none. Drives which paradigm the grammar applies.

QString ew::core::conlang::LexiconEntry::rootId

The id of the entry this word is derived from (a root -> derived link); empty for a root or an unlinked word.

QString ew::core::conlang::LexiconEntry::etymology

Free-form etymology or cognate reference (e.g. "< Proto: watar"); empty if none.

std::vector<QString> ew::core::conlang::LexiconEntry::components

The roots this word is built from, in order (e.g. {"VOR", "KOR", "TEN"}), naming other entries by word. Empty for a root, or for a word whose composition is not recorded.

A polysynthetic language builds every word this way, so without a structured list the composition can only be written into notes as a text convention no tool can read – and a compound then glosses back verbatim and unanalysed, which is exactly what an interlinear gloss exists to avoid.

QString ew::core::conlang::LexiconEntry::oppositeGloss

The gloss of this headword's opposite sense, when one word carries both poles (e.g. a root meaning "good" that means "bad" under emphasis or inversion). Empty when the word has a single sense.

Without this a language whose signature feature IS polarity needs two unrelated headwords to say what it treats as one word in two aspects, and a reverse translation of the opposite pole cannot resolve at all.

Shorthand for the single sense {gloss, any position, opposite pole}. When a word needs more than two readings – selected by position as well as polarity – use senses, which supersedes this. Read both through ew::app::conlang::resolvedSenses so a consumer never has to know which of the two a given entry used.

std::vector<WordSense> ew::core::conlang::LexiconEntry::senses

Every reading this word takes, with the conditions selecting each. Empty for an ordinary word, whose meaning is gloss (plus oppositeGloss if it has a second pole).

bool ew::core::conlang::LexiconEntry::operator==(const LexiconEntry &other) const =default

Value equality over all fields, so a lexicon (and thus a LanguageFields) can be compared.

SensePatternPart struct

struct ew::core::SensePatternPart

One position in a WordSense::pattern: which root must occupy it, at which pole.

A wildcard (empty root) is what makes a bracketing pattern expressible – "this root, any root, this root again" – where naming the middle would defeat the point.

Members

QString ew::core::conlang::SensePatternPart::root

The headword that must fill this position; empty matches ANY root.

bool ew::core::conlang::SensePatternPart::oppositePolarity = false

Whether this occurrence must carry the word's opposite pole.

bool ew::core::conlang::SensePatternPart::operator==(const SensePatternPart &other) const =default

Value equality over all fields.

WordSense struct

struct ew::core::WordSense

One meaning a word takes, and the conditions that select it.

A word can mean different things depending on where it sits inside the word and which pole it carries – four readings from one headword is not exotic, it is the whole design of some languages. A single LexiconEntry::gloss cannot say that, so such a word had to be written out as prose in the notes, where nothing can read it: not the glosser, not translate, not the reference grammar.

Members

QString ew::core::conlang::WordSense::gloss

The meaning under these conditions.

int ew::core::conlang::WordSense::positionClass = -1

The MorphemePositionClass slot this reading applies in; -1 for any position.

bool ew::core::conlang::WordSense::oppositePolarity = false

Whether this reading is the word's opposite pole rather than its primary one.

std::vector<SensePatternPart> ew::core::conlang::WordSense::pattern

The configuration of roots that selects this reading, when the meaning is carried by SEVERAL occurrences rather than one. Empty for an ordinary single-occurrence reading, where positionClass and oppositePolarity say everything.

positionClass describes one instance and so cannot say "two instances of this root, in this arrangement, together mean Y" – a root bracketing another on both sides, or the same two markers adjacent and cancelling. Both are ordinary constructions in a language that builds meaning out of arrangement, and both could previously live only in prose.

A pattern is matched against the chain of roots a word segments into; the whole matched run is then read as this one gloss. The longest pattern wins, so an adjacent pair cannot be mistaken for a bracketing that happens to start the same way.

bool ew::core::conlang::WordSense::operator==(const WordSense &other) const =default

Value equality over all fields.