From: <dg...@su...> - 2009-01-19 20:46:25
|
Author: savago Date: Mon Jan 19 21:45:20 2009 New Revision: 5197 URL: http://www.opensync.org/changeset/5197 Log: Putting copyright notes and removing annoying empty spaces. Modified: format-plugins/xsltformat/src/xsltformat.c Modified: format-plugins/xsltformat/src/xsltformat.c ============================================================================== --- format-plugins/xsltformat/src/xsltformat.c Mon Jan 19 21:07:37 2009 (r5196) +++ format-plugins/xsltformat/src/xsltformat.c Mon Jan 19 21:45:20 2009 (r5197) @@ -1,13 +1,37 @@ /* - * Here you can specify a format plugin if you like. - * You should use a format plugin, if the format conversion - * is rather difficult or if other plugins might be able to reuse - * your conversion. A format plugin can create new formats in get_format_info - * and provide converters between different formats in get_conversion_info - * + * Copyright (C) 2009 Daniel Gollub <dg...@su...> + * Copyright (C) 2009 Instituto Nokia de Tecnologia + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * */ + +/** + * @file xsltformat.c + * @author Adenilson Cavalcanti da Silva <ade...@in...> + * + * @brief A generic xslt format plugin. + * + * \todo: + * - make the convertion (should be easy thanks to xslt_aux functions) + * + */ + #include <opensync/opensync.h> #include <opensync/opensync-format.h> +#include "xslt_aux.h" static OSyncConvCmpResult compare_format1(const char *leftdata, unsigned int leftsize, const char *rightdata, unsigned int rightsize) { @@ -15,27 +39,27 @@ * This function can be used to compare two types of your formats. * This is optional. For example, you can only provide a conversion * from and to the xml format and let all the comparison be done there - * + * */ /* * Compare your objects here. You might need to cast the data of the change * objects to you own defined types. - * + * * The possible result of the comparison are: - * + * * return OSYNC_CONV_DATA_SAME; * The objects are exactly the same. (they might differ in some uid or * timestamp though, but ALL the "real" information is the same) - * + * * return OSYNC_CONV_DATA_SIMILAR; * The objects are not _exactly_ the same, but they look similar. This is used * to detect conflicts. It is up to you to decide what "similar" means for your * object - * + * * return OSYNC_CONV_DATA_MISMATCH; * This means the objects are not the same and not similar. - * + * */ return OSYNC_CONV_DATA_MISMATCH; } @@ -46,37 +70,37 @@ * This function can be used to convert your format to another format. * Return TRUE if the conversion was successful or return FALSE and set * the error if something bad has happend. - * + * */ - + /* The arguments mean: - * + * * - conv_data: * Pointer to the data you returned in your init function (if any) - * + * * - input: * The data you need to convert * - inpsize * The size of the input data - * + * * - output: * After converting you need to set this * to your result * - outpsize: * The size of the output - * + * * - free_input: * You need to set this to TRUE if opensync * can free the input after the conversion (so you dont * use any reference from or to the input). A example where * *free_input = FALSE; needs to be done would be a encapsulator * that stores the input reference somewhere in its struct - * + * * - error: * if something bad happens and you cannot convert, set the error! - * + * */ - + return TRUE; } @@ -86,9 +110,9 @@ * This function can be used to convert another format to your format. * Return TRUE if the conversion was successful or return FALSE and set * the error if something bad has happend. - * + * */ - + return TRUE; } @@ -96,7 +120,7 @@ { /* * Here you have to free the data allocated by your format - * + * */ } @@ -107,9 +131,9 @@ * Duplication does not mean to make 2 objects out of one, * but to change to uid of the object in such a way that it * differes from the original uid. - * + * * Most format will never need this. - * + * */ return TRUE; @@ -122,15 +146,15 @@ * you have to return a human readable string here describing the object * as closely as possible. This information will be used by the user to decide * which object to pick in a conflict. - * + * */ return NULL; } osync_bool get_format_info(OSyncFormatEnv *env, OSyncError **error) { - /* - * this function is called to register a new format + /* + * this function is called to register a new format */ OSyncObjFormat *format = osync_objformat_new("<your format name>", "<some object type>", error); if (!format) @@ -176,7 +200,7 @@ * This function will be called directly after the plugin has been loaded * to get converters that convert between different formats */ - + OSyncObjFormat *format1 = osync_format_env_find_objformat(env, "<your format name>"); if (!format1) { osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to find <your format name> format"); @@ -198,7 +222,7 @@ /* register converter */ osync_format_env_register_converter(env, conv); osync_converter_unref(conv); - + conv = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format1, conv_format2_to_format1, error); if (!conv) return FALSE; |