From dbe91a6d91e4f1dbfda22f9def90b8010d6d8951 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Wed, 9 Dec 2009 00:34:17 +0000 Subject: [PATCH] added: Patter::delete_all_white flag if true all text-items which have only white characters (with new lines as well) will be deleted this not actually delete the whole item but only the string the item will be present with an empty string default: false git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@260 e52654a7-88a9-db11-a3e9-0013d4bc506e --- src/ezc.cpp | 37 ++++++++++++++++++++++++++++++++++--- src/ezc.h | 13 ++++++++++++- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/ezc.cpp b/src/ezc.cpp index 84d0be1..6011c10 100644 --- a/src/ezc.cpp +++ b/src/ezc.cpp @@ -121,7 +121,8 @@ void SplitUnixDirectory(const std::string & name, std::string & dir, std::string Pattern::Pattern() { - allow_include = true; + allow_include = true; + delete_all_white = false; } @@ -237,13 +238,40 @@ return *(itext++); } +bool Pattern::IsWhite(int c ) +{ + if( c==' ' || c=='\t' || c==13 ) + return true; + +return false; +} + + void Pattern::SkipWhiteCharacters() { - while( *itext==' ' || *itext=='\t' ) + while( IsWhite(*itext) ) ++itext; } +void Pattern::CheckWhiteAndDelete(std::string & s) +{ +std::string::size_type i; + + if( s.empty() ) + return; + + for(i=0 ; i