]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/articlenumber.h
Make LCD output selectable at runtime through an extra I/O pin
[r2c2.git] / source / libmarklin / articlenumber.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBMARKLIN_ARTICLENUMBER_H_
9 #define LIBMARKLIN_ARTICLENUMBER_H_
10
11 #include <string>
12 #include <vector>
13 #include <msp/strings/lexicalcast.h>
14
15 namespace Marklin {
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 Marklin
44
45 #endif