Beispiel #1
0
BOOL CDockManager::Dock(DM_POS nPos)
{
	if (nPos == DMP_UNDOCKED)
		return UnDock();

	// check if no change
	if (IsDocked() && m_nDockPos == nPos)
		return TRUE;

	BOOL bDocked = IsDocked();
	m_nDockPos = nPos;

	CRect rDock;
	ScGetCWnd()->GetWindowRect(rDock);

	// save window pos if not currently docked
	if (!bDocked)
		m_rUndocked = rDock;
	
	// and restore previous width/height
	if (nPos == DMP_BELOW)
	{
		int nHeight = GetDockedHeight(IsMaximized());
		
		if (nHeight != -1)
		{
			rDock.bottom = rDock.top + nHeight;

			CAutoFlag af(m_bResizeUpdate, FALSE);
			CAutoFlag af2(m_bSizeUpdate, FALSE);
			MoveWindow(ScGetCWnd(), rDock);
		}
	}
	else
	{
		int nWidth = GetDockedWidth(IsMaximized());
		
		if (nWidth != -1)
		{
			rDock.right = rDock.left + nWidth;

			CAutoFlag af(m_bResizeUpdate, FALSE);
			CAutoFlag af2(m_bSizeUpdate, FALSE);
			MoveWindow(ScGetCWnd(), rDock);
		}
	}

	// also restore main window pos if maximized
	if (IsMaximized())
		OnMaximize();
	else
	{
		UpdateDockWindowPos();
		FitDockWindowToWorkArea(); // make sure it's visible
	}

	return TRUE;
}
void AddFixture_Test::rememberExpanded()
{
    {
        AddFixture af(NULL, m_doc);
        af.m_tree->invisibleRootItem()->child(5)->setExpanded(true);
    }

    {
        AddFixture af(NULL, m_doc);
        QVERIFY(af.m_tree->invisibleRootItem()->child(5)->isExpanded());
    }
}
TEST(ServiceChargeTransactionTest, PayrollTest) {
	int empid = 7;
	AddHourlyEmployee ahe(empid, "Test7", "Home7", 50.00);
	ahe.Execute();

	Employee *e = ((DatabaseProxy *)getInstance())->GetEmployee(empid);
	EXPECT_TRUE(e != 0);
	Affiliation * af(new UnionAffiliation());
	e->SetAffilication(af);

	int memberId = 86;
	((DatabaseProxy *)getInstance())->AddUnionMember(memberId, e);

	Date date(2005, 8, 8);
	ServiceChargeTransaction sct(memberId, date, 12.95);
	sct.Execute();

	e = ((DatabaseProxy *)getInstance())->GetEmployee(empid);
	UnionAffiliation* uf = 
		dynamic_cast<UnionAffiliation*>(e->GetAffilication());
	EXPECT_TRUE(uf != 0);

	ServiceCharge sc = uf->GetServiceCharge(date);
	EXPECT_TRUE(sc.GetAmount() == 12.95);
}
Beispiel #4
0
void Statistics::load(const QString& fname)
{
    if( !QFile::exists(fname) )
    {
        qDebug() << "File with statistic does not exists!";
        return;
    }

    QFile af( fname );
    if( !af.open(QFile::ReadOnly) )
        return;

    QByteArray line;
    QRegExp rx("(\\w+):(\\d+):(\\d+)");
    while( !af.atEnd() )
    {
        line = af.readLine();
        if(rx.indexIn( line ) == -1) continue;

        QString login=rx.cap(1);
        PlayerStats stats;
        stats.roundsWon=rx.cap(2).toInt();
        stats.roundsLost=rx.cap(3).toInt();
        data.insert(login,stats);
    }
}
Beispiel #5
0
FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) {
  ASSERT(action.GetDict());

  CPDF_ActionFields af(&action);
  std::vector<CPDF_Object*> fieldObjects = af.GetAllFields();
  std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects);

  bool bHide = action.GetHideStatus();
  FX_BOOL bChanged = FALSE;

  for (CPDF_FormField* pField : fields) {
    for (int i = 0, sz = pField->CountControls(); i < sz; ++i) {
      CPDF_FormControl* pControl = pField->GetControl(i);
      ASSERT(pControl);

      if (CPDFSDK_Widget* pWidget = GetWidget(pControl, false)) {
        uint32_t nFlags = pWidget->GetFlags();
        nFlags &= ~ANNOTFLAG_INVISIBLE;
        nFlags &= ~ANNOTFLAG_NOVIEW;
        if (bHide)
          nFlags |= ANNOTFLAG_HIDDEN;
        else
          nFlags &= ~ANNOTFLAG_HIDDEN;
        pWidget->SetFlags(nFlags);
        pWidget->GetPageView()->UpdateView(pWidget);
        bChanged = TRUE;
      }
    }
  }

  return bChanged;
}
void
bf (void)
{
  int i = 1;
  char v[i];
  af (v);
}
Beispiel #7
0
void PointValues_Evaluator<EvalT,TraitsT>::initialize(const Teuchos::RCP<const panzer::PointRule> & pointRule,
                                                      const Intrepid::FieldContainer<double> & userArray)
{
  TEUCHOS_ASSERT(userArray.rank()==2);

  panzer::MDFieldArrayFactory af(pointRule->getName()+"_");
       
  // copy user array data
  refPointArray = Intrepid::FieldContainer<double>(userArray.dimension(0),userArray.dimension(1));
  TEUCHOS_ASSERT(refPointArray.size()==userArray.size());
  for(int i=0;i<userArray.size();i++)
     refPointArray[i] = userArray[i]; 

  // setup all fields to be evaluated and constructed
  pointValues.setupArrays(pointRule,af);

  // the field manager will allocate all of these field
  this->addEvaluatedField(pointValues.coords_ref);
  this->addEvaluatedField(pointValues.node_coordinates);
  this->addEvaluatedField(pointValues.jac);
  this->addEvaluatedField(pointValues.jac_inv);
  this->addEvaluatedField(pointValues.jac_det);
  this->addEvaluatedField(pointValues.point_coords);

  std::string n = "PointValues_Evaluator: " + pointRule->getName();
  this->setName(n);
}
Beispiel #8
0
// static
void GLinearRegressor::test()
{
	GRand prng(0);
	GLinearRegressor_linear_test(prng);
	GAutoFilter af(new GLinearRegressor ());
	af.basicTest(0.76, 0.93);
}
Beispiel #9
0
int Spell::resolve()
{
    MTGCardInstance * oldStored = source->storedCard;
    if (!source->hasType(Subtypes::TYPE_INSTANT) && !source->hasType(Subtypes::TYPE_SORCERY) && source->name.size())
    {
        Player * p = source->controller();
        int castMethod = source->castMethod;
        vector<Targetable*>backupTgt = source->backupTargets;
        source = p->game->putInZone(source, from, p->game->battlefield);
        
        // We need to get the information about the cast method on both the card in the stack AND the card in play,
        //so we copy it from the previous card (in the stack) to the new one (in play).
        source->castMethod = castMethod; 
        source->backupTargets = backupTgt;
        from = p->game->battlefield;
    }
    source->storedCard = oldStored;
    //Play SFX
    if (options[Options::SFXVOLUME].number > 0)
    {

		if(observer->getResourceManager())
			observer->getResourceManager()->PlaySample(source->getSample());
    }
    AbilityFactory af(observer);
    af.addAbilities(observer->mLayers->actionLayer()->getMaxId(), this);
    return 1;
}
Beispiel #10
0
	void SetAllocationFunctions(AllocateFunc a, FreeFunc f)
	{
		//af = a;
		//ff = f;
		af() = a;
		ff() = f;
	}
