#ifndef LIBWCCL_OPS_TOUPPER_H #define LIBWCCL_OPS_TOUPPER_H #include <boost/shared_ptr.hpp> #include <libwccl/values/strset.h> #include <libwccl/ops/functions.h> namespace Wccl { /** * Operator that takes a set of strings and returns a new * set with corresponding values in upper case form */ class ToUpper : public Function<StrSet> { public: typedef boost::shared_ptr<Function<StrSet> > StrSetFunctionPtr; ToUpper(const StrSetFunctionPtr& strset_expr) : strset_expr_(strset_expr) { BOOST_ASSERT(strset_expr_); } /** * String representation of the operator in form of: * "upper(strset_expr_string)" */ virtual std::string to_string(const Corpus2::Tagset& tagset) const; /** * String representation of conditional operator in form of: * "upper(strset_expr_raw_string)" * This version does not require tagset, but may be inclomplete * and/or contain internal info. */ virtual std::string to_raw_string() const; virtual const std::string raw_operator_name() const { return "upper"; } protected: const StrSetFunctionPtr strset_expr_; typedef FunctionBase::BaseRetValPtr BaseRetValPtr; /** * Get a string set from the argument expression and return copy of the set * with all strings in upper case form */ virtual BaseRetValPtr apply_internal(const SentenceContext& context) const; }; } /* end ns Wccl */ #endif // LIBWCCL_OPS_TOUPPER_H