]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/articlenumber.h
Rename the project to R²C²
[r2c2.git] / source / libr2c2 / articlenumber.h
1 /* $Id$
2
3 This file is part of R²C²
4 Copyright © 2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBR2C2_ARTICLENUMBER_H_
9 #define LIBR2C2_ARTICLENUMBER_H_
10
11 #include <string>
12 #include <vector>
13 #include <msp/strings/lexicalcast.h>
14
15 namespace R2C2 {
16
17 class ArticleNumber
18 {
19 private:
20         struct Part
21         {
22                 unsigned number;
23                 char letter;
24
25                 bool operator<(const Part &) const;
26         };
27
28         std::vector<Part> parts;
29
30 public:
31         ArticleNumber() { }
32         ArticleNumber(unsigned);
33         ArticleNumber(const std::string &);
34
35         std::string str() const;
36
37         bool operator<(const ArticleNumber &) const;
38 };
39
40 void operator>>(const Msp::LexicalConverter &, ArticleNumber &);
41 void operator<<(Msp::LexicalConverter &, const ArticleNumber &);
42
43 } // namespace R2C2
44
45 #endif