10 int pos = s.indexOf( separator, 0 );
22 pos = s.indexOf( separator, 0 );
32 token = s.left( pos );
33 s.remove( 0, pos + 1 );
40 return QUuid::createUuid().toString().mid( 1, 36 );
49 if ( ! f.open( QIODevice::ReadOnly ) )
53 QByteArray data = f.readAll();
58 QString( QCryptographicHash::hash( data, QCryptographicHash::Md5 )
59 .toHex() ) +
" " + QString::number( QFileInfo( filename ).size() );
68 QString utctext = dttext;
69 int ixLT = dttext.length() - 2;
70 int ixT = dttext.indexOf(
"T" );
71 bool haveT = ( ixT > 0 && ixT != ixLT );
72 bool haveUTC = dttext.endsWith(
"UTC" );
79 utctext.replace( ixT, 1,
" " );
84 utctext.append(
" UTC" );
95 if ( dttext.indexOf(
"-" ) == 4 )
97 dt = QDateTime::fromString( dttext, Qt::ISODate ).toUTC();
102 dt = QDateTime::fromString( dttext ).toUTC();
106 utctext = dt.toString( Qt::ISODate );
109 haveT = ( utctext.indexOf(
"T" ) > 0 );
112 utctext.append(
" UTC" );
117 utctext.replace( ixT, 1,
" " );
127 QString isotext = dttext;
129 if ( dttext.contains(
" UTC" ) )
131 isotext.replace(
" UTC",
"" ).replace( dttext.indexOf(
" " ), 1,
"T" );
134 else if ( dttext.indexOf(
"-" ) != 4 )
136 isotext = QDateTime::fromString( dttext ).toString( Qt::ISODate );
146 return QString().sprintf(
147 "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-"
148 "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
149 uu[ 0 ], uu[ 1 ], uu[ 2 ], uu[ 3 ], uu[ 4 ], uu[ 5 ],
150 uu[ 6 ], uu[ 7 ], uu[ 8 ], uu[ 9 ], uu[ 10 ], uu[ 11 ],
151 uu[ 12 ], uu[ 13 ], uu[ 14 ], uu[ 15 ] );
158 return ( ccw.section(
"/", 0, 0 ).simplified() +
159 ccw.section(
"/", 1, 1 ).simplified() +
160 ccw.section(
"/", 2, 2 ).simplified() );
166 QString cells(
"ABCDEFGHZ" );
170 jj = cells.contains( ccw.mid( 2, 1 ) ) ? 2 : jj;
171 jj = cells.contains( ccw.mid( 3, 1 ) ) ? 3 : jj;
172 jj = cells.contains( ccw.mid( 4, 1 ) ) ? 4 : jj;
173 QString cell = ccw.left( jj );
174 QString chan = ccw.mid ( jj, 1 );
175 QString wvln = ccw.mid ( jj + 1 );
178 QString sep = spaces ?
" / " :
"/";
181 return ( cell + sep + chan + sep + wvln );
188 return (
unsigned char)( c -
'0' );
191 return (
unsigned char)( c -
'A' + 10 );
197 QByteArray ba = in.toUtf8();
198 unsigned char*
p = (
unsigned char*)ba.data();
200 for (
int i = 0; i < 16; i++ )
202 while ( *p ==
'-' ) p++;
204 char n = (char)(
hex2int( *p++ ) << 4 );
205 n = (char)( (
int)n |
hex2int( *p++ ) );
215 int rannum = qrand() % timeinc;
216 return ( rannum == 1 );
222 return ( !xmlattr.isEmpty() && ( xmlattr ==
"1" || xmlattr ==
"T" ) );
228 return QString( boolval ?
"1" :
"0" );