2 * Copyright (c) 2021, S. Gilles <sgilles@sgilles.net>
4 * Permission to use, copy, modify, and/or distribute this software
5 * for any purpose with or without fee is hereby granted, provided
6 * that the above copyright notice and this permission notice appear
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
13 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
14 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 /* What's gone on for a particular card */
25 enum class Review_status
{ Unreviewed
, Pass_easy
, Pass_hard
, Fail
};
28 * This is an individual flash card. It has a front side (A), a reverse
29 * side (B), and some information about what level of review it's
32 * The hash thing is just so that we can trivially shuffle these cards
33 * for review by sticking them into an ordered map. We salt with a
34 * per-run value Session::salt.
40 bool operator==(const Card
& that
) const;
41 std::weak_ordering
operator<=>(const Card
& that
) const;
43 static Card
mk(const std::filesystem::path
&dir
);
46 friend std::ostream
& operator<< (std::ostream
&out
, const Card
&us
);
48 /* The directory defining this card */
49 const std::filesystem::path path
;
51 /* The contents of this card's A-side */
54 /* The contents of this card's B-side */
57 /* The hash used for (shuffled) comparison */
58 const std::size_t hash
;
60 /* The mastery level of this card */
64 explicit Card(const std::filesystem::path
& path
, const std::string
& a
, const std::string
& b
, int level
);