| 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ |
| 2 | /* libwps |
| 3 | * Version: MPL 2.0 / LGPLv2+ |
| 4 | * |
| 5 | * The contents of this file are subject to the Mozilla Public License Version |
| 6 | * 2.0 (the "License"); you may not use this file except in compliance with |
| 7 | * the License or as specified alternatively below. You may obtain a copy of |
| 8 | * the License at http://www.mozilla.org/MPL/ |
| 9 | * |
| 10 | * Software distributed under the License is distributed on an "AS IS" basis, |
| 11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
| 12 | * for the specific language governing rights and limitations under the |
| 13 | * License. |
| 14 | * |
| 15 | * Major Contributor(s): |
| 16 | * Copyright (C) 2002 William Lachance ([email protected]) |
| 17 | * Copyright (C) 2002,2004 Marc Maurer ([email protected]) |
| 18 | * Copyright (C) 2004-2006 Fridrich Strba ([email protected]) |
| 19 | * Copyright (C) 2006, 2007 Andrew Ziem |
| 20 | * Copyright (C) 2011, 2012 Alonso Laurent ([email protected]) |
| 21 | * |
| 22 | * |
| 23 | * All Rights Reserved. |
| 24 | * |
| 25 | * For minor contributions see the git repository. |
| 26 | * |
| 27 | * Alternatively, the contents of this file may be used under the terms of |
| 28 | * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"), |
| 29 | * in which case the provisions of the LGPLv2+ are applicable |
| 30 | * instead of those above. |
| 31 | */ |
| 32 | |
| 33 | #ifndef HELPER_H |
| 34 | # define HELPER_H |
| 35 | |
| 36 | #ifdef HAVE_CONFIG_H |
| 37 | # include "config.h" |
| 38 | #endif |
| 39 | |
| 40 | #include <memory> |
| 41 | |
| 42 | #include <librevenge/librevenge.h> |
| 43 | #include <libwps/libwps.h> |
| 44 | |
| 45 | namespace libwpsHelper |
| 46 | { |
| 47 | /** check if a file is supported, if so returns the input stream |
| 48 | the confidence, ... If not, returns an empty input stream. |
| 49 | */ |
| 50 | std::shared_ptr<librevenge::RVNGInputStream> isSupported |
| 51 | (char const *filename, libwps::WPSConfidence &confidence, libwps::WPSKind &kind, bool &needCharEncoding); |
| 52 | /** check for error, if yes, print an error message and returns |
| 53 | true. If not return false */ |
| 54 | bool checkErrorAndPrintMessage(libwps::WPSResult result); |
| 55 | |
| 56 | /* ---------- debug --------------- */ |
| 57 | #if defined(HAVE_FUNC_ATTRIBUTE_FORMAT) |
| 58 | # define WPS_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg))) |
| 59 | #else |
| 60 | # define WPS_ATTRIBUTE_PRINTF(fmt, arg) |
| 61 | #endif |
| 62 | |
| 63 | #ifdef DEBUG |
| 64 | void printDebugMsg(const char *format, ...) WPS_ATTRIBUTE_PRINTF(1, 2); |
| 65 | # define WPS_DEBUG_MSG(M) libwpsHelper::printDebugMsg M |
| 66 | #else |
| 67 | # define WPS_DEBUG_MSG(M) |
| 68 | #endif |
| 69 | } |
| 70 | #endif |
| 71 | /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ |