Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

ffword.h

Go to the documentation of this file.
00001 /*
00002  * finflect - Algorithms and tools for inflecting Finnish nouns
00003  * Copyright (C) 2004, 2005  The FinFlect Team
00004  * 
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  * 
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  * 
00019  * 
00020  * For the complete legal text of the GNU Lesser General Public License,
00021  * see the file LICENSE. For a complete list of authors and copyright
00022  * holders, see the file AUTHORS.
00023  */
00024 
00025 /**
00026  * @file ffword.h Declares the ffword data type (a string with metadata)
00027  * and some functions to manipulate its instances. They are implemented in ffword.c.
00028  */
00029  
00030 #ifndef __FFWORD_H
00031 #define __FFWORD_H
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 #include "fftypes.h"
00038 #include "ffstring.h"
00039 #include "ffops.h"
00040 
00041 /**
00042  * Bundles together a word and its metadata.
00043  */
00044 typedef struct ffword {
00045   /**
00046    * The string data
00047    */
00048   ffstring data;
00049   
00050   /**
00051    * The metadata
00052    */
00053   ffops metadata;
00054 } ffword;
00055 
00056 /**
00057  * Create an ffword from a C style string.
00058  * @param source The source C-style string
00059  * @param target The target user-allocated ffword
00060  * @return 0 on success; negative on error
00061  */
00062 ffint32 ffword_create(const ffchar* source, ffword* target);
00063 
00064 /**
00065  * Create a copy of an ffword.
00066  * @param source The source ffword
00067  * @param target The target ffword
00068  * @return 0 on success; negative on error
00069  */
00070 ffint32 ffword_copy(ffword* source, ffword* target);
00071 
00072 /**
00073  * Deletes an ffword. Only deletes the string data of the word at the moment,
00074  * but might do something creative in the future.
00075  * @param target The ffword to delete
00076  * @return 0 on success; negative on error
00077  */
00078 ffint32 ffword_delete(ffword* target);
00079 
00080 /**
00081  * Replaces the data of target with the data of source and then deletes the source. Metadata is not replaced.
00082  * @param source The ffword to move
00083  * @param target The ffword to move to
00084  * @return 0 on success; negative on error
00085  */
00086 ffint32 ffword_move(ffword* source, ffword* target);
00087 
00088 /**
00089  * Delete an ffword without deallocating the real string data of the str member.
00090  * After finalizing the only usable member of an ffword is the data string.
00091  * ffwords do not need to be deleted after finalizing. Finalizing only decreases
00092  * the ffstring instance counter at the moment, but might do something
00093  * creative in the future.
00094  * @param target The ffword to finalize
00095  * @return 0 on success; negative on error
00096  */
00097 ffint32 ffword_finalize(ffword* target);
00098 
00099 ffint32 ffword_swap_delete(ffword* source, ffword* target);
00100 
00101 #ifdef __cplusplus
00102 }
00103 #endif
00104 
00105 #endif

Generated on Sun May 15 21:50:47 2005 for FinFlect by  doxygen 1.4.1