Logo Search packages:      
Sourcecode: kbibtex version File versions  Download package

macro.cpp

/***************************************************************************
*   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.             *
***************************************************************************/
#include <xsltransform.h>

#include "macro.h"

#define max(a,b) ((a)>(b)?(a):(b))

namespace BibTeX
{

    Macro::Macro( const QString &key )
            : Element(), m_key( key ), m_value( new Value() )
    {
        // nothing
    }

    Macro::Macro( Macro *other )
    {
        m_key = other->m_key;
        delete m_value;
        m_value = new Value( other->m_value );
    }

    Macro::~Macro()
    {
        delete m_value;
    }

    void Macro::setKey( const QString &key )
    {
        m_key = key;
    }

    QString Macro::key()
    {
        return m_key;
    }

    Value *Macro::value()
    {
        return m_value;
    }

    void Macro::setValue( Value *value )
    {
        if ( value != m_value )
        {
            delete m_value;

            if ( value != NULL )
                m_value = new Value( value );
            else
                m_value = NULL;
        }
    }

    bool Macro::containsPattern( const QString& pattern, EntryField::FieldType fieldType, bool caseSensitive )
    {
        if ( fieldType != EntryField::ftUnknown )
            return FALSE;

        bool result = m_key.contains( pattern, caseSensitive );
        result |= m_value->containsPattern( pattern, caseSensitive );

        return result;
    }

}

Generated by  Doxygen 1.6.0   Back to index