/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// define the bits used in the Operator Dictionary
// the very last two bits tell us the form
NS_MATHML_OPERATOR_FORM = 0x3,
NS_MATHML_OPERATOR_FORM_INFIX = 1,
NS_MATHML_OPERATOR_FORM_PREFIX = 2,
NS_MATHML_OPERATOR_FORM_POSTFIX = 3,
// the next 2 bits tell us the direction
NS_MATHML_OPERATOR_DIRECTION = 0x3 << 2,
NS_MATHML_OPERATOR_DIRECTION_HORIZONTAL = 1 << 2,
NS_MATHML_OPERATOR_DIRECTION_VERTICAL = 2 << 2,
class nsMathMLOperators { public: staticvoid AddRefTable(void); staticvoid ReleaseTable(void); staticvoid CleanUp();
// LookupOperator: // Given the string value of an operator and its form (last two bits of // flags), this method returns attributes of the operator in the output // parameters. The return value indicates whether an entry was found. staticbool LookupOperator(const nsString& aOperator, const uint8_t aForm,
nsOperatorFlags* aFlags, float* aLeadingSpace, float* aTrailingSpace);
// LookupOperatorWithFallback: // Same as LookupOperator but if the operator is not found under the supplied // form, then the other forms are tried in the following order: infix, postfix // prefix. The caller can test the output parameter aFlags to know exactly // under which form the operator was found in the Operator Dictionary. staticbool LookupOperatorWithFallback(const nsString& aOperator, const uint8_t aForm,
nsOperatorFlags* aFlags, float* aLeadingSpace, float* aTrailingSpace);
// Helper functions used by the nsMathMLChar class. staticbool IsMirrorableOperator(const nsString& aOperator);
// Helper functions used by the nsMathMLChar class to determine whether // aOperator corresponds to an integral operator. staticbool IsIntegralOperator(const nsString& aOperator);
// Helper function used by the nsMathMLChar class. static nsStretchDirection GetStretchyDirection(const nsString& aOperator);
};
//////////////////////////////////////////////////////////////////////////// // Macros that retrieve the bits used to handle operators