1 /* 2 * Copyright 2006-2008 The FLWOR Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #pragma once 17 #ifndef ZORBA_DECIMAL_FORMAT_H 18 #define ZORBA_DECIMAL_FORMAT_H 19 20 #include <vector> 21 22 #include "common/shared_types.h" 23 24 #include "zorbatypes/zstring.h" 25 26 #include "zorbaserialization/class_serializer.h" 27 28 #include "store/api/item.h" 29 30 31 namespace zorba 32 { 33 34 class DecimalFormat : public SimpleRCObject 35 { 36 public: 37 typedef std::vector<std::pair<zstring,zstring> > param_vector_type; 38 39 protected: 40 bool theIsDefault; 41 store::Item_t theName; 42 param_vector_type theParams; 43 44 public: 45 SERIALIZABLE_CLASS(DecimalFormat) 46 SERIALIZABLE_CLASS_CONSTRUCTOR2(DecimalFormat, SimpleRCObject) 47 void serialize(::zorba::serialization::Archiver& ar); 48 49 protected: 50 // Returns true if the given property represents characters used in a 51 // picture string. These properties are decimal-separator-sign, 52 // grouping-separator, percent-sign, per-mille-sign, zero-digit, 53 // digit-sign, and pattern-separator-sign. 54 static bool isPictureStringProperty(zstring propertyName); 55 56 public: 57 DecimalFormat( 58 bool isDefault, 59 const store::Item_t& qname, 60 const param_vector_type& params); 61 isDefault()62 bool isDefault() const { return theIsDefault; } 63 getName()64 const store::Item* getName() const { return theName.getp(); } 65 getParamVector()66 const param_vector_type* getParamVector() const { return &theParams; } 67 68 bool validate(const QueryLoc& loc) const; 69 }; 70 71 72 typedef rchandle<DecimalFormat> DecimalFormat_t; 73 74 } /* namespace zorba */ 75 #endif /* ZORBA_DECIMAL_FORMAT_H */ 76 77 /* 78 * Local variables: 79 * mode: c++ 80 * End: 81 */ 82 /* vim:set et sw=2 ts=2: */ 83