summaryrefslogtreecommitdiffstats
path: root/src/fileexporterbibtex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fileexporterbibtex.cpp')
-rw-r--r--src/fileexporterbibtex.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/fileexporterbibtex.cpp b/src/fileexporterbibtex.cpp
index 598f3bf..011322e 100644
--- a/src/fileexporterbibtex.cpp
+++ b/src/fileexporterbibtex.cpp
@@ -32,7 +32,7 @@ namespace BibTeX
{
FileExporterBibTeX::FileExporterBibTeX() : FileExporter(),
- m_iconvBufferSize( 16384 ), m_stringOpenDelimiter( '"' ), m_stringCloseDelimiter( '"' ), m_keywordCasing( kcCamelCase ), m_encoding( "latex" ), m_protectCasing( FALSE ), cancelFlag( FALSE )
+ m_iconvBufferSize( 16384 ), m_stringOpenDelimiter( '"' ), m_stringCloseDelimiter( '"' ), m_keywordCasing( kcCamelCase ), m_encoding( "latex" ), m_protectCasing( false ), cancelFlag( false )
{
m_iconvBuffer = new char[m_iconvBufferSize];
}
@@ -45,7 +45,7 @@ namespace BibTeX
bool FileExporterBibTeX::save( TQIODevice* iodevice, const File* bibtexfile, TQStringList * /*errorLog*/ )
{
m_mutex.lock();
- bool result = TRUE;
+ bool result = true;
/**
* Categorize elements from the bib file into four groups,
@@ -148,7 +148,7 @@ namespace BibTeX
bool FileExporterBibTeX::save( TQIODevice* iodevice, const Element* element, TQStringList * /*errorLog*/ )
{
m_mutex.lock();
- bool result = FALSE;
+ bool result = false;
const char *encodingTo = m_encoding == "latex" ? "utf-8\0" : m_encoding.append( "\0" ).ascii();
m_iconvHandle = iconv_open( encodingTo, "utf-8" );
@@ -182,7 +182,7 @@ namespace BibTeX
void FileExporterBibTeX::cancel()
{
- cancelFlag = TRUE;
+ cancelFlag = true;
}
bool FileExporterBibTeX::writeEntry( TQIODevice &device, const Entry* entry )
@@ -198,7 +198,7 @@ namespace BibTeX
writeString( device, TQString( ",\n\t%1 = %2" ).arg( field->fieldTypeName() ).arg( text ) );
}
writeString( device, "\n}\n\n" );
- return TRUE;
+ return true;
}
bool FileExporterBibTeX::writeMacro( TQIODevice &device, const Macro *macro )
@@ -209,7 +209,7 @@ namespace BibTeX
writeString( device, TQString( "@%1{ %2 = %3 }\n\n" ).arg( applyKeywordCasing( "String" ) ).arg( macro->key() ).arg( text ) );
- return TRUE;
+ return true;
}
bool FileExporterBibTeX::writeComment( TQIODevice &device, const Comment *comment )
@@ -237,14 +237,14 @@ namespace BibTeX
writeString( device, TQString( "@%1{%2}\n\n" ).arg( applyKeywordCasing( "Comment" ) ).arg( text ) );
}
- return TRUE;
+ return true;
}
bool FileExporterBibTeX::writePreamble( TQIODevice &device, const Preamble* preamble )
{
writeString( device, TQString( "@%1{%2}\n\n" ).arg( applyKeywordCasing( "Preamble" ) ).arg( valueToString( preamble->value() ) ) );
- return TRUE;
+ return true;
}
bool FileExporterBibTeX::writeString( TQIODevice &device, const TQString& text )
@@ -299,7 +299,7 @@ namespace BibTeX
return "";
TQString result;
- bool isFirst = TRUE;
+ bool isFirst = true;
EncoderLaTeX *encoder = EncoderLaTeX::currentEncoderLaTeX();
for ( TQValueList<ValueItem*>::ConstIterator it = value->items.begin(); it != value->items.end(); ++it )
@@ -307,7 +307,7 @@ namespace BibTeX
if ( !isFirst )
result.append( " # " );
else
- isFirst = FALSE;
+ isFirst = false;
MacroKey *macroKey = dynamic_cast<MacroKey*>( *it );
if ( macroKey != NULL )
@@ -323,30 +323,30 @@ namespace BibTeX
text = plainText->text();
else if ( keywordContainer != NULL )
{
- bool first = TRUE;
+ bool first = true;
for ( TQValueList<Keyword*>::Iterator it = keywordContainer->keywords.begin(); it != keywordContainer->keywords.end(); ++it )
{
if ( !first )
text.append( ", " );
else
- first = FALSE;
+ first = false;
text.append(( *it )->text() );
}
}
else if ( personContainer != NULL )
{
- bool first = TRUE;
+ bool first = true;
for ( TQValueList<Person*>::Iterator it = personContainer->persons.begin(); it != personContainer->persons.end(); ++it )
{
if ( !first )
text.append( " and " );
else
- first = FALSE;
+ first = false;
TQString v = ( *it )->firstName();
if ( !v.isEmpty() )
{
- bool requiresQuoting = requiresPersonQuoting( v, FALSE );
+ bool requiresQuoting = requiresPersonQuoting( v, false );
if ( requiresQuoting ) text.append( "{" );
text.append( v );
if ( requiresQuoting ) text.append( "}" );
@@ -385,7 +385,7 @@ namespace BibTeX
text.append( von );
v = v.right( v.length() - von.length() );
}
- bool requiresQuoting = requiresPersonQuoting( v, TRUE );
+ bool requiresQuoting = requiresPersonQuoting( v, true );
if ( requiresQuoting ) text.append( "{" );
text.append( v );
if ( requiresQuoting ) text.append( "}" );
@@ -439,16 +439,16 @@ namespace BibTeX
{
if ( isLastName && !text.contains( " " ) )
/** Last name contains NO spaces, no quoting necessary */
- return FALSE;
+ return false;
else if ( isLastName && text[0].category() == TQChar::Letter_Lowercase )
/** Last name starts with lower case character (e.g. as in "van der Linden") */
- return FALSE;
+ return false;
else if ( !isLastName && !text.contains( " and " ) )
/** First name contains no " and " no quoting necessary */
- return FALSE;
+ return false;
else if ( text[0] != '{' || text[text.length()-1] != '}' )
/** as either last name contains spaces or first name contains " and " and there is no protective quoting yet, there must be a protective quoting added */
- return TRUE;
+ return true;
/** check for cases like "{..}..{..}", which must be surrounded with a protective quoting, too */
int bracketCounter = 0;
@@ -459,9 +459,9 @@ namespace BibTeX
else if ( text[i] == '}' )
--bracketCounter;
if ( bracketCounter == 0 && i > 0 )
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void FileExporterBibTeX::addProtectiveCasing( TQString &text )
@@ -472,16 +472,16 @@ namespace BibTeX
return;
}
- bool addBrackets = TRUE;
+ bool addBrackets = true;
if ( text[1] == '{' && text[text.length() - 2] == '}' )
{
- addBrackets = FALSE;
+ addBrackets = false;
int count = 0;
for ( int i = text.length() - 2; !addBrackets && i >= 1; --i )
if ( text[i] == '{' )++count;
else if ( text[i] == '}' )--count;
- else if ( count == 0 ) addBrackets = TRUE;
+ else if ( count == 0 ) addBrackets = true;
}
if ( addBrackets )