Beispiel #11
0
void PlayMelody(int pin, char *notes, boolean (*af)())
{
  char nc, w ;
  int n, t, l ;

  pinMode(pin, OUTPUT) ;
  _notEpointeR = notes ;

  while ((nc = *_notEpointeR++) != '\0') {
    if ((af != NULL) && (af() == false)) return ;
    t = l = 0 ;
    if ((nc >= 'a') && (nc <= 'z')) nc -= 32 ;
#ifdef DEBUG
    Serial.print(_tempO, DEC) ;
    Serial.print(", ") ;
    Serial.print(_octavE, DEC) ;
    Serial.print(", ") ;
    Serial.print(nc, BYTE) ;
    Serial.print(", ") ;
#endif
    w = _wherEnotEchaR(nc) ;
    if (w < 7) {
      nc = _notEindeX[w] ;
      w = _wherEnotEchaR(*_notEpointeR) ;
      if ((w == 7) || (w == 8)) {
        _notEpointeR++ ;
        nc++ ;
      }
      if ((w == 9) || (w == 10)) {
        _notEpointeR++ ;
        nc-- ;
      }
      t = _notEratE[nc] * (55 << (_octavE - 1)) ;
      w = 99 ;
      tone(pin, t) ;
    }
    n = _tOnumbeR() ;
    if ((t > 0) || (w == 11) || (w == 12)) {
      if (w == 11) noTone(pin) ;
      if (n == 0) n = _lengtH ;
      l = 12000 / _tempO * 40 / n ;
      if (*_notEpointeR == '.') {
        _notEpointeR++ ;
        l *= 1.5 ;
      }
    }
    if ((w == 13) && (_octavE < 8)) _octavE++ ;
    if ((w == 14) && (_octavE > 1)) _octavE-- ;
    if ((w == 15) && (n >= 1) && (n <= 8)) _octavE = n ;
    if ((w == 16) && (n >= 1) && (n <= 512)) _tempO = n ;
    if ((w == 17) && (n >= 1) && (n <= 128)) _lengtH = n ;
#ifdef DEBUG
    Serial.print(t, DEC) ;
    Serial.print(", ") ;
    Serial.println(l, DEC) ;
#endif
    if (l > 0) delay(l) ;
    noTone(pin) ;
  }
}
  void IntegrationValues2<Scalar>::
  setupArrays(const Teuchos::RCP<const panzer::IntegrationRule>& ir)
  {
    MDFieldArrayFactory af(prefix,alloc_arrays);

    int_rule = ir;
    
    int num_nodes = ir->topology->getNodeCount();
    int num_cells = ir->workset_size;
    int num_space_dim = ir->topology->getDimension();

    // specialize content if this is quadrature at anode
    if(num_space_dim==1 && ir->isSide()) {
       setupArraysForNodeRule(ir); 
       return;
    }

    Intrepid::DefaultCubatureFactory<double,DblArrayDynamic>
      cubature_factory;
    
    if (ir->isSide())
      intrepid_cubature = cubature_factory.create(*(ir->side_topology), 
						  ir->cubature_degree);
    else
      intrepid_cubature = cubature_factory.create(*(ir->topology), 
						  ir->cubature_degree);

    int num_ip = intrepid_cubature->getNumPoints();

    dyn_cub_points = af.template buildArray<double,IP,Dim>("cub_points",num_ip, num_space_dim);
    dyn_cub_weights = af.template buildArray<double,IP>("cub_weights",num_ip);

    cub_points = af.template buildStaticArray<Scalar,IP,Dim>("cub_points",num_ip, num_space_dim);

    if (ir->isSide()) {
      dyn_side_cub_points = af.template buildArray<double,IP,Dim>("side_cub_points",num_ip, ir->side_topology->getDimension());
      side_cub_points = af.template buildStaticArray<Scalar,IP,Dim>("side_cub_points",num_ip,ir->side_topology->getDimension());
    }
    
    cub_weights = af.template buildStaticArray<Scalar,IP>("cub_weights",num_ip);
    
    node_coordinates = af.template buildStaticArray<Scalar,Cell,BASIS,Dim>("node_coordinates",num_cells, num_nodes, num_space_dim);
    
    jac = af.template buildStaticArray<Scalar,Cell,IP,Dim,Dim>("jac",num_cells, num_ip, num_space_dim,num_space_dim);
    
    jac_inv = af.template buildStaticArray<Scalar,Cell,IP,Dim,Dim>("jac_inv",num_cells, num_ip, num_space_dim,num_space_dim);
    
    jac_det = af.template buildStaticArray<Scalar,Cell,IP>("jac_det",num_cells, num_ip);
    
    weighted_measure =  af.template buildStaticArray<Scalar,Cell,IP>("weighted_measure",num_cells, num_ip);
    
    covarient = af.template buildStaticArray<Scalar,Cell,IP,Dim,Dim>("covarient",num_cells, num_ip, num_space_dim,num_space_dim);

    contravarient = af.template buildStaticArray<Scalar,Cell,IP,Dim,Dim>("contravarient",num_cells, num_ip, num_space_dim,num_space_dim);

    norm_contravarient = af.template buildStaticArray<Scalar,Cell,IP>("norm_contravarient",num_cells, num_ip);

    ip_coordinates = af.template buildStaticArray<Scalar,Cell,IP,Dim>("ip_coordiantes",num_cells, num_ip,num_space_dim);
  }
