This commit is contained in:
King_DuckZ 2020-02-17 22:22:42 +01:00
parent feed734f17
commit 824eb94695
3514 changed files with 90507 additions and 92619 deletions

View file

@ -1,8 +1,8 @@
/*
* Copyright (c) 2001-2008
* Copyright (c) 2001, 2008,
* DecisionSoft Limited. All rights reserved.
* Copyright (c) 2004-2008
* Oracle. All rights reserved.
* Copyright (c) 2004, 2011,
* Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -15,14 +15,19 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $Id$
*/
#ifndef _FUNCTIONREPLACE_HPP
#define _FUNCTIONREPLACE_HPP
#include <xqilla/ast/ConstantFoldingFunction.hpp>
#include <xqilla/functions/RegExpFunction.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class RuntimeException;
class RegularExpression;
class ParseException;
XERCES_CPP_NAMESPACE_END
/**
* Returns the string that is obtained by replacing all non-overlapping substrings of $input
@ -32,8 +37,9 @@
* xf:replace(string? $input, string $pattern, string $replacement,
* string $flags) => string?
*/
class XQILLA_API FunctionReplace : public ConstantFoldingFunction
class XQILLA_API FunctionReplace : public RegExpFunction
{
public:
static const XMLCh name[];
static const unsigned int minArgs;
@ -43,7 +49,9 @@ public:
* Constructor.
*/
FunctionReplace(const VectorOfASTNodes &args, XPath2MemoryManager* memMgr);
virtual ASTNode *staticTypingImpl(StaticContext *context);
/**
* Returns $input with non-overlapping matches to $pattern
* replaced by $replacement
@ -54,6 +62,15 @@ public:
const XMLCh *options = 0, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *mm =
XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
static const XMLCh *replace(const XMLCh *input, const XERCES_CPP_NAMESPACE_QUALIFIER RegularExpression *regExp,
const XMLCh *replacement,
XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *mm =
XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
private:
//helper functions
void processRuntimeException(XERCES_CPP_NAMESPACE_QUALIFIER RuntimeException &e, const char* sourceMsg) const;
};
#endif