9 #include "IException.h"
22 ID::ID(
const QString &name,
int basenum) {
25 if(!p_namebase.contains(
"?")) {
26 QString msg =
"No replacement set in string [" + p_namebase +
"]";
27 throw IException(IException::User, msg, _FILEINFO_);
29 p_numStart = ((int) p_namebase.indexOf(
"?", 0));
30 int endPos = (int)p_namebase.lastIndexOf(
"?");
31 p_numLength = (endPos - p_numStart) + 1;
32 QString sub = p_namebase.mid(p_numStart, p_numLength);
33 for(
int i = 0; i < (int)sub.length(); i++) {
35 QString msg =
"IString [" + p_namebase +
"] contains more than one replacement set";
36 throw IException(IException::User, msg, _FILEINFO_);
39 p_namebase.remove(p_numStart, p_numLength);
55 if((
int)num.size() > p_numLength) {
56 QString replacement =
"?";
57 while((
int)replacement.size() < p_numLength) {
60 QString original = p_namebase;
61 original.insert(p_numStart, replacement);
62 QString msg =
"Maximum number reached for string [" + original +
"]";
63 throw IException(IException::User, msg, _FILEINFO_);
65 while((
int)num.size() < p_numLength) {
69 QString temp = p_namebase;
70 return temp.insert((p_numStart), num.c_str());