You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kbibtex/src/value.h

163 lines
4.9 KiB

12 years ago
/***************************************************************************
* Copyright (C) 2004-2006 by Thomas Fischer *
* fischer@unix-ag.uni-kl.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef BIBTEXVALUE_H
#define BIBTEXVALUE_H
#include <tqvaluelist.h>
12 years ago
class TQStringList;
12 years ago
namespace BibTeX
{
class ValueTextInterface
{
public:
ValueTextInterface( const ValueTextInterface* other );
ValueTextInterface( const TQString& text );
12 years ago
virtual ~ValueTextInterface() {};
virtual void setText( const TQString& text );
virtual TQString text() const;
TQString simplifiedText() const;
virtual void replace( const TQString &before, const TQString &after );
virtual bool containsPattern( const TQString &pattern, bool caseSensitive );
12 years ago
private:
TQString m_text;
12 years ago
};
class ValueItem: public ValueTextInterface
{
public:
ValueItem( const TQString& text );
12 years ago
virtual ValueItem *clone()
{
return NULL;
};
};
class Keyword: public ValueTextInterface
{
public:
Keyword( Keyword *other );
Keyword( const TQString& text );
12 years ago
Keyword *clone();
};
class KeywordContainer: public ValueItem
{
public:
KeywordContainer();
KeywordContainer( const TQString& text );
12 years ago
KeywordContainer( KeywordContainer *other );
KeywordContainer( const TQStringList& list );
12 years ago
ValueItem *clone();
void setList( const TQStringList& list );
void append( const TQString& text );
void remove( const TQString& text );
void setText( const TQString& text );
TQString text() const;
void replace( const TQString &before, const TQString &after );
TQValueList<Keyword*> keywords;
12 years ago
};
class Person: public ValueTextInterface
{
public:
Person( const TQString& text, bool firstNameFirst = FALSE );
Person( const TQString& firstName, const TQString& lastName, bool firstNameFirst = FALSE );
12 years ago
Person *clone();
void setText( const TQString& text );
TQString text() const;
TQString text( bool firstNameFirst ) const;
12 years ago
TQString firstName();
TQString lastName();
12 years ago
protected:
TQString m_firstName;
TQString m_lastName;
12 years ago
bool m_firstNameFirst;
bool splitName( const TQString& text, TQStringList& segments );
12 years ago
};
class PersonContainer: public ValueItem
{
public:
PersonContainer( bool firstNameFirst = FALSE );
PersonContainer( const TQString& text, bool firstNameFirst = FALSE );
12 years ago
ValueItem *clone();
void setText( const TQString& text );
TQString text() const;
void replace( const TQString &before, const TQString &after );
12 years ago
TQValueList<Person*> persons;
12 years ago
private:
bool m_firstNameFirst;
};
class MacroKey: public ValueItem
{
private:
bool m_isValid;
bool isValidInternal();
public:
MacroKey( const TQString& text );
12 years ago
ValueItem *clone();
void setText( const TQString& text );
12 years ago
bool isValid();
};
class PlainText: public ValueItem
{
public:
PlainText( const TQString& text );
12 years ago
ValueItem *clone();
};
class Value: public ValueTextInterface
{
public:
Value();
Value( const Value *other );
Value( const TQString& text, bool isMacroKey = false );
12 years ago
void setText( const TQString& text );
TQString text() const;
void replace( const TQString &before, const TQString &after );
12 years ago
TQValueList<ValueItem*> items;
12 years ago
};
}
#endif