--- as_dataop.cpp 2003/01/27 12:39:19 1.34
+++ as_dataop.cpp 2003/01/27 17:56:56 1.35
@@ -138,6 +138,7 @@
bool bValid = true; // Used to warn on globally invalid accounting data
int nIter = 0; // Iterator used in loop and also as a count
QString Line; // Used for linewise editing and whitespace eating
+ QString Parstring; // Used to parse all extra '-' and '=' token delimiters
QString Bitbucket; // Used for null device until we find a better way
QPixmap Statokay(s_kpcStatokay_xpm);
@@ -165,6 +166,7 @@
bool bValid = true; // Warns on linewise invalid accounting data
QString User, Guid, Crc, Rev; // Valid admin fields
QString Date, Start, Finish, Account, Amount, Remark; // Valid user fields
+ QString Timepack; // Packed start finish amount field
QTextStream Asline(&Line, IO_ReadOnly); // Convert a single line now
if (nIter % g_knBlocks == 0) // Add blocks of rows to optimize loading
@@ -209,26 +211,29 @@
bValid = false;
Asline.skipWhiteSpace(); // Remove whitespaces
- Asline >> Start; // Copy the start field
- if (!Start.isEmpty()) {
+ Asline >> Timepack;
+
+ // Hack to hard code regex parsing logic into the document format
+ Start = Timepack.section('-', 0, 0, QString::SectionDefault);
+ Finish = Timepack.section('-', 1, 1, QString::SectionDefault);
+ Finish = Finish.section('=', 0, 0, QString::SectionDefault);
+ Amount = Timepack.section('=', 1, 1, QString::SectionDefault);
+
+ if (!Start.isEmpty()) { // Write start
Start.insert(TITRAQ_OFFSETHOUR, QChar(':')); // Format hour
m_pMaintable->setText(nIter, TITRAQ_IDXSTART, Start);
}
else
bValid = false;
- Asline.skipWhiteSpace(); // Remove whitespaces
- Asline >> Finish; // Copy the finish field
- if (!Start.isEmpty()) {
+ if (!Finish.isEmpty()) { // Write finish
Finish.insert(TITRAQ_OFFSETHOUR, QChar(':')); // Format hour
m_pMaintable->setText(nIter, TITRAQ_IDXFINISH, Finish);
}
else
bValid = false;
- Asline.skipWhiteSpace(); // Remove whitespaces
- Asline >> Amount; // Copy the amount field
- if (!Amount.isEmpty()) {
+ if (!Amount.isEmpty()) { // Write amount
Amount.insert(TITRAQ_OFFSETHOUR, QChar(':')); // Format hour
m_pMaintable->setText(nIter, TITRAQ_IDXAMOUNT, Amount);
}
@@ -353,16 +358,18 @@
Tempfield.remove(QChar(':'));
if (Tempfield != NULL)
Tstream << trUtf8(" ") << Tempfield; // Save start field text
+ Tstream << trUtf8("-"); // Save start field text
Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXFINISH); // Load end field text
Tempfield.remove(QChar(':'));
if (Tempfield != NULL)
- Tstream << trUtf8(" ") << Tempfield; // Save end field text
+ Tstream << Tempfield; // Save end field text
+ Tstream << trUtf8("="); // Save start field text
Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXAMOUNT); // Load amount field text
Tempfield.remove(QChar(':'));
if (Tempfield != NULL)
- Tstream << trUtf8(" ") << Tempfield; // Save amount field text
+ Tstream << Tempfield; // Save amount field text
Tempfield = m_pMaintable->text(nIter, TITRAQ_IDXTASK); // Load acct field text
if (Tempfield != NULL)
|