Update of /cvsroot/mahogany/M/src/modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24368/src/modules

Modified Files:
        BareBonesEditor.cpp 
Log Message:
don't use isupper() with non-ASCII characters; simplified/cleaned up the code slightly

Index: BareBonesEditor.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/BareBonesEditor.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -b -u -2 -r1.28 -r1.29
--- BareBonesEditor.cpp 5 May 2004 21:44:28 -0000       1.28
+++ BareBonesEditor.cpp 12 May 2004 21:58:38 -0000      1.29
@@ -168,5 +168,5 @@
    void First();
    void Next();
-   bool Empty() { return m_from == m_to; }
+   bool IsEmpty() const { return m_from == m_to; }
    void Format();
    void Unformat();
@@ -181,5 +181,5 @@
    void Set(const String &modified);
    int LineToPosition(int line);
-   bool IsQuoted();
+   bool IsQuoted() const;
    String UnformatCommon();
    String FormatCommon();
@@ -412,5 +412,5 @@
 void FormattedParagraph::Format()
 {
-   if(!Empty() && !IsQuoted())
+   if(!IsEmpty() && !IsQuoted())
       Set(FormatCommon());
 }
@@ -418,5 +418,5 @@
 void FormattedParagraph::Unformat()
 {
-   if(!Empty() && !IsQuoted())
+   if(!IsEmpty() && !IsQuoted())
       Set(UnformatCommon());
 }
@@ -451,19 +451,13 @@
 }
 
-bool FormattedParagraph::IsQuoted()
+bool FormattedParagraph::IsQuoted() const
 {
-   int line;
-   for(line = m_from; line < m_to; ++line)
+   for ( int line = m_from; line < m_to; ++line )
    {
-      String content(m_control->GetLineText(line));
-      int offset;
-      for(offset = 0; content.size()-offset >= m_prefix.size()
-         && (!offset || isupper(content[(size_t)(offset-1)])); ++offset)
-      {
-         if(content.compare(offset,m_prefix.size(),m_prefix) == 0)
-            return true;
-      }
-   }
+      if ( !m_control->GetLineText(line).StartsWith(m_prefix) )
    return false;
+   }
+
+   return true;
 }
 
@@ -483,5 +477,5 @@
 bool FormattedParagraph::NeedsFormat()
 {
-   return !Empty() && !IsQuoted() && Get() != FormatCommon();
+   return !IsEmpty() && !IsQuoted() && Get() != FormatCommon();
 }
 
@@ -489,5 +483,5 @@
 {
    FindSignature();
-   for(First(); !Empty() && !PastSignature(); Next())
+   for(First(); !IsEmpty() && !PastSignature(); Next())
       Format();
 }
@@ -496,5 +490,5 @@
 {
    FindSignature();
-   for(First(); !Empty() && !PastSignature(); Next())
+   for(First(); !IsEmpty() && !PastSignature(); Next())
       Unformat();
 }
@@ -965,5 +959,5 @@
 
    bool needsFormat = false;
-   for(paragraph.First(); !paragraph.Empty(); paragraph.Next())
+   for(paragraph.First(); !paragraph.IsEmpty(); paragraph.Next())
       needsFormat = needsFormat || paragraph.NeedsFormat();
 



-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to