summaryrefslogtreecommitdiffstats
path: root/src/value.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-06-29 12:56:53 +0200
committerSlávek Banko <slavek.banko@axis.cz>2013-07-04 03:11:35 +0200
commit5f5e7c5455d52826b0bd50f64fcffb7695ce970d (patch)
treec8ee8792d3fb139365abbf70c2255f1e69d2aa34 /src/value.cpp
parent251c9a439759c830d34c70683d0fc9454d703010 (diff)
downloadkbibtex-5f5e7c5455d52826b0bd50f64fcffb7695ce970d.tar.gz
kbibtex-5f5e7c5455d52826b0bd50f64fcffb7695ce970d.zip
Initial TQt conversion
Diffstat (limited to 'src/value.cpp')
-rw-r--r--src/value.cpp140
1 files changed, 70 insertions, 70 deletions
diff --git a/src/value.cpp b/src/value.cpp
index c31514e..b95e374 100644
--- a/src/value.cpp
+++ b/src/value.cpp
@@ -17,9 +17,9 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#include <qregexp.h>
-#include <qstring.h>
-#include <qstringlist.h>
+#include <ntqregexp.h>
+#include <ntqstring.h>
+#include <ntqstringlist.h>
#include "value.h"
@@ -31,38 +31,38 @@ namespace BibTeX
// nothing
}
- ValueTextInterface::ValueTextInterface( const QString& text ) : m_text( text )
+ ValueTextInterface::ValueTextInterface( const TQString& text ) : m_text( text )
{
// nothing
}
- void ValueTextInterface::setText( const QString& text )
+ void ValueTextInterface::setText( const TQString& text )
{
m_text = text;
}
- QString ValueTextInterface::text() const
+ TQString ValueTextInterface::text() const
{
return m_text;
}
- QString ValueTextInterface::simplifiedText() const
+ TQString ValueTextInterface::simplifiedText() const
{
- return text().replace( QRegExp( "\\\\[A-Za-z0-9]+" ), "" ).replace( '{', "" ).replace( '}', "" );
+ return text().replace( TQRegExp( "\\\\[A-Za-z0-9]+" ), "" ).replace( '{', "" ).replace( '}', "" );
}
- void ValueTextInterface::replace( const QString &before, const QString &after )
+ void ValueTextInterface::replace( const TQString &before, const TQString &after )
{
if ( before == text() || before == simplifiedText() )
setText( after );
}
- bool ValueTextInterface::containsPattern( const QString &pattern, bool caseSensitive )
+ bool ValueTextInterface::containsPattern( const TQString &pattern, bool caseSensitive )
{
return text().contains( pattern, caseSensitive ) || simplifiedText().contains( pattern, caseSensitive );
}
- ValueItem::ValueItem( const QString& text ) : ValueTextInterface( text )
+ ValueItem::ValueItem( const TQString& text ) : ValueTextInterface( text )
{
// nothing
}
@@ -72,7 +72,7 @@ namespace BibTeX
// nothing
}
- Keyword::Keyword( const QString& text ) : ValueTextInterface( text )
+ Keyword::Keyword( const TQString& text ) : ValueTextInterface( text )
{
// nothing
}
@@ -87,18 +87,18 @@ namespace BibTeX
// nothing
}
- KeywordContainer::KeywordContainer( const QString& text ) : ValueItem( text )
+ KeywordContainer::KeywordContainer( const TQString& text ) : ValueItem( text )
{
setText( text );
}
- KeywordContainer::KeywordContainer( KeywordContainer *other ) : ValueItem( QString::null )
+ KeywordContainer::KeywordContainer( KeywordContainer *other ) : ValueItem( TQString::null )
{
- for ( QValueList<Keyword*>::Iterator it = other->keywords.begin(); it != other->keywords.end(); ++it )
+ for ( TQValueList<Keyword*>::Iterator it = other->keywords.begin(); it != other->keywords.end(); ++it )
keywords.append(( *it )->clone() );
}
- KeywordContainer::KeywordContainer( const QStringList& list ) : ValueItem( QString::null )
+ KeywordContainer::KeywordContainer( const TQStringList& list ) : ValueItem( TQString::null )
{
setList( list );
}
@@ -108,56 +108,56 @@ namespace BibTeX
return new KeywordContainer( this );
}
- void KeywordContainer::setList( const QStringList& list )
+ void KeywordContainer::setList( const TQStringList& list )
{
keywords.clear();
- for ( QStringList::ConstIterator it = list.begin(); it != list.end(); ++it )
+ for ( TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it )
keywords.append( new Keyword( *it ) );
}
- void KeywordContainer::append( const QString& text )
+ void KeywordContainer::append( const TQString& text )
{
bool contains = FALSE;
- for ( QValueList<Keyword*>::ConstIterator it = keywords.begin(); !contains && it != keywords.end(); ++it )
- contains = QString::compare(( *it )->text(), text ) == 0;
+ for ( TQValueList<Keyword*>::ConstIterator it = keywords.begin(); !contains && it != keywords.end(); ++it )
+ contains = TQString::compare(( *it )->text(), text ) == 0;
if ( contains == 0 )
keywords.append( new Keyword( text ) );
}
- void KeywordContainer::remove( const QString& text )
+ void KeywordContainer::remove( const TQString& text )
{
bool contains = FALSE;
- for ( QValueList<Keyword*>::Iterator it = keywords.begin(); !contains && it != keywords.end(); ++it )
- if ( QString::compare(( *it )->text(), text ) == 0 )
+ for ( TQValueList<Keyword*>::Iterator it = keywords.begin(); !contains && it != keywords.end(); ++it )
+ if ( TQString::compare(( *it )->text(), text ) == 0 )
{
keywords.remove( it );
break;
}
}
- void KeywordContainer::setText( const QString& text )
+ void KeywordContainer::setText( const TQString& text )
{
ValueItem::setText( text );
- QRegExp splitRegExp;
+ TQRegExp splitRegExp;
if ( text.contains( ";" ) )
- splitRegExp = QRegExp( "\\s*;\\s*" );
+ splitRegExp = TQRegExp( "\\s*;\\s*" );
else
- splitRegExp = QRegExp( "\\s*,\\s*" );
+ splitRegExp = TQRegExp( "\\s*,\\s*" );
keywords.clear();
- QStringList keywordList = QStringList::split( splitRegExp, text, FALSE );
- for ( QStringList::ConstIterator it = keywordList.begin(); it != keywordList.end(); ++it )
+ TQStringList keywordList = TQStringList::split( splitRegExp, text, FALSE );
+ for ( TQStringList::ConstIterator it = keywordList.begin(); it != keywordList.end(); ++it )
keywords.append( new Keyword( *it ) );
}
- QString KeywordContainer::text() const
+ TQString KeywordContainer::text() const
{
- QString result;
+ TQString result;
bool first = true;
- for ( QValueList<Keyword*>::ConstIterator it = keywords.begin(); it != keywords.end(); ++it )
+ for ( TQValueList<Keyword*>::ConstIterator it = keywords.begin(); it != keywords.end(); ++it )
{
if ( !first )
result.append( "; " );
@@ -167,18 +167,18 @@ namespace BibTeX
return result;
}
- void KeywordContainer::replace( const QString &before, const QString &after )
+ void KeywordContainer::replace( const TQString &before, const TQString &after )
{
- for ( QValueList<Keyword*>::ConstIterator it = keywords.begin(); it != keywords.end(); ++it )
+ for ( TQValueList<Keyword*>::ConstIterator it = keywords.begin(); it != keywords.end(); ++it )
( *it )->replace( before, after );
}
- Person::Person( const QString& text, bool firstNameFirst ) : ValueTextInterface( text ), m_firstNameFirst( firstNameFirst )
+ Person::Person( const TQString& text, bool firstNameFirst ) : ValueTextInterface( text ), m_firstNameFirst( firstNameFirst )
{
setText( text );
}
- Person::Person( const QString& firstName, const QString& lastName, bool firstNameFirst ) : ValueTextInterface( QString( firstName ).append( " " ).append( lastName ) ), m_firstName( firstName ), m_lastName( lastName ), m_firstNameFirst( firstNameFirst )
+ Person::Person( const TQString& firstName, const TQString& lastName, bool firstNameFirst ) : ValueTextInterface( TQString( firstName ).append( " " ).append( lastName ) ), m_firstName( firstName ), m_lastName( lastName ), m_firstNameFirst( firstNameFirst )
{
// nothing
}
@@ -188,11 +188,11 @@ namespace BibTeX
return new Person( m_firstName, m_lastName, m_firstNameFirst );
}
- void Person::setText( const QString& text )
+ void Person::setText( const TQString& text )
{
ValueTextInterface::setText( text );
- QStringList segments;
+ TQStringList segments;
bool containsComma = splitName( text, segments );
m_firstName = "";
m_lastName = "";
@@ -242,7 +242,7 @@ namespace BibTeX
{
/** there are segments left for the first name */
m_firstName = *segments.begin();
- for ( QStringList::Iterator it = ++segments.begin(); from > 1; ++it, --from )
+ for ( TQStringList::Iterator it = ++segments.begin(); from > 1; ++it, --from )
{
m_firstName.append( " " );
m_firstName.append( *it );
@@ -271,12 +271,12 @@ namespace BibTeX
}
}
- QString Person::text() const
+ TQString Person::text() const
{
return text( m_firstNameFirst );
}
- QString Person::text( bool firstNameFirst ) const
+ TQString Person::text( bool firstNameFirst ) const
{
if ( m_firstName.isEmpty() )
@@ -285,21 +285,21 @@ namespace BibTeX
return firstNameFirst ? m_firstName + " " + m_lastName : m_lastName + ", " + m_firstName;
}
- QString Person::firstName()
+ TQString Person::firstName()
{
return m_firstName;
}
- QString Person::lastName()
+ TQString Person::lastName()
{
return m_lastName;
}
/** Splits a name into single words. If the name's text was reversed (Last, First), the result will be true and the comma will be added to segments. Otherwise the functions result will be false. This function respects protecting {...}. */
- bool Person::splitName( const QString& text, QStringList& segments )
+ bool Person::splitName( const TQString& text, TQStringList& segments )
{
int bracketCounter = 0;
bool result = FALSE;
- QString buffer = "";
+ TQString buffer = "";
for ( unsigned int pos = 0; pos < text.length(); ++pos )
{
@@ -336,12 +336,12 @@ namespace BibTeX
return result;
}
- PersonContainer::PersonContainer( bool firstNameFirst ) : ValueItem( QString::null ), m_firstNameFirst( firstNameFirst )
+ PersonContainer::PersonContainer( bool firstNameFirst ) : ValueItem( TQString::null ), m_firstNameFirst( firstNameFirst )
{
// nothing
}
- PersonContainer::PersonContainer( const QString& text, bool firstNameFirst ) : ValueItem( text ), m_firstNameFirst( firstNameFirst )
+ PersonContainer::PersonContainer( const TQString& text, bool firstNameFirst ) : ValueItem( text ), m_firstNameFirst( firstNameFirst )
{
persons.append( new Person( text, m_firstNameFirst ) );
}
@@ -349,24 +349,24 @@ namespace BibTeX
ValueItem *PersonContainer::clone()
{
PersonContainer *result = new PersonContainer( m_firstNameFirst );
- for ( QValueList<Person*>::ConstIterator it = persons.begin(); it != persons.end(); ++it )
+ for ( TQValueList<Person*>::ConstIterator it = persons.begin(); it != persons.end(); ++it )
result->persons.append(( *it )->clone() );
return result;
}
- void PersonContainer::setText( const QString& text )
+ void PersonContainer::setText( const TQString& text )
{
ValueTextInterface::setText( text );
- qDebug( "You cannot set a text ('%s') to a Value object", text.latin1() );
+ tqDebug( "You cannot set a text ('%s') to a Value object", text.latin1() );
}
- QString PersonContainer::text() const
+ TQString PersonContainer::text() const
{
- QString result;
+ TQString result;
bool first = TRUE;
- for ( QValueList<Person*>::ConstIterator it = persons.begin(); it != persons.end(); ++it )
+ for ( TQValueList<Person*>::ConstIterator it = persons.begin(); it != persons.end(); ++it )
{
if ( !first )
result.append( " and " );
@@ -378,13 +378,13 @@ namespace BibTeX
return result;
}
- void PersonContainer::replace( const QString &before, const QString &after )
+ void PersonContainer::replace( const TQString &before, const TQString &after )
{
- for ( QValueList<Person*>::ConstIterator it = persons.begin(); it != persons.end(); ++it )
+ for ( TQValueList<Person*>::ConstIterator it = persons.begin(); it != persons.end(); ++it )
( *it )->replace( before, after );
}
- MacroKey::MacroKey( const QString& text ) : ValueItem( text )
+ MacroKey::MacroKey( const TQString& text ) : ValueItem( text )
{
m_isValid = isValidInternal();
}
@@ -394,7 +394,7 @@ namespace BibTeX
return new MacroKey( text() );
}
- void MacroKey::setText( const QString& text )
+ void MacroKey::setText( const TQString& text )
{
ValueItem::setText( text );
m_isValid = isValidInternal();
@@ -407,10 +407,10 @@ namespace BibTeX
bool MacroKey::isValidInternal()
{
- return !text().contains( QRegExp( "![-.:/+_a-zA-Z0-9]" ) );
+ return !text().contains( TQRegExp( "![-.:/+_a-zA-Z0-9]" ) );
}
- PlainText::PlainText( const QString& text ) : ValueItem( text )
+ PlainText::PlainText( const TQString& text ) : ValueItem( text )
{
// nothing
}
@@ -420,18 +420,18 @@ namespace BibTeX
return new PlainText( text() );
}
- Value::Value() : ValueTextInterface( QString::null )
+ Value::Value() : ValueTextInterface( TQString::null )
{
// nothing
}
Value::Value( const Value *other ) : ValueTextInterface( other )
{
- for ( QValueList<ValueItem*>::ConstIterator it = other->items.begin(); it != other->items.end(); ++it )
+ for ( TQValueList<ValueItem*>::ConstIterator it = other->items.begin(); it != other->items.end(); ++it )
items.append(( *it )->clone() );
}
- Value::Value( const QString& text, bool isMacroKey ): ValueTextInterface( text )
+ Value::Value( const TQString& text, bool isMacroKey ): ValueTextInterface( text )
{
ValueItem *item = NULL;
if ( isMacroKey )
@@ -441,25 +441,25 @@ namespace BibTeX
items.append( item );
}
- void Value::setText( const QString& text )
+ void Value::setText( const TQString& text )
{
ValueTextInterface::setText( text );
- qDebug( "You cannot set a text ('%s') to a Value object", text.latin1() );
+ tqDebug( "You cannot set a text ('%s') to a Value object", text.latin1() );
}
- QString Value::text() const
+ TQString Value::text() const
{
- QString result;
+ TQString result;
- for ( QValueList<ValueItem*>::ConstIterator it = items.begin(); it != items.end(); ++it )
+ for ( TQValueList<ValueItem*>::ConstIterator it = items.begin(); it != items.end(); ++it )
result.append(( *it )->text() );
return result;
}
- void Value::replace( const QString &before, const QString &after )
+ void Value::replace( const TQString &before, const TQString &after )
{
- for ( QValueList<ValueItem*>::ConstIterator it = items.begin(); it != items.end(); ++it )
+ for ( TQValueList<ValueItem*>::ConstIterator it = items.begin(); it != items.end(); ++it )
( *it )->replace( before, after );
}
}