Logo Search packages:      
Sourcecode: verbiste version File versions

misc-types.cpp

/*  $Id: misc-types.cpp,v 1.5 2005/03/13 04:03:27 sarrazip Exp $
    misc-types.cpp - Miscellaneous types used by the dictionary class.

    verbiste - French conjugation system
    Copyright (C) 2003-2005 Pierre Sarrazin <http://sarrazip.com/>

    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 <verbiste/misc-types.h>
 
#include <verbiste/FrenchVerbDictionary.h>

using namespace std;
using namespace verbiste;


void
00032 ModeTensePersonNumber::set(const char *modeName,
                        const char *tenseName,
                        int personNum)
{
    mode = FrenchVerbDictionary::convertModeName(modeName);
    tense = FrenchVerbDictionary::convertTenseName(tenseName);

    if (mode == IMPERATIVE_MODE)
    {
      if (personNum == 1)
      {
          person = 2;
          plural = false;
      }
      else if (personNum == 2)
      {
          person = 1;
          plural = true;
      }
      else if (personNum == 3)
      {
          person = 2;
          plural = true;
      }
      else
      {
          person = 0;
          plural = false;
      }
    }
    else if (mode == INFINITIVE_MODE
            || mode == INVALID_MODE
            || personNum < 1 || personNum > 6)
    {
      person = 0;
      plural = false;
    }
    else if (mode == PARTICIPLE_MODE)
    {
      person = (personNum <= 2 ? 4 : 5);
            // convention: 4=masculine, 5=feminie
      plural = (personNum == 2 || personNum == 4);
    }
    else
    {
      person = (personNum - 1) % 3 + 1;
      plural = (personNum > 3);
    }
}


void
00084 ModeTensePersonNumber::dump(Verbiste_ModeTensePersonNumber &destination) const
{
    destination.mode = (Verbiste_Mode) mode;
    destination.tense = (Verbiste_Tense) tense;
    destination.person = (int) person;
    destination.plural = (int) plural;
}

Generated by  Doxygen 1.6.0   Back to index