#include "bitcoinaddressvalidator.h"
-#include <QDebug>
-
/* Base58 characters are:
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
QValidator::State BitcoinAddressValidator::validate(QString &input, int &pos) const
{
- /* Correction */
+ // Correction
for(int idx=0; idx<input.size(); ++idx)
{
switch(input.at(idx).unicode())
}
}
- /* Validation */
+ // Validation
QValidator::State state = QValidator::Acceptable;
for(int idx=0; idx<input.size(); ++idx)
{
(ch >= 'A' && ch<='Z')) &&
ch != 'l' && ch != 'I' && ch != '0' && ch != 'O')
{
- /* Alphanumeric and not a 'forbidden' character */
+ // Alphanumeric and not a 'forbidden' character
}
else
{
}
}
+ // Empty address is "intermediate" input
+ if(input.isEmpty())
+ {
+ state = QValidator::Intermediate;
+ }
+
return state;
}