extern "C" CVC_Type CVC_TypeInt(CVC_VC vc)
{
  GetVC;
  try {
    return ToType(cvc->intType());
  } catch (CVC3::Exception ex) {
    ExceptionFail(ex);
  }
}
extern "C" CVC_Type CVC_TypeFunc(CVC_VC vc, CVC_Type ret,
                                 CVC_Type *args, int num_args)
{
  GetVC;
  try {
    std::vector<CVC3::Type> cvc_args;
    for (int i = 0; i < num_args; i++)
      cvc_args.push_back(FromType(args[i]));
    return ToType(cvc->funType(cvc_args, FromType(ret)));
  } catch (CVC3::Exception ex) {
    ExceptionFail(ex);
  }
}
void ribi::foam::PatchFieldTypes::Test() noexcept
{
  {
    static bool is_tested = false;
    if (is_tested) return;
    is_tested = true;
  }
  const std::vector<PatchFieldType> v = GetAllTypes();
  const std::size_t sz = v.size();
  for (std::size_t i=0; i!=sz; ++i)
  {
    assert(i < v.size());
    const PatchFieldType t = v[i];
    const std::string s = ToStr(t);
    assert(!s.empty());
    const PatchFieldType u = ToType(s);
    assert(u == t);
  }
}
void ribi::CanvasColorSystems::Test() noexcept
{
  {
    static bool is_tested = false;
    if (is_tested) return;
    is_tested = true;
  }
  const std::vector<CanvasColorSystem> v = GetAll();
  const std::size_t sz = v.size();
  for (std::size_t i=0; i!=sz; ++i)
  {
    assert(i < v.size());
    const CanvasColorSystem t = v[i];
    const std::string s = ToStr(t);
    assert(!s.empty());
    const CanvasColorSystem u = ToType(s);
    assert(u == t);
  }
}
Пример #5
0
ToType convert(const FromType& f)
{
    std::cout << "convert from " << f << std::endl;
    return ToType();
}
Пример #6
0
void cBillboard::LoadXMLProperties(const tString asFile)
{
    tString sNewFile = cString::SetFileExt(asFile,"bnt");
    tString sPath = mpFileSearcher->GetFilePath(sNewFile);
    if(sPath != "")
        {
            TiXmlDocument *pDoc = hplNew( TiXmlDocument, (sPath.c_str()) );
            if(pDoc->LoadFile())
                {
                    TiXmlElement *pRootElem = pDoc->RootElement();

                    TiXmlElement *pMainElem = pRootElem->FirstChildElement("MAIN");
                    if(pMainElem!=NULL)
                        {
                            mType = ToType(pMainElem->Attribute("Type"));
                            tString sMaterial = cString::ToString(pMainElem->Attribute("Material"),"");
                            bool bUsesOffset = cString::ToBool(pMainElem->Attribute("UseOffset"),false);
                            if(bUsesOffset==false) mfForwardOffset =0;

                            /////////////////
                            //Halo stuff
                            bool bIsHalo = cString::ToBool(pMainElem->Attribute("IsHalo"),false);
                            SetIsHalo(bIsHalo);

                            if(bIsHalo)
                                {
                                    bool bHaloSourceIsParent  = cString::ToBool(pMainElem->Attribute("HaloSourceIsParent"),false);
                                    SetHaloSourceIsParent(bHaloSourceIsParent);

                                    if(bHaloSourceIsParent == false)
                                        {
                                            tString sSizeVec = cString::ToString(pMainElem->Attribute("HaloSourceSize"),"1 1 1");
                                            tFloatVec vSizeValues;
                                            cString::GetFloatVec(sSizeVec,vSizeValues,NULL);
                                            SetHaloSourceSize(cVector3f(vSizeValues[0],vSizeValues[1],vSizeValues[2]));
                                        }
                                }

                            /////////////////
                            //Load material
                            iMaterial *pMat = mpMaterialManager->CreateMaterial(sMaterial);
                            if(pMat)
                                {
                                    SetMaterial(pMat);
                                }
                            else
                                {
                                    Error("Couldn't load material '%s' in billboard file '%s'",
                                          sMaterial.c_str(), sNewFile.c_str());
                                }
                        }
                    else
                        {
                            Error("Cannot find main element in %s\n",sNewFile.c_str());
                        }
                }
            else
                {
                    Error("Couldn't load file '%s'\n",sNewFile.c_str());
                }
            hplDelete(pDoc);
        }
    else
        {
            Error("Couldn't find file '%s'\n",sNewFile.c_str());
        }

}