X-Git-Url: http://git.pippins.net/embedvideo/.git/?a=blobdiff_plain;f=main.cc;fp=main.cc;h=8ffd418cc9ec289ae0ab8dc8eaa33dc23ad1ed3c;hb=10f79645bbc320f9b1375e7143079c953f63ab23;hp=dbd96a0c0f56b7fb3b947a3687ff1f43dfe6cb73;hpb=b6878571e12b7d5de53721f12e8fb956d07e44d6;p=backups%2F.git diff --git a/main.cc b/main.cc index dbd96a0..8ffd418 100644 --- a/main.cc +++ b/main.cc @@ -3,9 +3,12 @@ #include #include #include +#include #include +#include "filedata.hpp" + using namespace std; vector split( const string &line, char c, int limit = -1 ) { @@ -58,19 +61,29 @@ void sql_experimenting() { } int main() { -// string file_string; -// do { -// file_string.clear(); -// for( int c = cin.get(); 0 != c && ! cin.eof(); c = cin.get() ) { -// file_string.push_back( c ); -// } -// if( 0 != file_string.size() ) { -// // Example entry -// // type perms user group size datemodified name (7 total) -// // f 0600 cnb cnb 424 20051015205340 ./.git/index -// vector values = split( file_string, ' ', 7 ); -// } -// } while( ! cin.eof() ); + string file_string; + set current_files; + + // Parse the list of files on stdin + do { + file_string.clear(); + for( int c = cin.get(); 0 != c && ! cin.eof(); c = cin.get() ) { + file_string.push_back( c ); + } + if( 0 != file_string.size() ) { + // Example entry + // type perms user group size datemodified name (7 total) + // f 0600 cnb cnb 424 20051015205340 ./.git/index + vector vals = split( file_string, ' ', 7 ); + current_files.insert( new FileData( vals[0][0], + vals[1], + vals[2], + vals[3], + atoi( vals[4].c_str() ), + atoi( vals[5].c_str() ), + vals[6]) ); + } + } while( ! cin.eof() ); - sql_experimenting(); + set previous_files; }