Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

DatabaseReadString.h

Go to the documentation of this file.
00001 #ifndef Impala_Util_DatabaseReadString_h
00002 #define Impala_Util_DatabaseReadString_h
00003 
00004 #include <vector>
00005 #include "Util/Database.h"
00006 
00007 namespace Impala
00008 {
00009 namespace Util
00010 {
00011 
00012 
00013 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00014     // Replaced with IOBuffer::ReadStrings and File::ReadStrings
00015 template<class BackInsertIterator>
00016 inline void
00017 DatabaseReadString(BackInsertIterator bi, IOBuffer* buf, bool skipEC, int count)
00018 {
00019     if (! (buf && buf->Valid()))
00020     {
00021         return;
00022     }
00023     int c=0;
00024     while (buf->Available())
00025     {
00026         String line = buf->ReadLine();
00027         if (line[0] || !skipEC)
00028         {
00029             if ((line[0] != '#') || !skipEC)
00030                 *bi++ = line;
00031         }
00032         if (++c==count)
00033             break;
00034     }
00035 }
00036 
00037 template<class BackInsertIterator>
00038 inline void
00039 DatabaseReadString(BackInsertIterator bi, String fileName, Database* db,
00040                    bool skipEC, int count = -1)
00041 {
00042     IOBuffer* buf = db->GetIOBuffer(fileName, true, true, "");
00043 
00044     DatabaseReadString(bi, buf, skipEC, count);
00045     
00046     delete buf;
00047 }
00048 
00049 inline void
00050 DatabaseReadStrings(std::vector<String>& stringList, CString filename,
00051                     Database* db)
00052 {
00053     DatabaseReadString(std::back_inserter(stringList), filename, db, true, -1);
00054 }
00055 #endif // REPOSITORY_USED
00056 
00057 
00058 } // namespace Util
00059 } // namespace Impala
00060 
00061 #endif

Generated on Fri Mar 19 09:31:46 2010 for ImpalaSrc by  doxygen 1.5.1