Beispiel #13
0
//static
void GNaiveInstance::test()
{

	GNaiveInstance* pNI = new GNaiveInstance();
	GAutoFilter af(pNI);
	pNI->setNeighbors(8);
	af.basicTest(0.72, 0.44, 0.02);
}
 /**
  * @brief Constructor : create the factory and register it
  * @param[in] key type that factory can candle
  */
 ServiceFactoryRegistrar(const KEY & key)
 {
     std::string simpl = ::fwCore::TypeDemangler<SUBCLASS>().getClassname();
     // create factory
     ::boost::shared_ptr< ::fwTools::IClassFactory >  af( new ::fwTools::ClassFactory< BASECLASS, SUBCLASS, std::string >(simpl) );
     // register it
     ::fwServices::registry::ServiceFactory::getDefault()->addFactory( af, simpl, key.first, key.second);
 }
Beispiel #15
0
bool MainServer::checkUser(
    const QString& login,
    const QString& password
)
{
    if( login == "guest" )
        return true;

    if( !QFile::exists(authFile) )
    {
        qDebug() << "Auth file not exists";
        return false;
    }

    QFile af( authFile );
    if( !af.open(QFile::ReadOnly) )
    {
        qDebug() << "Unable to open auth file";
        return false;
    }

    QByteArray data;
    QRegExp rx(
        QString( "((\\d|\\w| ){%1,%2}):((\\d|\\w){%3,%4}):" )
        .arg( LOGIN_LENGTH_MIN ).arg( LOGIN_LENGTH_MAX )
        .arg( PASSWORD_LENGTH_MIN ).arg( PASSWORD_LENGTH_MAX )
    );

    while( !af.atEnd() )
    {
        data = af.readLine();

        if( rx.indexIn( data ) == -1 )
            continue;

        if( login.compare(rx.cap(1)) == 0 )
        {
            af.close();

            if( password.compare(rx.cap(3)) == 0 )
                return true;

            return false;
        }
    }
    af.close();

    if( !af.open(QFile::Append) )
    {
        qDebug() << "Unable to open auth file";
        return false;
    }

    af.write( qPrintable(QString("%1:%2:\n").arg(login).arg(password)) );
    af.close();

    return true;
}
void IntegrationValues2<Scalar>::
evaluateValues(const PHX::MDField<Scalar,Cell,NODE,Dim>& in_node_coordinates,
               const PHX::MDField<Scalar,Cell,IP,Dim>& other_ip_coordinates)
{
    getCubature(in_node_coordinates);

    {
        // Determine the permutation.
        std::vector<size_type> permutation(other_ip_coordinates.dimension(1));
        permuteToOther(ip_coordinates, other_ip_coordinates, permutation);
        // Apply the permutation to the cubature arrays.
        MDFieldArrayFactory af(prefix, alloc_arrays);
        const size_type num_ip = dyn_cub_points.dimension(0);
        {
            const size_type num_dim = dyn_side_cub_points.dimension(1);
            DblArrayDynamic old_dyn_side_cub_points = af.template buildArray<double,IP,Dim>(
                        "old_dyn_side_cub_points", num_ip, num_dim);
            old_dyn_side_cub_points.deep_copy(dyn_side_cub_points);
            for (size_type ip = 0; ip < num_ip; ++ip)
                if (ip != permutation[ip])
                    for (size_type dim = 0; dim < num_dim; ++dim)
                        dyn_side_cub_points(ip, dim) = old_dyn_side_cub_points(permutation[ip], dim);
        }
        {
            const size_type num_dim = dyn_cub_points.dimension(1);
            DblArrayDynamic old_dyn_cub_points = af.template buildArray<double,IP,Dim>(
                    "old_dyn_cub_points", num_ip, num_dim);
            old_dyn_cub_points.deep_copy(dyn_cub_points);
            for (size_type ip = 0; ip < num_ip; ++ip)
                if (ip != permutation[ip])
                    for (size_type dim = 0; dim < num_dim; ++dim)
                        dyn_cub_points(ip, dim) = old_dyn_cub_points(permutation[ip], dim);
        }
        {
            DblArrayDynamic old_dyn_cub_weights = af.template buildArray<double,IP>(
                    "old_dyn_cub_weights", num_ip);
            old_dyn_cub_weights.deep_copy(dyn_cub_weights);
            for (size_type ip = 0; ip < dyn_cub_weights.dimension(0); ++ip)
                if (ip != permutation[ip])
                    dyn_cub_weights(ip) = old_dyn_cub_weights(permutation[ip]);
        }
        {
            const size_type num_cells = ip_coordinates.dimension(0), num_ip = ip_coordinates.dimension(1),
                            num_dim = ip_coordinates.dimension(2);
            Array_CellIPDim old_ip_coordinates = af.template buildStaticArray<Scalar,Cell,IP,Dim>(
                    "old_ip_coordinates", num_cells, num_ip, num_dim);
            Kokkos::deep_copy(old_ip_coordinates.get_kokkos_view(), ip_coordinates.get_kokkos_view());
            for (size_type cell = 0; cell < num_cells; ++cell)
                for (size_type ip = 0; ip < num_ip; ++ip)
                    if (ip != permutation[ip])
                        for (size_type dim = 0; dim < num_dim; ++dim)
                            ip_coordinates(cell, ip, dim) = old_ip_coordinates(cell, permutation[ip], dim);
        }
        // All subsequent calculations inherit the permutation.
    }

    evaluateRemainingValues(in_node_coordinates);
}
  TEUCHOS_UNIT_TEST(integration_values, volume)
  {
    PHX::KokkosDeviceSession session;
    
    Teuchos::RCP<shards::CellTopology> topo = 
       Teuchos::rcp(new shards::CellTopology(shards::getCellTopologyData< shards::Quadrilateral<4> >()));

    const int num_cells = 20;
    const int base_cell_dimension = 2;
    const panzer::CellData cell_data(num_cells,topo);

    const int cubature_degree = 2;    
    RCP<IntegrationRule> int_rule = 
      rcp(new IntegrationRule(cubature_degree, cell_data));
    
    panzer::IntegrationValues2<double> int_values("prefix_",true);
    panzer::MDFieldArrayFactory af("prefix_",true);

    int_values.setupArrays(int_rule);

    const int num_vertices = int_rule->topology->getNodeCount();
    PHX::MDField<double,Cell,NODE,Dim> node_coordinates 
        = af.buildStaticArray<double,Cell,NODE,Dim>("nc",num_cells, num_vertices, base_cell_dimension);

    // Set up node coordinates.  Here we assume the following
    // ordering.  This needs to be consistent with shards topology,
    // otherwise we will get negative determinates

    // 3(0,1)---2(1,1)
    //   |    0  |
    //   |       |
    // 0(0,0)---1(1,0)

    typedef panzer::ArrayTraits<double,PHX::MDField<double> >::size_type size_type;
    const size_type x = 0;
    const size_type y = 1;
    for (size_type cell = 0; cell < node_coordinates.dimension(0); ++cell) {
      node_coordinates(cell,0,x) = 0.0;
      node_coordinates(cell,0,y) = 0.0;
      node_coordinates(cell,1,x) = 1.0;
      node_coordinates(cell,1,y) = 0.0;
      node_coordinates(cell,2,x) = 1.0;
      node_coordinates(cell,2,y) = 1.0;
      node_coordinates(cell,3,x) = 0.0;
      node_coordinates(cell,3,y) = 1.0;
    }

    int_values.evaluateValues(node_coordinates);
    
    TEST_EQUALITY(int_values.ip_coordinates.dimension(1), 4);
    double realspace_x_coord = (1.0/std::sqrt(3.0) + 1.0) / 2.0;
    double realspace_y_coord = (1.0/std::sqrt(3.0) + 1.0) / 2.0;
    TEST_FLOATING_EQUALITY(int_values.ip_coordinates(0,0,0), 
                           realspace_x_coord, 1.0e-8);
    TEST_FLOATING_EQUALITY(int_values.ip_coordinates(0,0,1), 
                           realspace_y_coord, 1.0e-8);

  }
