]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/articlenumber.h
Rename the project to R²C²
[r2c2.git] / source / libr2c2 / articlenumber.h
diff --git a/source/libr2c2/articlenumber.h b/source/libr2c2/articlenumber.h
new file mode 100644 (file)
index 0000000..cf69c42
--- /dev/null
@@ -0,0 +1,45 @@
+/* $Id$
+
+This file is part of R²C²
+Copyright © 2010  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#ifndef LIBR2C2_ARTICLENUMBER_H_
+#define LIBR2C2_ARTICLENUMBER_H_
+
+#include <string>
+#include <vector>
+#include <msp/strings/lexicalcast.h>
+
+namespace R2C2 {
+
+class ArticleNumber
+{
+private:
+       struct Part
+       {
+               unsigned number;
+               char letter;
+
+               bool operator<(const Part &) const;
+       };
+
+       std::vector<Part> parts;
+
+public:
+       ArticleNumber() { }
+       ArticleNumber(unsigned);
+       ArticleNumber(const std::string &);
+
+       std::string str() const;
+
+       bool operator<(const ArticleNumber &) const;
+};
+
+void operator>>(const Msp::LexicalConverter &, ArticleNumber &);
+void operator<<(Msp::LexicalConverter &, const ArticleNumber &);
+
+} // namespace R2C2
+
+#endif