mood.rs

  1// Copyright (c) 2017 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
  2//
  3// This Source Code Form is subject to the terms of the Mozilla Public
  4// License, v. 2.0. If a copy of the MPL was not distributed with this
  5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6
  7#![deny(missing_docs)]
  8
  9use minidom::Element;
 10
 11use error::Error;
 12
 13use ns;
 14
 15generate_element_enum!(
 16    /// Enum representing all of the possible values of the XEP-0107 moods.
 17    MoodEnum, "mood", ns::MOOD, {
 18        /// Impressed with fear or apprehension; in fear; apprehensive.
 19        Afraid => "afraid",
 20
 21        /// Astonished; confounded with fear, surprise or wonder.
 22        Amazed => "amazed",
 23
 24        /// Inclined to love; having a propensity to love, or to sexual enjoyment; loving, fond, affectionate, passionate, lustful, sexual, etc.
 25        Amorous => "amorous",
 26
 27        /// 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.
 28        Angry => "angry",
 29
 30        /// To be disturbed or irritated, especially by continued or repeated acts.
 31        Annoyed => "annoyed",
 32
 33        /// Full of anxiety or disquietude; greatly concerned or solicitous, esp. respecting something future or unknown; being in painful suspense.
 34        Anxious => "anxious",
 35
 36        /// To be stimulated in one's feelings, especially to be sexually stimulated.
 37        Aroused => "aroused",
 38
 39        /// Feeling shame or guilt.
 40        Ashamed => "ashamed",
 41
 42        /// Suffering from boredom; uninterested, without attention.
 43        Bored => "bored",
 44
 45        /// Strong in the face of fear; courageous.
 46        Brave => "brave",
 47
 48        /// Peaceful, quiet.
 49        Calm => "calm",
 50
 51        /// Taking care or caution; tentative.
 52        Cautious => "cautious",
 53
 54        /// Feeling the sensation of coldness, especially to the point of discomfort.
 55        Cold => "cold",
 56
 57        /// Feeling very sure of or positive about something, especially about one's own capabilities.
 58        Confident => "confident",
 59
 60        /// Chaotic, jumbled or muddled.
 61        Confused => "confused",
 62
 63        /// Feeling introspective or thoughtful.
 64        Contemplative => "contemplative",
 65
 66        /// Pleased at the satisfaction of a want or desire; satisfied.
 67        Contented => "contented",
 68
 69        /// Grouchy, irritable; easily upset.
 70        Cranky => "cranky",
 71
 72        /// Feeling out of control; feeling overly excited or enthusiastic.
 73        Crazy => "crazy",
 74
 75        /// Feeling original, expressive, or imaginative.
 76        Creative => "creative",
 77
 78        /// Inquisitive; tending to ask questions, investigate, or explore.
 79        Curious => "curious",
 80
 81        /// Feeling sad and dispirited.
 82        Dejected => "dejected",
 83
 84        /// Severely despondent and unhappy.
 85        Depressed => "depressed",
 86
 87        /// Defeated of expectation or hope; let down.
 88        Disappointed => "disappointed",
 89
 90        /// Filled with disgust; irritated and out of patience.
 91        Disgusted => "disgusted",
 92
 93        /// Feeling a sudden or complete loss of courage in the face of trouble or danger.
 94        Dismayed => "dismayed",
 95
 96        /// Having one's attention diverted; preoccupied.
 97        Distracted => "distracted",
 98
 99        /// Having a feeling of shameful discomfort.
100        Embarrassed => "embarrassed",
101
102        /// Feeling pain by the excellence or good fortune of another.
103        Envious => "envious",
104
105        /// Having great enthusiasm.
106        Excited => "excited",
107
108        /// In the mood for flirting.
109        Flirtatious => "flirtatious",
110
111        /// Suffering from frustration; dissatisfied, agitated, or discontented because one is unable to perform an action or fulfill a desire.
112        Frustrated => "frustrated",
113
114        /// Feeling appreciation or thanks.
115        Grateful => "grateful",
116
117        /// Feeling very sad about something, especially something lost; mournful; sorrowful.
118        Grieving => "grieving",
119
120        /// Unhappy and irritable.
121        Grumpy => "grumpy",
122
123        /// Feeling responsible for wrongdoing; feeling blameworthy.
124        Guilty => "guilty",
125
126        /// 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.
127        Happy => "happy",
128
129        /// Having a positive feeling, belief, or expectation that something wished for can or will happen.
130        Hopeful => "hopeful",
131
132        /// Feeling the sensation of heat, especially to the point of discomfort.
133        Hot => "hot",
134
135        /// Having or showing a modest or low estimate of one's own importance; feeling lowered in dignity or importance.
136        Humbled => "humbled",
137
138        /// Feeling deprived of dignity or self-respect.
139        Humiliated => "humiliated",
140
141        /// Having a physical need for food.
142        Hungry => "hungry",
143
144        /// Wounded, injured, or pained, whether physically or emotionally.
145        Hurt => "hurt",
146
147        /// Favourably affected by something or someone.
148        Impressed => "impressed",
149
150        /// Feeling amazement at something or someone; or feeling a combination of fear and reverence.
151        InAwe => "in_awe",
152
153        /// Feeling strong affection, care, liking, or attraction..
154        InLove => "in_love",
155
156        /// Showing anger or indignation, especially at something unjust or wrong.
157        Indignant => "indignant",
158
159        /// Showing great attention to something or someone; having or showing interest.
160        Interested => "interested",
161
162        /// Under the influence of alcohol; drunk.
163        Intoxicated => "intoxicated",
164
165        /// Feeling as if one cannot be defeated, overcome or denied.
166        Invincible => "invincible",
167
168        /// Fearful of being replaced in position or affection.
169        Jealous => "jealous",
170
171        /// Feeling isolated, empty, or abandoned.
172        Lonely => "lonely",
173
174        /// Unable to find one's way, either physically or emotionally.
175        Lost => "lost",
176
177        /// Feeling as if one will be favored by luck.
178        Lucky => "lucky",
179
180        /// Causing or intending to cause intentional harm; bearing ill will towards another; cruel; malicious.
181        Mean => "mean",
182
183        /// Given to sudden or frequent changes of mind or feeling; temperamental.
184        Moody => "moody",
185
186        /// Easily agitated or alarmed; apprehensive or anxious.
187        Nervous => "nervous",
188
189        /// Not having a strong mood or emotional state.
190        Neutral => "neutral",
191
192        /// Feeling emotionally hurt, displeased, or insulted.
193        Offended => "offended",
194
195        /// Feeling resentful anger caused by an extremely violent or vicious attack, or by an offensive, immoral, or indecent act.
196        Outraged => "outraged",
197
198        /// Interested in play; fun, recreational, unserious, lighthearted; joking, silly.
199        Playful => "playful",
200
201        /// Feeling a sense of one's own worth or accomplishment.
202        Proud => "proud",
203
204        /// Having an easy-going mood; not stressed; calm.
205        Relaxed => "relaxed",
206
207        /// Feeling uplifted because of the removal of stress or discomfort.
208        Relieved => "relieved",
209
210        /// Feeling regret or sadness for doing something wrong.
211        Remorseful => "remorseful",
212
213        /// Without rest; unable to be still or quiet; uneasy; continually moving.
214        Restless => "restless",
215
216        /// Feeling sorrow; sorrowful, mournful.
217        Sad => "sad",
218
219        /// Mocking and ironical.
220        Sarcastic => "sarcastic",
221
222        /// Pleased at the fulfillment of a need or desire.
223        Satisfied => "satisfied",
224
225        /// Without humor or expression of happiness; grave in manner or disposition; earnest; thoughtful; solemn.
226        Serious => "serious",
227
228        /// Surprised, startled, confused, or taken aback.
229        Shocked => "shocked",
230
231        /// Feeling easily frightened or scared; timid; reserved or coy.
232        Shy => "shy",
233
234        /// Feeling in poor health; ill.
235        Sick => "sick",
236
237        /// Feeling the need for sleep.
238        Sleepy => "sleepy",
239
240        /// Acting without planning; natural; impulsive.
241        Spontaneous => "spontaneous",
242
243        /// Suffering emotional pressure.
244        Stressed => "stressed",
245
246        /// Capable of producing great physical force; or, emotionally forceful, able, determined, unyielding.
247        Strong => "strong",
248
249        /// Experiencing a feeling caused by something unexpected.
250        Surprised => "surprised",
251
252        /// Showing appreciation or gratitude.
253        Thankful => "thankful",
254
255        /// Feeling the need to drink.
256        Thirsty => "thirsty",
257
258        /// In need of rest or sleep.
259        Tired => "tired",
260
261        /// [Feeling any emotion not defined here.]
262        Undefined => "undefined",
263
264        /// Lacking in force or ability, either physical or emotional.
265        Weak => "weak",
266
267        /// Thinking about unpleasant things that have happened or that might happen; feeling afraid and unhappy.
268        Worried => "worried",
269    }
270);
271
272#[cfg(test)]
273mod tests {
274    use super::*;
275    use try_from::TryFrom;
276
277    #[test]
278    fn test_simple() {
279        let elem: Element = "<happy xmlns='http://jabber.org/protocol/mood'/>".parse().unwrap();
280        let mood = MoodEnum::try_from(elem).unwrap();
281        assert_eq!(mood, MoodEnum::Happy);
282    }
283}