void IntegrationValues2<Scalar>::
setupArraysForNodeRule(const Teuchos::RCP<const panzer::IntegrationRule>& ir)
{
    MDFieldArrayFactory af(prefix,alloc_arrays);

    int num_nodes = ir->topology->getNodeCount();
    int num_cells = ir->workset_size;
    int num_space_dim = ir->topology->getDimension();

    int num_ip = 1;

    dyn_cub_points = af.template buildArray<double,IP,Dim>("cub_points",num_ip, num_space_dim);
    dyn_cub_weights = af.template buildArray<double,IP>("cub_weights",num_ip);

    cub_points = af.template buildStaticArray<Scalar,IP,Dim>("cub_points",num_ip, num_space_dim);

    if (ir->isSide()) {
        dyn_side_cub_points = af.template buildArray<double,IP,Dim>("side_cub_points",num_ip, ir->side_topology->getDimension());
        side_cub_points = af.template buildStaticArray<Scalar,IP,Dim>("side_cub_points",num_ip,ir->side_topology->getDimension());
    }

    if (ir->cv_type != "none") {
        dyn_phys_cub_points = af.template buildArray<double,Cell,IP,Dim>("phys_cub_points",num_cells, num_ip, num_space_dim);
        dyn_phys_cub_weights = af.template buildArray<double,Cell,IP>("phys_cub_weights",num_cells, num_ip);
        if (ir->cv_type == "side") {
            dyn_phys_cub_norms = af.template buildArray<double,Cell,IP,Dim>("phys_cub_norms",num_cells, num_ip, num_space_dim);
        }
    }

    dyn_node_coordinates = af.template buildArray<double,Cell,IP,Dim>("node_coordinates",num_cells, num_ip, num_space_dim);

    cub_weights = af.template buildStaticArray<Scalar,IP>("cub_weights",num_ip);

    node_coordinates = af.template buildStaticArray<Scalar,Cell,BASIS,Dim>("node_coordinates",num_cells, num_nodes, num_space_dim);

    jac = af.template buildStaticArray<Scalar,Cell,IP,Dim,Dim>("jac",num_cells, num_ip, num_space_dim,num_space_dim);

    jac_inv = af.template buildStaticArray<Scalar,Cell,IP,Dim,Dim>("jac_inv",num_cells, num_ip, num_space_dim,num_space_dim);

    jac_det = af.template buildStaticArray<Scalar,Cell,IP>("jac_det",num_cells, num_ip);

    weighted_measure =  af.template buildStaticArray<Scalar,Cell,IP>("weighted_measure",num_cells, num_ip);

    covarient = af.template buildStaticArray<Scalar,Cell,IP,Dim,Dim>("covarient",num_cells, num_ip, num_space_dim,num_space_dim);

    contravarient = af.template buildStaticArray<Scalar,Cell,IP,Dim,Dim>("contravarient",num_cells, num_ip, num_space_dim,num_space_dim);

    norm_contravarient = af.template buildStaticArray<Scalar,Cell,IP>("norm_contravarient",num_cells, num_ip);

    ip_coordinates = af.template buildStaticArray<Scalar,Cell,IP,Dim>("ip_coordiantes",num_cells, num_ip,num_space_dim);

    ref_ip_coordinates = af.template buildStaticArray<Scalar,Cell,IP,Dim>("ref_ip_coordinates",num_cells, num_ip,num_space_dim);

    weighted_normals = af.template buildStaticArray<Scalar,Cell,IP,Dim>("weighted normal",num_cells, num_ip,num_space_dim);

}
Beispiel #19
0
BOOL CContentCtrl::SetTextContent(LPCTSTR szContent, BOOL bResetSelection)
{
	CAutoFlag af(m_bSettingContent, TRUE);

	if (m_pContentCtrl)
		return m_pContentCtrl->SetTextContent(szContent, bResetSelection);

	// else
	return false;
}
// static
void GGaussianProcess::test()
{
	GAutoFilter af(new GGaussianProcess());
	af.basicTest(0.693, 0.94);
	af.clear();
	GGaussianProcess* pGP = new GGaussianProcess();
	pGP->setKernel(new GKernelGaussianRBF(0.2));
	GAutoFilter af2(pGP);
	af2.basicTest(0.67, 0.92);
}
Beispiel #21
0
void CRulerRichEdit::Paste(BOOL bSimple)
{
	if (!bSimple)
		CUrlRichEditCtrl::Paste();
	else
	{
		CAutoFlag af(m_bPasteSimple, TRUE);
		CUrlRichEditCtrl::Paste();
	}
}
Beispiel #22
0
BOOL CContentCtrl::SetContent(const unsigned char* pContent, int nLength, BOOL bResetSelection)
{
	CAutoFlag af(m_bSettingContent, TRUE);

	if (m_pContentCtrl)
		return m_pContentCtrl->SetContent((unsigned char*)pContent, nLength, bResetSelection);

	// else
	return false;
}
Beispiel #23
0
void
bf (void)
{
  void *p;
  {
    int i = 1;
    char v[i];
    p = af (v);
  }
  cf (p);
}
Beispiel #24
0
int graph::get_text_line(const st_cell& text,const g_size& sz_father)
{
	const stFont* font = get_font(text.font);
	if (!font)
		return 0;

	auto_free af(core::UTF8ToUnicode(text.text));
	if (af.ptr == 0)
		return 0;
	int line = get_text_line(text,sz_father,font,af.ptr);
	return line;
}
Beispiel #25
0
main()
{
	int first = 1;
	int second = 2;
	int third = 3;
	int fourth = 4;
	int fifth = 5;
	int ret;

	ret = af(first, second, third, fourth, fifth);

}
void AzTimeLog::printDouble2Logfile(const double weights[],const int len,const char* fn, const char* mod)
{
  stringstream s;
  for(int i=0;i<len;i++)
    s<< weights[i]<<" ";
  AzFile af(fn);
  af.open(mod);
  s<<"\r\n";
  int size = strlen(s.str().c_str());
  af.writeBytes(s.str().c_str(),size);
  s.str("");
}
Beispiel #27
0
g_size graph::get_text_size(const st_cell& text,const g_size& sz_father)
{
	const stFont* font = get_font(text.font);
	if (!font)
		return g_size(0,0);

	auto_free af(core::UTF8ToUnicode(text.text));
	if (af.ptr == 0)
		return g_size(0,0);
	g_size sz = get_text_size(text,sz_father,font,af.ptr);
	return sz;
}
Beispiel #28
0
 /**
  * @brief Constructor : create the factory and register it
  * @param[in] key type that factory can candle
  */
 ClassRegistrar(const KEY & key)
 {
     // create factory
     ::fwTools::IClassFactory::sptr  af( new ClassFactory< BASECLASS,SUBCLASS,KEY >(key) );
     // register it
     OSLM_DEBUG( "Class Factory Registration BaseClass= " << getString( af->baseClassId() )
             << " SubClass= " << ::fwTools::getString( af->subClassId() )
             << " KeyClass= " << ::fwTools::getString( af->keyId() )
             << " KeyValue= " << af->stringizedKey()
     );
     ::fwTools::ClassFactoryRegistry::addFactory( af );
 }
std::string Demangle(const std::string& Symbol) {
  struct AutoFree {
    char* Str;
    AutoFree(char* Ptr) : Str(Ptr) {}
    ~AutoFree() { ::free(Str); };
  };
  int status = 0;
  // Some implementations of __cxa_demangle are giving back length of allocation
  // Passing NULL for length seems to guarantee null termination.
  AutoFree af(abi::__cxa_demangle(Symbol.c_str(), NULL, NULL, &status));
  return status == 0 ? std::string(af.Str) : std::string();
}
Beispiel #30
0
void foo() {
  df1(&d);
  dg1(&d);
  dh1(&d);
  df2(&d);
  df3(&d);

  struct FA : A {
    void f() {}
  } fa;
  af(&fa);
}