Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

AsciiFile.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // Maintainer: fehr@suse.de
00003 
00004 #ifndef _AsciiFile_h
00005 #define _AsciiFile_h
00006 
00007 #include <vector>
00008 #include <list>
00009 
00010 class Regex;
00011 
00012 using std::string;
00013 
00014 #define DBG(x)
00015 
00017 //
00018 //      CLASS NAME : AsciiFile
00019 //
00020 //      DESCRIPTION :
00021 //
00022 class AsciiFile
00023     {
00024     public:
00025         AsciiFile( bool CreateBackup_bv=false, 
00026                    const char* BackupExt_Cv=".orig" );
00027         AsciiFile( const string& Name_Cv, bool CreateBackup_bv=false, 
00028                    const char* BackupExt_Cv=".orig" );
00029         AsciiFile( const char* Name_Cv, bool CreateBackup_bv=false, 
00030                    const char* BackupExt_Cv=".orig" );
00031         ~AsciiFile();
00032         bool insertFile( AsciiFile& File_Cv, unsigned int BeforeLine_iv=0 );
00033         bool appendFile( AsciiFile& File_Cv );
00034         bool insertFile( const string& Name_Cv, unsigned int BeforeLine_iv=0 );
00035         bool appendFile( const string& Name_Cv );
00036         bool loadFile( const string& Name_Cv );
00037         bool updateFile();
00038         bool saveToFile( const string& Name_Cv );
00039         void append( const string& Line_Cv );
00040         void append( const std::list<string>& Lines_Cv );
00041         void insert( unsigned int Before_iv, const string& Line_Cv );
00042         void remove( unsigned int Start_iv, unsigned int Cnt_iv );
00043         void replace( unsigned int Start_iv, unsigned int Cnt_iv,
00044                       const string& Line_Cv );
00045         void replace( unsigned int Start_iv, unsigned int Cnt_iv,
00046                       const std::list<string>& Line_Cv );
00047         const string& operator []( unsigned int Index_iv ) const;
00048         string& operator []( unsigned int Index_iv );
00049         int find( unsigned int Start_iv, const string& Pat_Cv );
00050         int find( unsigned int Start_iv, Regex& Pat_Cv );
00051         unsigned numLines() const; 
00052         const string& fileName();
00053         unsigned differentLine( const AsciiFile& File_Cv ) const;
00054 
00055     protected:
00056         bool appendFile( const string&  Name_Cv, std::vector<string>& Lines_Cr );
00057         bool appendFile( AsciiFile& File_Cv, std::vector<string>& Lines_Cr );
00058 
00059         bool BackupCreated_b;
00060         string BackupExtension_C;
00061         std::vector<string> Lines_C;
00062         string Name_C;
00063     };
00065 
00066 #endif

Generated on Wed Sep 14 11:27:07 2005 for yast2-storage by  doxygen 1.4.4