Skip to content

Commit c6f678f

Browse files
committedApr 9, 2013
After astyle
1 parent 5bd27b0 commit c6f678f

8 files changed

+910
-875
lines changed
 

‎src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp

Lines changed: 168 additions & 168 deletions
Large diffs are not rendered by default.

‎src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class QgsDelimitedTextProvider;
2121

2222
class QgsDelimitedTextFeatureIterator : public QgsAbstractFeatureIterator
2323
{
24-
public:
24+
public:
2525
QgsDelimitedTextFeatureIterator( QgsDelimitedTextProvider* p, const QgsFeatureRequest& request );
2626

2727
~QgsDelimitedTextFeatureIterator();
@@ -35,7 +35,7 @@ class QgsDelimitedTextFeatureIterator : public QgsAbstractFeatureIterator
3535
//! end of iterating: free the resources / lock
3636
virtual bool close();
3737

38-
protected:
38+
protected:
3939
QgsDelimitedTextProvider* P;
4040

4141
//! Feature id

‎src/providers/delimitedtext/qgsdelimitedtextfile.cpp

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,14 @@ QgsDelimitedTextFile::~QgsDelimitedTextFile()
5050

5151
void QgsDelimitedTextFile::close()
5252
{
53-
if( mStream ) { delete mStream; mStream=0; }
54-
if( mFile ) { delete mFile; mFile=0; }
53+
if( mStream ) {
54+
delete mStream;
55+
mStream=0;
56+
}
57+
if( mFile ) {
58+
delete mFile;
59+
mFile=0;
60+
}
5561
}
5662

5763
bool QgsDelimitedTextFile::open()
@@ -95,7 +101,7 @@ bool QgsDelimitedTextFile::setFromUrl( QUrl &url )
95101
// Extract the file name
96102
setFileName( url.toLocalFile());
97103

98-
// The default type is csv, to be consistent with the
104+
// The default type is csv, to be consistent with the
99105
// previous implementation (except that quoting should be handled properly)
100106

101107
QString type("csv");
@@ -326,7 +332,7 @@ QgsDelimitedTextFile::Status QgsDelimitedTextFile::nextLine( QString &buffer, bo
326332

327333
QgsDelimitedTextFile::Status QgsDelimitedTextFile::parseRegexp( QStringList &fields )
328334
{
329-
QString buffer;
335+
QString buffer;
330336
Status status = nextLine(buffer,true);
331337
if( status != RecordOk ) return status;
332338
mRecordLineNumber = mLineNumber;
@@ -345,7 +351,7 @@ QgsDelimitedTextFile::Status QgsDelimitedTextFile::parseQuoted( QStringList &fie
345351
fields.clear();
346352

347353
// Find the first non-blank line to read
348-
QString buffer;
354+
QString buffer;
349355
Status status = nextLine(buffer,true);
350356
if( status != RecordOk ) return status;
351357
mRecordLineNumber = mLineNumber;
@@ -357,8 +363,8 @@ QgsDelimitedTextFile::Status QgsDelimitedTextFile::parseQuoted( QStringList &fie
357363
bool started = false; // Non-blank chars in field or quotes started
358364
bool ended = false; // Quoted field ended
359365
int cp = 0; // Pointer to the next character in the buffer
360-
int cpmax = buffer.size(); // End of string
361-
366+
int cpmax = buffer.size(); // End of string
367+
362368
while( true )
363369
{
364370
QChar c = buffer[cp];
@@ -391,7 +397,7 @@ QgsDelimitedTextFile::Status QgsDelimitedTextFile::parseQuoted( QStringList &fie
391397
// Determine if this is a special character - test each class in turn
392398
// Note that delimiters are not valid as quotes or escape character
393399
//
394-
// Somewhat convoluted logic around quote and escape chars is
400+
// Somewhat convoluted logic around quote and escape chars is
395401
// to enforce logic for escape characters that are also quote characters.
396402
// These escapes can only escape themselves and only in quotes using them
397403
// as delimiters!
@@ -413,7 +419,7 @@ QgsDelimitedTextFile::Status QgsDelimitedTextFile::parseQuoted( QStringList &fie
413419
// quote char in quoted field
414420
if( quoted )
415421
{
416-
// if is also escape and next character is quote, then
422+
// if is also escape and next character is quote, then
417423
// escape the quote..
418424
if( isEscape && buffer[cp]==quoteChar )
419425
{
@@ -436,7 +442,7 @@ QgsDelimitedTextFile::Status QgsDelimitedTextFile::parseQuoted( QStringList &fie
436442
}
437443
// Cannot have a quote embedded in a field
438444
else
439-
{
445+
{
440446
fields.clear();
441447
return RecordInvalid;
442448
}
@@ -465,7 +471,7 @@ QgsDelimitedTextFile::Status QgsDelimitedTextFile::parseQuoted( QStringList &fie
465471
started = false;
466472
ended = false;
467473
}
468-
// Whitespace is permitted before the start of a field, or
474+
// Whitespace is permitted before the start of a field, or
469475
// after the end..
470476
else if( c.isSpace() )
471477
{
@@ -475,7 +481,7 @@ QgsDelimitedTextFile::Status QgsDelimitedTextFile::parseQuoted( QStringList &fie
475481
else
476482
{
477483
if( ended )
478-
{
484+
{
479485
fields.clear();
480486
return RecordInvalid;
481487
}
@@ -484,7 +490,7 @@ QgsDelimitedTextFile::Status QgsDelimitedTextFile::parseQuoted( QStringList &fie
484490
}
485491
}
486492
// If reached the end of the record, then add the last field...
487-
if( started && (mMaxFields <=0 || fields.size() < mMaxFields) )
493+
if( started && (mMaxFields <=0 || fields.size() < mMaxFields) )
488494
{
489495
if( ! ended ) field = field.trimmed();
490496
fields.append(field);

‎src/providers/delimitedtext/qgsdelimitedtextfile.h

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,29 @@ class QTextStream;
3535
* for parsing each record. The following options are supported:
3636
* - Basic whitespace parsing. Each line in the file is treated as a record.
3737
* Extracts all contiguous sequences of non-whitespace
38-
* characters. Leading and trailing whitespace are ignored.
39-
* - Regular expression parsing. Each line in the file is treated as a record.
40-
* The string is split into fields based on a regular expression.
41-
* - Character delimited, based on a delimiter character set, a quote character, and
38+
* characters. Leading and trailing whitespace are ignored.
39+
* - Regular expression parsing. Each line in the file is treated as a record.
40+
* The string is split into fields based on a regular expression.
41+
* - Character delimited, based on a delimiter character set, a quote character, and
4242
* an escape character. The escape treats the next character as a part of a field.
43-
* Fields may start and end with quote characters, in which case any non-escaped
43+
* Fields may start and end with quote characters, in which case any non-escaped
4444
* character within the field is treated literally, including end of line characters.
4545
* The escape character within a string causes the next character to be read literally
46-
* (this includes new line characters). If the escape and quote characters are the
47-
* same, then only quote characters will be escaped (ie to include a quote in a
46+
* (this includes new line characters). If the escape and quote characters are the
47+
* same, then only quote characters will be escaped (ie to include a quote in a
4848
* quoted field it is entered as two quotes. All other characters in quoted fields
4949
* are treated literally, including newlines.
5050
* - CSV format files - these are a special case of character delimited, in which the
5151
* delimiter is a comma, and the quote and escape characters are double quotes (")
5252
*
53-
* The delimiters can be encode in and decoded from a QUrl as query items. The
53+
* The delimiters can be encode in and decoded from a QUrl as query items. The
5454
* items used are:
55-
* - delimiterType, one of plain (delimiter is any of a set of characters),
55+
* - delimiterType, one of plain (delimiter is any of a set of characters),
5656
* regexp, csv, whitespace
5757
* - delimiter, interpreted according to the type. For plain characters this is
5858
* a sequence of characters. The string \t in the sequence is replaced by a tab.
59-
* For regexp type delimiters this specifies the reqular expression.
60-
* The field is ignored for csv and whitespace
59+
* For regexp type delimiters this specifies the reqular expression.
60+
* The field is ignored for csv and whitespace
6161
* - quoteChar, optional, a single character used for quoting plain fields
6262
* - escapeChar, optional, a single characer used for escaping (may be the same as quoteChar)
6363
*/
@@ -66,10 +66,10 @@ class QTextStream;
6666
// on an abstract base class in order to facilitate changing the type of the parser easily
6767
// eg in the provider dialog
6868

69-
class QgsDelimitedTextFile
69+
class QgsDelimitedTextFile
7070
{
7171

72-
public:
72+
public:
7373

7474
enum Status
7575
{
@@ -91,14 +91,16 @@ class QgsDelimitedTextFile
9191

9292
virtual ~QgsDelimitedTextFile();
9393

94-
/** Set the filename
94+
/** Set the filename
9595
* @param filename the name of the file
9696
*/
9797
void setFileName( QString filename );
98-
/** Return the filename
98+
/** Return the filename
9999
* @return filename the name of the file
100100
*/
101-
QString fileName(){ return mFileName; }
101+
QString fileName() {
102+
return mFileName;
103+
}
102104

103105
/** Decode the parser settings from a url as a string
104106
* @param url The url from which the delimiter and delimiterType items are read
@@ -125,7 +127,7 @@ class QgsDelimitedTextFile
125127
/** Set the parser to use a character type delimiter.
126128
* @param delim The field delimiter character set
127129
* @param quote The quote character, used to define quoted fields
128-
* @param escape The escape character used to escape quote or delim
130+
* @param escape The escape character used to escape quote or delim
129131
* characters.
130132
*/
131133
void setTypeCSV( QString delim=QString(","), QString quote=QString("\""), QString escape=QString("\"") );
@@ -136,11 +138,15 @@ class QgsDelimitedTextFile
136138
* return an unlimited number of fields
137139
* @param maxFields The maximum number of fields into which a record will be split
138140
*/
139-
void setMaxFields( int maxFields ){ mMaxFields = maxFields; }
141+
void setMaxFields( int maxFields ) {
142+
mMaxFields = maxFields;
143+
}
140144
/* Return the maximum number of fields to return
141-
* @return maxFields The maximum number of fields to return
145+
* @return maxFields The maximum number of fields to return
142146
*/
143-
int maxFields(){ return mMaxFields; }
147+
int maxFields() {
148+
return mMaxFields;
149+
}
144150

145151
/* Set the number of header lines to skip
146152
* @param skiplines The maximum lines to skip
@@ -149,7 +155,9 @@ class QgsDelimitedTextFile
149155
/* Return the number of header lines to skip
150156
* @return skiplines The maximum lines to skip
151157
*/
152-
int skipLines(){ return mSkipLines; }
158+
int skipLines() {
159+
return mSkipLines;
160+
}
153161

154162
/* Set reading column names from the first record
155163
* @param useheaders Column names will be read if true
@@ -158,15 +166,17 @@ class QgsDelimitedTextFile
158166
/* Return the option for reading column names from the first record
159167
* @return useheaders Column names will be read if true
160168
*/
161-
bool useHeader(){ return mUseHeader; }
169+
bool useHeader() {
170+
return mUseHeader;
171+
}
162172

163173
/** Return the column names read from the header, or default names
164174
* Col## if none defined. Will open and read the head of the file
165175
* if required, then reset..
166176
*/
167177
QStringList &columnNames();
168178

169-
/** Reads the next record from the stream splits into string fields.
179+
/** Reads the next record from the stream splits into string fields.
170180
* @param fields The string list to populate with the fields
171181
* @return status The result of trying to parse a record. RecordOk
172182
* if read successfully, RecordEOF if reached the end of the
@@ -178,7 +188,9 @@ class QgsDelimitedTextFile
178188
/** Return the line number of the start of the last record read
179189
* @return linenumber The line number of the start of the record
180190
*/
181-
int recordLineNumber(){ return mRecordLineNumber; }
191+
int recordLineNumber() {
192+
return mRecordLineNumber;
193+
}
182194

183195
/** Reset the file to reread from the beginning
184196
*/
@@ -192,15 +204,21 @@ class QgsDelimitedTextFile
192204
* or a string)
193205
* @return def The delimiter definition string
194206
*/
195-
QString delimiterDefinitionString(){ return mDelimDefinition; }
207+
QString delimiterDefinitionString() {
208+
return mDelimDefinition;
209+
}
196210
/** Return the quote character
197211
* @return quote The quoet character
198212
*/
199-
QString quoteChar(){ return mQuoteChar; }
213+
QString quoteChar() {
214+
return mQuoteChar;
215+
}
200216
/** Return the escape character
201217
* @return escape The escape character
202218
*/
203-
QString escapeChar(){ return mEscapeChar; }
219+
QString escapeChar() {
220+
return mEscapeChar;
221+
}
204222

205223
/** Check that provider is valid (filename and definition valid)
206224
*
@@ -209,7 +227,7 @@ class QgsDelimitedTextFile
209227
bool isValid();
210228

211229

212-
private:
230+
private:
213231

214232
/** Open the file
215233
*
@@ -243,7 +261,7 @@ class QgsDelimitedTextFile
243261
QString mFileName;
244262
QFile *mFile;
245263
QTextStream *mStream;
246-
264+
247265
// Parameters common to parsers
248266
bool mDefinitionValid;
249267
DelimiterType mType;
@@ -260,6 +278,6 @@ class QgsDelimitedTextFile
260278

261279
// Information extracted from file
262280
QStringList mColumnNames;
263-
int mRecordLineNumber;
264281
int mLineNumber;
282+
int mRecordLineNumber;
265283
};

‎src/providers/delimitedtext/qgsdelimitedtextprovider.cpp

Lines changed: 319 additions & 310 deletions
Large diffs are not rendered by default.

‎src/providers/delimitedtext/qgsdelimitedtextprovider.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class QgsDelimitedTextProvider : public QgsVectorDataProvider
4747
{
4848
Q_OBJECT
4949

50-
public:
50+
public:
5151

5252
QgsDelimitedTextProvider( QString uri = QString() );
5353

@@ -150,7 +150,7 @@ class QgsDelimitedTextProvider : public QgsVectorDataProvider
150150
*/
151151
bool boundsCheck( QgsGeometry *geom );
152152

153-
private:
153+
private:
154154
void handleInvalidLines();
155155
void resetStream();
156156

@@ -196,10 +196,10 @@ class QgsDelimitedTextProvider : public QgsVectorDataProvider
196196

197197
struct wkbPoint
198198
{
199-
unsigned char byteOrder;
200-
quint32 wkbType;
201-
double x;
202-
double y;
199+
unsigned char byteOrder;
200+
quint32 wkbType;
201+
double x;
202+
double y;
203203
};
204204
wkbPoint mWKBpt;
205205

‎src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp

Lines changed: 339 additions & 339 deletions
Large diffs are not rendered by default.

‎src/providers/delimitedtext/qgsdelimitedtextsourceselect.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,38 @@ class QgsDelimitedTextSourceSelect : public QDialog, private Ui::QgsDelimitedTex
2929
{
3030
Q_OBJECT
3131

32-
public:
32+
public:
3333
QgsDelimitedTextSourceSelect( QWidget * parent, Qt::WFlags fl = QgisGui::ModalDialogFlags, bool embedded = false );
3434
~QgsDelimitedTextSourceSelect();
3535

3636
QStringList splitLine( QString line );
3737

38-
private:
38+
private:
3939
bool loadDelimitedFileDefinition();
4040
void updateFieldLists();
4141
void getOpenFileName();
4242
QString selectedChars();
4343

44-
private:
44+
private:
4545
QgsDelimitedTextFile *mFile;
4646
int mExampleRowCount;
4747
QString mColumnNamePrefix;
4848
QString mPluginKey;
4949

50-
private slots:
50+
private slots:
5151
void on_buttonBox_accepted();
5252
void on_buttonBox_rejected();
53-
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
53+
void on_buttonBox_helpRequested() {
54+
QgsContextHelp::run( metaObject()->className() );
55+
}
5456
void on_btnBrowseForFile_clicked();
5557

56-
public slots:
58+
public slots:
5759
void updateFileName();
5860
void updateFieldsAndEnable();
5961
void enableAccept();
6062

61-
signals:
63+
signals:
6264
void addVectorLayer( QString, QString, QString );
6365
};
6466

0 commit comments

Comments
 (0)
Please sign in to comment.