parsers: port enums over to derive macros

This commit is contained in:
Jonas Schäfer 2024-07-10 16:38:00 +02:00
commit 6afd0ef52f
7 changed files with 563 additions and 428 deletions

View file

@ -4,262 +4,350 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
generate_element_enum!(
/// Enum representing all of the possible values of the XEP-0107 moods.
MoodEnum, "mood", MOOD, {
/// Impressed with fear or apprehension; in fear; apprehensive.
Afraid => "afraid",
use xso::{AsXml, FromXml};
/// Astonished; confounded with fear, surprise or wonder.
Amazed => "amazed",
use crate::ns;
/// Inclined to love; having a propensity to love, or to sexual enjoyment; loving, fond, affectionate, passionate, lustful, sexual, etc.
Amorous => "amorous",
/// Enum representing all of the possible values of the XEP-0107 moods.
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
#[xml(namespace = ns::MOOD, exhaustive)]
pub enum MoodEnum {
/// Impressed with fear or apprehension; in fear; apprehensive.
#[xml(name = "afraid")]
Afraid,
/// Displaying or feeling anger, i.e., a strong feeling of displeasure, hostility or antagonism towards someone or something, usually combined with an urge to harm.
Angry => "angry",
/// Astonished; confounded with fear, surprise or wonder.
#[xml(name = "amazed")]
Amazed,
/// To be disturbed or irritated, especially by continued or repeated acts.
Annoyed => "annoyed",
/// Inclined to love; having a propensity to love, or to sexual enjoyment; loving, fond, affectionate, passionate, lustful, sexual, etc.
#[xml(name = "amorous")]
Amorous,
/// Full of anxiety or disquietude; greatly concerned or solicitous, esp. respecting something future or unknown; being in painful suspense.
Anxious => "anxious",
/// Displaying or feeling anger, i.e., a strong feeling of displeasure, hostility or antagonism towards someone or something, usually combined with an urge to harm.
#[xml(name = "angry")]
Angry,
/// To be stimulated in one's feelings, especially to be sexually stimulated.
Aroused => "aroused",
/// To be disturbed or irritated, especially by continued or repeated acts.
#[xml(name = "annoyed")]
Annoyed,
/// Feeling shame or guilt.
Ashamed => "ashamed",
/// Full of anxiety or disquietude; greatly concerned or solicitous, esp. respecting something future or unknown; being in painful suspense.
#[xml(name = "anxious")]
Anxious,
/// Suffering from boredom; uninterested, without attention.
Bored => "bored",
/// To be stimulated in one's feelings, especially to be sexually stimulated.
#[xml(name = "aroused")]
Aroused,
/// Strong in the face of fear; courageous.
Brave => "brave",
/// Feeling shame or guilt.
#[xml(name = "ashamed")]
Ashamed,
/// Peaceful, quiet.
Calm => "calm",
/// Suffering from boredom; uninterested, without attention.
#[xml(name = "bored")]
Bored,
/// Taking care or caution; tentative.
Cautious => "cautious",
/// Strong in the face of fear; courageous.
#[xml(name = "brave")]
Brave,
/// Feeling the sensation of coldness, especially to the point of discomfort.
Cold => "cold",
/// Peaceful, quiet.
#[xml(name = "calm")]
Calm,
/// Feeling very sure of or positive about something, especially about one's own capabilities.
Confident => "confident",
/// Taking care or caution; tentative.
#[xml(name = "cautious")]
Cautious,
/// Chaotic, jumbled or muddled.
Confused => "confused",
/// Feeling the sensation of coldness, especially to the point of discomfort.
#[xml(name = "cold")]
Cold,
/// Feeling introspective or thoughtful.
Contemplative => "contemplative",
/// Feeling very sure of or positive about something, especially about one's own capabilities.
#[xml(name = "confident")]
Confident,
/// Pleased at the satisfaction of a want or desire; satisfied.
Contented => "contented",
/// Chaotic, jumbled or muddled.
#[xml(name = "confused")]
Confused,
/// Grouchy, irritable; easily upset.
Cranky => "cranky",
/// Feeling introspective or thoughtful.
#[xml(name = "contemplative")]
Contemplative,
/// Feeling out of control; feeling overly excited or enthusiastic.
Crazy => "crazy",
/// Pleased at the satisfaction of a want or desire; satisfied.
#[xml(name = "contented")]
Contented,
/// Feeling original, expressive, or imaginative.
Creative => "creative",
/// Grouchy, irritable; easily upset.
#[xml(name = "cranky")]
Cranky,
/// Inquisitive; tending to ask questions, investigate, or explore.
Curious => "curious",
/// Feeling out of control; feeling overly excited or enthusiastic.
#[xml(name = "crazy")]
Crazy,
/// Feeling sad and dispirited.
Dejected => "dejected",
/// Feeling original, expressive, or imaginative.
#[xml(name = "creative")]
Creative,
/// Severely despondent and unhappy.
Depressed => "depressed",
/// Inquisitive; tending to ask questions, investigate, or explore.
#[xml(name = "curious")]
Curious,
/// Defeated of expectation or hope; let down.
Disappointed => "disappointed",
/// Feeling sad and dispirited.
#[xml(name = "dejected")]
Dejected,
/// Filled with disgust; irritated and out of patience.
Disgusted => "disgusted",
/// Severely despondent and unhappy.
#[xml(name = "depressed")]
Depressed,
/// Feeling a sudden or complete loss of courage in the face of trouble or danger.
Dismayed => "dismayed",
/// Defeated of expectation or hope; let down.
#[xml(name = "disappointed")]
Disappointed,
/// Having one's attention diverted; preoccupied.
Distracted => "distracted",
/// Filled with disgust; irritated and out of patience.
#[xml(name = "disgusted")]
Disgusted,
/// Having a feeling of shameful discomfort.
Embarrassed => "embarrassed",
/// Feeling a sudden or complete loss of courage in the face of trouble or danger.
#[xml(name = "dismayed")]
Dismayed,
/// Feeling pain by the excellence or good fortune of another.
Envious => "envious",
/// Having one's attention diverted; preoccupied.
#[xml(name = "distracted")]
Distracted,
/// Having great enthusiasm.
Excited => "excited",
/// Having a feeling of shameful discomfort.
#[xml(name = "embarrassed")]
Embarrassed,
/// In the mood for flirting.
Flirtatious => "flirtatious",
/// Feeling pain by the excellence or good fortune of another.
#[xml(name = "envious")]
Envious,
/// Suffering from frustration; dissatisfied, agitated, or discontented because one is unable to perform an action or fulfill a desire.
Frustrated => "frustrated",
/// Having great enthusiasm.
#[xml(name = "excited")]
Excited,
/// Feeling appreciation or thanks.
Grateful => "grateful",
/// In the mood for flirting.
#[xml(name = "flirtatious")]
Flirtatious,
/// Feeling very sad about something, especially something lost; mournful; sorrowful.
Grieving => "grieving",
/// Suffering from frustration; dissatisfied, agitated, or discontented because one is unable to perform an action or fulfill a desire.
#[xml(name = "frustrated")]
Frustrated,
/// Unhappy and irritable.
Grumpy => "grumpy",
/// Feeling appreciation or thanks.
#[xml(name = "grateful")]
Grateful,
/// Feeling responsible for wrongdoing; feeling blameworthy.
Guilty => "guilty",
/// Feeling very sad about something, especially something lost; mournful; sorrowful.
#[xml(name = "grieving")]
Grieving,
/// Experiencing the effect of favourable fortune; having the feeling arising from the consciousness of well-being or of enjoyment; enjoying good of any kind, as peace, tranquillity, comfort; contented; joyous.
Happy => "happy",
/// Unhappy and irritable.
#[xml(name = "grumpy")]
Grumpy,
/// Having a positive feeling, belief, or expectation that something wished for can or will happen.
Hopeful => "hopeful",
/// Feeling responsible for wrongdoing; feeling blameworthy.
#[xml(name = "guilty")]
Guilty,
/// Feeling the sensation of heat, especially to the point of discomfort.
Hot => "hot",
/// Experiencing the effect of favourable fortune; having the feeling arising from the consciousness of well-being or of enjoyment; enjoying good of any kind, as peace, tranquillity, comfort; contented; joyous.
#[xml(name = "happy")]
Happy,
/// Having or showing a modest or low estimate of one's own importance; feeling lowered in dignity or importance.
Humbled => "humbled",
/// Having a positive feeling, belief, or expectation that something wished for can or will happen.
#[xml(name = "hopeful")]
Hopeful,
/// Feeling deprived of dignity or self-respect.
Humiliated => "humiliated",
/// Feeling the sensation of heat, especially to the point of discomfort.
#[xml(name = "hot")]
Hot,
/// Having a physical need for food.
Hungry => "hungry",
/// Having or showing a modest or low estimate of one's own importance; feeling lowered in dignity or importance.
#[xml(name = "humbled")]
Humbled,
/// Wounded, injured, or pained, whether physically or emotionally.
Hurt => "hurt",
/// Feeling deprived of dignity or self-respect.
#[xml(name = "humiliated")]
Humiliated,
/// Favourably affected by something or someone.
Impressed => "impressed",
/// Having a physical need for food.
#[xml(name = "hungry")]
Hungry,
/// Feeling amazement at something or someone; or feeling a combination of fear and reverence.
InAwe => "in_awe",
/// Wounded, injured, or pained, whether physically or emotionally.
#[xml(name = "hurt")]
Hurt,
/// Feeling strong affection, care, liking, or attraction..
InLove => "in_love",
/// Favourably affected by something or someone.
#[xml(name = "impressed")]
Impressed,
/// Showing anger or indignation, especially at something unjust or wrong.
Indignant => "indignant",
/// Feeling amazement at something or someone; or feeling a combination of fear and reverence.
#[xml(name = "in_awe")]
InAwe,
/// Showing great attention to something or someone; having or showing interest.
Interested => "interested",
/// Feeling strong affection, care, liking, or attraction..
#[xml(name = "in_love")]
InLove,
/// Under the influence of alcohol; drunk.
Intoxicated => "intoxicated",
/// Showing anger or indignation, especially at something unjust or wrong.
#[xml(name = "indignant")]
Indignant,
/// Feeling as if one cannot be defeated, overcome or denied.
Invincible => "invincible",
/// Showing great attention to something or someone; having or showing interest.
#[xml(name = "interested")]
Interested,
/// Fearful of being replaced in position or affection.
Jealous => "jealous",
/// Under the influence of alcohol; drunk.
#[xml(name = "intoxicated")]
Intoxicated,
/// Feeling isolated, empty, or abandoned.
Lonely => "lonely",
/// Feeling as if one cannot be defeated, overcome or denied.
#[xml(name = "invincible")]
Invincible,
/// Unable to find one's way, either physically or emotionally.
Lost => "lost",
/// Fearful of being replaced in position or affection.
#[xml(name = "jealous")]
Jealous,
/// Feeling as if one will be favored by luck.
Lucky => "lucky",
/// Feeling isolated, empty, or abandoned.
#[xml(name = "lonely")]
Lonely,
/// Causing or intending to cause intentional harm; bearing ill will towards another; cruel; malicious.
Mean => "mean",
/// Unable to find one's way, either physically or emotionally.
#[xml(name = "lost")]
Lost,
/// Given to sudden or frequent changes of mind or feeling; temperamental.
Moody => "moody",
/// Feeling as if one will be favored by luck.
#[xml(name = "lucky")]
Lucky,
/// Easily agitated or alarmed; apprehensive or anxious.
Nervous => "nervous",
/// Causing or intending to cause intentional harm; bearing ill will towards another; cruel; malicious.
#[xml(name = "mean")]
Mean,
/// Not having a strong mood or emotional state.
Neutral => "neutral",
/// Given to sudden or frequent changes of mind or feeling; temperamental.
#[xml(name = "moody")]
Moody,
/// Feeling emotionally hurt, displeased, or insulted.
Offended => "offended",
/// Easily agitated or alarmed; apprehensive or anxious.
#[xml(name = "nervous")]
Nervous,
/// Feeling resentful anger caused by an extremely violent or vicious attack, or by an offensive, immoral, or indecent act.
Outraged => "outraged",
/// Not having a strong mood or emotional state.
#[xml(name = "neutral")]
Neutral,
/// Interested in play; fun, recreational, unserious, lighthearted; joking, silly.
Playful => "playful",
/// Feeling emotionally hurt, displeased, or insulted.
#[xml(name = "offended")]
Offended,
/// Feeling a sense of one's own worth or accomplishment.
Proud => "proud",
/// Feeling resentful anger caused by an extremely violent or vicious attack, or by an offensive, immoral, or indecent act.
#[xml(name = "outraged")]
Outraged,
/// Having an easy-going mood; not stressed; calm.
Relaxed => "relaxed",
/// Interested in play; fun, recreational, unserious, lighthearted; joking, silly.
#[xml(name = "playful")]
Playful,
/// Feeling uplifted because of the removal of stress or discomfort.
Relieved => "relieved",
/// Feeling a sense of one's own worth or accomplishment.
#[xml(name = "proud")]
Proud,
/// Feeling regret or sadness for doing something wrong.
Remorseful => "remorseful",
/// Having an easy-going mood; not stressed; calm.
#[xml(name = "relaxed")]
Relaxed,
/// Without rest; unable to be still or quiet; uneasy; continually moving.
Restless => "restless",
/// Feeling uplifted because of the removal of stress or discomfort.
#[xml(name = "relieved")]
Relieved,
/// Feeling sorrow; sorrowful, mournful.
Sad => "sad",
/// Feeling regret or sadness for doing something wrong.
#[xml(name = "remorseful")]
Remorseful,
/// Mocking and ironical.
Sarcastic => "sarcastic",
/// Without rest; unable to be still or quiet; uneasy; continually moving.
#[xml(name = "restless")]
Restless,
/// Pleased at the fulfillment of a need or desire.
Satisfied => "satisfied",
/// Feeling sorrow; sorrowful, mournful.
#[xml(name = "sad")]
Sad,
/// Without humor or expression of happiness; grave in manner or disposition; earnest; thoughtful; solemn.
Serious => "serious",
/// Mocking and ironical.
#[xml(name = "sarcastic")]
Sarcastic,
/// Surprised, startled, confused, or taken aback.
Shocked => "shocked",
/// Pleased at the fulfillment of a need or desire.
#[xml(name = "satisfied")]
Satisfied,
/// Feeling easily frightened or scared; timid; reserved or coy.
Shy => "shy",
/// Without humor or expression of happiness; grave in manner or disposition; earnest; thoughtful; solemn.
#[xml(name = "serious")]
Serious,
/// Feeling in poor health; ill.
Sick => "sick",
/// Surprised, startled, confused, or taken aback.
#[xml(name = "shocked")]
Shocked,
/// Feeling the need for sleep.
Sleepy => "sleepy",
/// Feeling easily frightened or scared; timid; reserved or coy.
#[xml(name = "shy")]
Shy,
/// Acting without planning; natural; impulsive.
Spontaneous => "spontaneous",
/// Feeling in poor health; ill.
#[xml(name = "sick")]
Sick,
/// Suffering emotional pressure.
Stressed => "stressed",
/// Feeling the need for sleep.
#[xml(name = "sleepy")]
Sleepy,
/// Capable of producing great physical force; or, emotionally forceful, able, determined, unyielding.
Strong => "strong",
/// Acting without planning; natural; impulsive.
#[xml(name = "spontaneous")]
Spontaneous,
/// Experiencing a feeling caused by something unexpected.
Surprised => "surprised",
/// Suffering emotional pressure.
#[xml(name = "stressed")]
Stressed,
/// Showing appreciation or gratitude.
Thankful => "thankful",
/// Capable of producing great physical force; or, emotionally forceful, able, determined, unyielding.
#[xml(name = "strong")]
Strong,
/// Feeling the need to drink.
Thirsty => "thirsty",
/// Experiencing a feeling caused by something unexpected.
#[xml(name = "surprised")]
Surprised,
/// In need of rest or sleep.
Tired => "tired",
/// Showing appreciation or gratitude.
#[xml(name = "thankful")]
Thankful,
/// [Feeling any emotion not defined here.]
Undefined => "undefined",
/// Feeling the need to drink.
#[xml(name = "thirsty")]
Thirsty,
/// Lacking in force or ability, either physical or emotional.
Weak => "weak",
/// In need of rest or sleep.
#[xml(name = "tired")]
Tired,
/// Thinking about unpleasant things that have happened or that might happen; feeling afraid and unhappy.
Worried => "worried",
}
);
/// [Feeling any emotion not defined here.]
#[xml(name = "undefined")]
Undefined,
/// Lacking in force or ability, either physical or emotional.
#[xml(name = "weak")]
Weak,
/// Thinking about unpleasant things that have happened or that might happen; feeling afraid and unhappy.
#[xml(name = "worried")]
Worried,
}
generate_elem_id!(
/// Free-form text description of the mood.