1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 2 /* librevenge 3 * Version: MPL 2.0 / LGPLv2.1+ 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * Major Contributor(s): 10 * Copyright (C) 2004 William Lachance (wrlach@gmail.com) 11 * 12 * For minor contributions see the git repository. 13 * 14 * Alternatively, the contents of this file may be used under the terms 15 * of the GNU Lesser General Public License Version 2.1 or later 16 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are 17 * applicable instead of those above. 18 */ 19 20 #ifndef RVNGPROPERTY_H 21 #define RVNGPROPERTY_H 22 23 #include "librevenge-api.h" 24 25 #include "RVNGString.h" 26 27 namespace librevenge 28 { 29 30 enum RVNGUnit { RVNG_INCH, RVNG_PERCENT, RVNG_POINT, RVNG_TWIP, RVNG_GENERIC, RVNG_UNIT_ERROR }; 31 32 class REVENGE_API RVNGProperty 33 { 34 public: 35 virtual ~RVNGProperty(); 36 virtual int getInt() const = 0; 37 virtual double getDouble() const = 0; 38 /** returns the property unit when possible. If not, returns RVNG_UNIT_ERROR */ 39 virtual RVNGUnit getUnit() const = 0; 40 virtual RVNGString getStr() const = 0; 41 virtual RVNGProperty *clone() const = 0; 42 }; 43 44 class REVENGE_API RVNGPropertyFactory 45 { 46 public: 47 static RVNGProperty *newStringProp(const RVNGString &str); 48 static RVNGProperty *newStringProp(const char *str); 49 static RVNGProperty *newBinaryDataProp(const RVNGBinaryData &data); 50 static RVNGProperty *newBinaryDataProp(const unsigned char *buffer, 51 const unsigned long bufferSize); 52 static RVNGProperty *newIntProp(const int val); 53 static RVNGProperty *newBoolProp(const bool val); 54 static RVNGProperty *newDoubleProp(const double val); 55 static RVNGProperty *newInchProp(const double val); 56 static RVNGProperty *newPercentProp(const double val); 57 static RVNGProperty *newPointProp(const double val); 58 static RVNGProperty *newTwipProp(const double val); 59 }; 60 61 } 62 63 #endif /* RVNGPROPERTY_H */ 64 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ 65