Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

SerialNumber Class Reference

#include <SerialNumber.h>

List of all members.

Public Methods

 SerialNumber (u_int base_, const string &prefix_, const string postfix_, size_t size_)
 operator string ()
 Convert to STL string. More...

SerialNumber operator++ ()
 Bump up to the next number. More...

SerialNumber operator++ (int)
 Bump up to the next number. More...


Private Attributes

string m_prefix
string m_postfix
size_t m_size
size_t m_current
size_t m_width


Constructor & Destructor Documentation

SerialNumber::SerialNumber u_int    base_,
const string &    prefix_,
const string    postfix_,
size_t    size_
 

Constructor.

Parameters:
base_  The number of the very first track.
prefix_  Name prefix.
postfix_  The ending that comes after the sequence number.
size_  How may tracks are to be produced.

Definition at line 23 of file SerialNumber.cpp.

References m_size, and m_width.

00025     :
00026     m_prefix (prefix_), m_postfix (postfix_), m_size (size_+base_), 
00027     m_current (base_), m_width (1)
00028 {
00029     int j = 10;
00030     while (m_size >= j) {
00031         m_width++;
00032         j *= 10;
00033     }
00034 }


Member Function Documentation

SerialNumber::operator string  
 

Convert to STL string.

Definition at line 56 of file SerialNumber.cpp.

References m_current, m_postfix, m_prefix, and m_width.

00057 {
00058     std::ostringstream os;
00059     os.setf (std::ios::right);
00060     os.fill ('0');
00061 
00065     os << m_prefix << std::setw (m_width) << m_current << m_postfix;
00066 
00067     return os.str ();
00068 }

SerialNumber SerialNumber::operator++ int   
 

Bump up to the next number.

Definition at line 48 of file SerialNumber.cpp.

00049 {
00050     SerialNumber sn = *this;
00051     ++*this;
00052     return sn;
00053 }

SerialNumber SerialNumber::operator++  
 

Bump up to the next number.

Definition at line 38 of file SerialNumber.cpp.

References m_current, and m_size.

00039 {
00040     if (m_current < m_size) {
00041         m_current++;
00042     }
00043     return *this;
00044 }


Member Data Documentation

size_t SerialNumber::m_current [private]
 

Definition at line 55 of file SerialNumber.h.

Referenced by operator string, and operator++.

string SerialNumber::m_postfix [private]
 

Definition at line 53 of file SerialNumber.h.

Referenced by operator string.

string SerialNumber::m_prefix [private]
 

Definition at line 52 of file SerialNumber.h.

Referenced by operator string.

size_t SerialNumber::m_size [private]
 

Definition at line 54 of file SerialNumber.h.

Referenced by operator++, and SerialNumber.

size_t SerialNumber::m_width [private]
 

Definition at line 56 of file SerialNumber.h.

Referenced by operator string, and SerialNumber.


The documentation for this class was generated from the following files:
Generated on Tue Feb 11 23:05:34 2003 for gwavmerger by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002