#include "moz.h"

class nsBidi;
class nsBidiPresUtils {
public:
  nsresult GetBidiEngine(nsBidi** aBidiEngine);
  nsresult GetBidiEngine1(int bla, nsBidi** aBidiEngine);
  nsresult GetBidiEngine2(int bla, nsBidi** aBidiEngine    , int bla2);
  nsresult GetBidiEngine3(nsBidi** aBidiEngine, int);
  nsresult GetBidiEngine4(nsBidi**, int i = 0);
private:
  nsBidi* mBidiEngine;
};

nsresult 
nsBidiPresUtils::GetBidiEngine(nsBidi** aBidiEngine)
{
  nsresult rv = 1;//NS_ERROR_FAILURE;
  /* if (mBidiEngine) {
    *aBidiEngine = mBidiEngine;
    rv = 0;//NS_OK;
  }
  return rv;*/
  if (!mBidiEngine)
    return NS_CUSTOM_ERROR;

  *aBidiEngine = mBidiEngine;
  return 0;
}

nsresult nsBidiPresUtils::GetBidiEngine1(int bla, nsBidi** aBidiEngine) 
{
  NS_ENSURE_TRUE(bla, NS_ERROR_FAILURE);
}
nsresult nsBidiPresUtils::GetBidiEngine2(int bla, nsBidi** aBidiEngine, int bla2) 
{
}
nsresult nsBidiPresUtils::GetBidiEngine3(nsBidi** aBidiEngine, int bla) 
{
}
nsresult nsBidiPresUtils::GetBidiEngine4(nsBidi** , int ) 
{
}

nsresult test(nsBidiPresUtils* npu) {
  nsBidi *eng;
  nsresult rv = npu->GetBidiEngine(&eng);
  rv = npu->GetBidiEngine1(rv, &eng);
  nsBidi **peng;
  if(NS_OK == npu->GetBidiEngine2(0, peng, 323 + 0)) {
  }
  if (npu->GetBidiEngine4(peng)) {
  }
  return npu->GetBidiEngine4(peng);
}
