Used to represent a parsed date token. For example, it may represent a year.
| 116 | |
| 117 | // Used to represent a parsed date token. For example, it may represent a year. |
| 118 | struct DateToken { |
| 119 | const char* fmt; |
| 120 | int val; |
| 121 | const char* month_name; |
| 122 | |
| 123 | DateToken(const char* fmt, int val) |
| 124 | : fmt(fmt), |
| 125 | val(val), |
| 126 | month_name(nullptr) { |
| 127 | } |
| 128 | |
| 129 | DateToken(const char* month_fmt, int month_val, const char* month_name) |
| 130 | : fmt(month_fmt), |
| 131 | val(month_val), |
| 132 | month_name(month_name) { |
| 133 | } |
| 134 | |
| 135 | friend bool operator<(const DateToken& lhs, const DateToken& rhs) { |
| 136 | return strcmp(lhs.fmt, rhs.fmt) < 0; |
| 137 | } |
| 138 | }; |
| 139 | |
| 140 | void TestDateTokens(const vector<DateToken>& toks, int year, int month, int day, |
| 141 | const char* separator) { |