txExpr.cpp 836 B

12345678910111213141516171819202122232425262728293031
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "txExpr.h"
  6. nsresult
  7. Expr::evaluateToBool(txIEvalContext* aContext, bool& aResult)
  8. {
  9. RefPtr<txAExprResult> exprRes;
  10. nsresult rv = evaluate(aContext, getter_AddRefs(exprRes));
  11. NS_ENSURE_SUCCESS(rv, rv);
  12. aResult = exprRes->booleanValue();
  13. return NS_OK;
  14. }
  15. nsresult
  16. Expr::evaluateToString(txIEvalContext* aContext, nsString& aResult)
  17. {
  18. RefPtr<txAExprResult> exprRes;
  19. nsresult rv = evaluate(aContext, getter_AddRefs(exprRes));
  20. NS_ENSURE_SUCCESS(rv, rv);
  21. exprRes->stringValue(aResult);
  22. return NS_OK;
  23. }