aboutsummaryrefslogtreecommitdiff
path: root/src/csvreader.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-04-07 15:10:28 +0000
committerMike Buland <eichlan@xagasoft.com>2010-04-07 15:10:28 +0000
commit6cdf5615a2729df486def3fae2e6f548a34fb83b (patch)
treedd8caca0e9c225316b4a2ea95cafccbce9648966 /src/csvreader.cpp
parentdb45c881d98f2288aa26960e5eae6070f792b82a (diff)
downloadlibbu++-6cdf5615a2729df486def3fae2e6f548a34fb83b.tar.gz
libbu++-6cdf5615a2729df486def3fae2e6f548a34fb83b.tar.bz2
libbu++-6cdf5615a2729df486def3fae2e6f548a34fb83b.tar.xz
libbu++-6cdf5615a2729df486def3fae2e6f548a34fb83b.zip
Cache updates, mainly helper typedefs to make it easier to work with a cache
without knowing everything about it's keytype and whatnot. Minor fixes to the csv end-of-line handling.
Diffstat (limited to 'src/csvreader.cpp')
-rw-r--r--src/csvreader.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/csvreader.cpp b/src/csvreader.cpp
index c63fe06..ef7a326 100644
--- a/src/csvreader.cpp
+++ b/src/csvreader.cpp
@@ -43,6 +43,9 @@ Bu::StrArray Bu::CsvReader::readLine()
43 43
44 Bu::FString sLine = sIn.readLine(); 44 Bu::FString sLine = sIn.readLine();
45 45
46 if( !sLine.isSet() )
47 return Bu::StrArray();
48
46 Bu::FString::iterator i = sLine.begin(); 49 Bu::FString::iterator i = sLine.begin();
47 50
48 aVals.append( sDecode( i ) ); 51 aVals.append( sDecode( i ) );
@@ -52,6 +55,8 @@ Bu::StrArray Bu::CsvReader::readLine()
52 if( *i == ',' ) 55 if( *i == ',' )
53 { 56 {
54 i++; 57 i++;
58 if( !i )
59 break;
55 aVals.append( sDecode( i ) ); 60 aVals.append( sDecode( i ) );
56 } 61 }
57 else 62 else
@@ -81,7 +86,11 @@ Bu::FString Bu::CsvReader::decodeExcel( Bu::FString::iterator &i )
81 if( *i == '\"' ) 86 if( *i == '\"' )
82 { 87 {
83 i++; 88 i++;
84 if( *i == '\"' ) 89 if( !i )
90 {
91 return sRet;
92 }
93 else if( *i == '\"' )
85 { 94 {
86 sRet += *i; 95 sRet += *i;
87 } 96 }