Author: aschnell
Date: Mon Nov 10 23:10:30 2008
New Revision: 53152
URL: http://svn.opensuse.org/viewcvs/yast?rev=53152&view=rev
Log:
- some cleanup
Modified:
trunk/storage/libstorage/src/AsciiFile.cc
trunk/storage/libstorage/src/AsciiFile.h
Modified: trunk/storage/libstorage/src/AsciiFile.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/AsciiFile.cc?rev=53152&r1=53151&r2=53152&view=diff
==============================================================================
--- trunk/storage/libstorage/src/AsciiFile.cc (original)
+++ trunk/storage/libstorage/src/AsciiFile.cc Mon Nov 10 23:10:30 2008
@@ -16,7 +16,6 @@
using namespace std;
using namespace storage;
-#define DBG(x)
AsciiFile::AsciiFile( bool CreateBackup_bv, const char* BackupExt_Cv ) :
BackupCreated_b(!CreateBackup_bv),
@@ -48,28 +47,26 @@
{
bool Ret_bi;
- y2milestone( "Loading File:\"%s\"", Name_Cv.c_str() );
+ y2mil("Loading File:\"" << Name_Cv << "\"");
Lines_C.clear();
Ret_bi = appendFile( Name_Cv, Lines_C );
Name_C = Name_Cv;
- return( Ret_bi );
+ return Ret_bi;
}
const string& AsciiFile::fileName() const
{
- return( Name_C );
+ return Name_C;
}
bool AsciiFile::appendFile( const string& Name_Cv )
{
- DBG( App_pC->Dbg() << "Appending File:\"" << Name_Cv << "\"\n"; )
- return( appendFile( Name_Cv, Lines_C ) );
+ return appendFile( Name_Cv, Lines_C );
}
bool AsciiFile::appendFile( AsciiFile& File_Cv )
{
- DBG( App_pC->Dbg() << "Appending AsciiFile Lines:" << File_Cv.numLines() << "\n"; )
- return( appendFile( File_Cv, Lines_C ) );
+ return appendFile( File_Cv, Lines_C );
}
bool AsciiFile::appendFile( const string& Name_Cv, vector<string>& Lines_Cr )
@@ -86,7 +83,7 @@
Lines_Cr.push_back( Line_Ci );
getline( File_Ci, Line_Ci );
}
- return( Ret_bi );
+ return Ret_bi;
}
bool AsciiFile::appendFile( AsciiFile& File_Cv, vector<string>& Lines_Cr )
@@ -98,7 +95,7 @@
Lines_Cr.push_back( File_Cv[Idx_ii] );
Idx_ii++;
}
- return( true );
+ return true;
}
bool AsciiFile::insertFile( const string& Name_Cv, unsigned int BeforeLine_iv )
@@ -125,7 +122,7 @@
}
Lines_C = New_Ci;
}
- return( Ret_bi );
+ return Ret_bi;
}
bool AsciiFile::insertFile( AsciiFile& File_Cv, unsigned int BeforeLine_iv )
@@ -134,8 +131,6 @@
vector<string> New_Ci;
bool Ret_bi;
- DBG( App_pC->Dbg() << "Inserting AsciiFile Lines:" << File_Cv.numLines()
- << " before:" << BeforeLine_iv << endl; )
unsigned int Idx_ii=0;
while( Idx_iiDbg() << "Writing File:\"" << Name_C << "\"\n"; )
while( File_Ci.good() && Idx_iiDbg() << "SaveToFile File:\"" << Name_Cv << "\"\n"; )
while( File_Ci.good() && Idx_ii < Lines_C.size() )
{
File_Ci << Lines_C[Idx_ii] << std::endl;
Idx_ii++;
}
- return( File_Ci.good() );
+ return File_Ci.good();
}
@@ -228,7 +221,6 @@
string::size_type Idx_ii;
string Line_Ci = Line_Cv;
- DBG( App_pC->Dbg() << "Append Line:\"" << Line_Ci << "\"\n"; )
removeLastIf( Line_Ci, '\n' );
while( (Idx_ii=Line_Ci.find( '\n' ))!= string::npos )
{
@@ -262,9 +254,6 @@
void AsciiFile::remove( unsigned int Start_iv, unsigned int Cnt_iv )
{
- DBG( App_pC->Dbg() << "Delete Line From:" << Start_iv
- << " Length:" << Cnt_iv << "\n"; )
- DBG( App_pC->Dbg() << "Before Delete Lines:" << Lines_C.size() << std::endl; );
Start_iv = max( 0u, Start_iv );
if( Start_iv < Lines_C.size() )
{
@@ -278,15 +267,11 @@
Lines_C.pop_back();
}
}
- DBG( App_pC->Dbg() << "After Delete Lines:" << Lines_C.size() << std::endl; );
}
void AsciiFile::insert( unsigned int Before_iv, const string& Line_Cv )
{
unsigned int Idx_ii = Lines_C.size();
- DBG( App_pC->Dbg() << "Insert Line Before:" << Before_iv
- << " High:" << Lines_C.size()
- << " Text:\"" << Line_Cv << "\"\n"; )
if( Before_iv>=Idx_ii )
{
append( Line_Cv );
@@ -324,13 +309,13 @@
const string& AsciiFile::operator [] ( unsigned int Idx_iv ) const
{
assert( Idx_iv < Lines_C.size( ) );
- return( Lines_C[Idx_iv] );
+ return Lines_C[Idx_iv];
}
string& AsciiFile::operator [] ( unsigned int Idx_iv )
{
assert( Idx_iv < Lines_C.size( ) );
- return( Lines_C[Idx_iv] );
+ return Lines_C[Idx_iv];
}
int AsciiFile::find( unsigned Start_iv, Regex& Pat_Cv ) const
@@ -348,13 +333,7 @@
Idx_ii++;
}
}
- DBG( App_pC->Dbg() << "Found Idx:" << Ret_ii
- << " Start:" << Start_iv << std::endl; )
- if( Ret_ii>=0 )
- {
- DBG( App_pC->Dbg() << "Line:\"" << Lines_C[Idx_ii] << "\"\n"; )
- }
- return( Ret_ii );
+ return Ret_ii;
}
int AsciiFile::find( unsigned int Start_iv, const string& Pat_Cv ) const
@@ -387,18 +366,12 @@
Idx_ii++;
}
}
- DBG( App_pC->Dbg() << "Found Idx:" << Ret_ii
- << " Start:" << Start_iv << std::endl; )
- if( Ret_ii>=0 )
- {
- DBG( App_pC->Dbg() << "Line:\"" << Lines_C[Idx_ii] << "\"\n"; )
- }
- return( Ret_ii );
+ return Ret_ii;
}
unsigned AsciiFile::numLines() const
{
- return( Lines_C.size() );
+ return Lines_C.size();
}
unsigned AsciiFile::differentLine( const AsciiFile& File_Cv ) const
@@ -418,7 +391,7 @@
{
Ret_ii = Cnt_ii;
}
- return( Ret_ii );
+ return Ret_ii;
}
@@ -427,21 +400,3 @@
if (Text_Cr.length() > 0 && Text_Cr[Text_Cr.length() - 1] == Char_cv)
Text_Cr.erase(Text_Cr.length() - 1);
}
-
-
-#if 0
-void AsciiFile::put( const Regex& Pat_Cv, const String& Line_Cv )
- {
- int Idx_ii;
-
- if( (Idx_ii=Find( 0, Pat_Cv ))>=0 )
- {
- (*this)[Idx_ii] = Line_Cv;
- }
- else
- {
- append( Line_Cv );
- }
- }
-
-#endif
Modified: trunk/storage/libstorage/src/AsciiFile.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/AsciiFile.h?rev=53152&r1=53151&r2=53152&view=diff
==============================================================================
--- trunk/storage/libstorage/src/AsciiFile.h (original)
+++ trunk/storage/libstorage/src/AsciiFile.h Mon Nov 10 23:10:30 2008
@@ -11,12 +11,7 @@
class Regex;
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : AsciiFile
-//
-// DESCRIPTION :
-//
+
class AsciiFile
{
public:
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org