当前位置: 首页>>代码示例>>C++>>正文


C++ Alert类代码示例

本文整理汇总了C++中Alert的典型用法代码示例。如果您正苦于以下问题:C++ Alert类的具体用法?C++ Alert怎么用?C++ Alert使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Alert类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: foutfile

void TailWin::Save(const char *cFileName)	// From AEdit
{
	static std::string cBuffer;
	TextView::buffer_type vLines;
   
	int iLineNo, iLineTotal=0;

	vLines=m_TextView->GetBuffer();
	iLineTotal=vLines.size();

	ofstream foutfile(cFileName);
   
	if(foutfile){
		for(iLineNo=0;iLineNo<iLineTotal;iLineNo++){
			cBuffer=m_TextView->GetBuffer()[iLineNo];
			foutfile << cBuffer << endl;
		}
	}

	else{
		//Open an error window

		Alert* sFileAlert = new Alert(STR_ERROR_SAVEFILE_TITLE, STR_ERROR_SAVEFILE_TEXT, 0x00, STR_ERROR_SAVEFILE_OKBUTTON.c_str(), NULL);
		sFileAlert->Go();
	}

	foutfile.close();

}
开发者ID:rickcaudill,项目名称:Pyro,代码行数:29,代码来源:tailwin.cpp

示例2: fopen

void LoginView::PopulateIcons()
{
 	try
 	{
 		FILE* fp = fopen("/etc/passwd","r");
 		struct passwd* psPwd;
  		int nIcon = 0;
  		while((psPwd = fgetpwent( fp )) != NULL ) 
  		{	
  			// Let's remove users that don't need to be there and then add them to the iconview
  			// System users (eg "www", "mail") have uids between 1 and 99. Filter them out.
			if( psPwd->pw_uid >= 100 || psPwd->pw_uid == 0 )
  			{
    			pcUserIconView->AddIcon(GetImageFromIcon(psPwd->pw_name),new IconData());
  				pcUserIconView->AddIconString(nIcon,psPwd->pw_name);
            	nIcon++;
            }	
  		}
		pcUserIconView->Layout();
  	}
  	
  	catch (...)
  	{
  		Alert* pcError = new Alert("Unable to load users","I am unable to load users, please contact the Syllable development group.",0x00,"Oh no!!!",NULL);
  		pcError->Go(new Invoker());
  	}	
}
开发者ID:rickcaudill,项目名称:Pyro,代码行数:27,代码来源:loginview.cpp

示例3: data

QString AlertSubscription::reminderMessage(Alert alert) const {
    const AlertSubscriptionData *d = data();
    QString rawMessage = d ? d->_reminderMessage : QString();
    if (rawMessage.isEmpty())
        rawMessage = "alert still raised: "+alert.idWithCount();
    AlertPseudoParamsProvider ppp = alert.pseudoParams();
    return d->_params.evaluate(rawMessage, &ppp);
}
开发者ID:g76r,项目名称:libqron,代码行数:8,代码来源:alertsubscription.cpp

示例4: switch

void IFaceWin::ApplyChanges( void )
{
	IFaceType_t nType = m_pcDdmType->GetCurrentString() == MSG_IFWIN_TYPE_STATIC ? Static : DHCP;
	bool bDefault = m_pcIFace->IsDefault();
	bool bError = false;

	switch ( nType )
	{
	case Static:
		{
			IPAddress_t nIP, nNM, nGW;
			String cError;

			if( !ParseIPAddress( m_pcTxtAddress->GetValue().AsString(  ), &nIP ) )
			{
				bError = true;
				cError = MSG_IFWIN_ERR_IP_ADDRESS;
			}
			else if( !ParseIPAddress( m_pcTxtNetmask->GetValue().AsString(  ), &nNM ) )
			{
				bError = true;
				cError = MSG_IFWIN_ERR_NETMASK;
			}
			else if( !ParseIPAddress( m_pcTxtGateway->GetValue().AsString(  ), &nGW ) )
			{
				bError = true;
				cError = MSG_IFWIN_ERR_GATEWAY;
			}

			if( bError )
			{
				Alert *pcAlert = new Alert( MSG_IFWIN_ERR_TITLE, cError, Alert::ALERT_WARNING, 0, MSG_IFWIN_ERR_CLOSE.c_str(), NULL );

				pcAlert->Go( new Invoker( new Message() ) );
			}
			else
			{
				m_pcIFace->SetAddress( nIP );
				m_pcIFace->SetNetmask( nNM );
				m_pcIFace->SetGateway( nGW );
			}
			break;
		}

	case DHCP:
		break;
	}

	if( !bError )
	{
		m_pcIFace->SetType( nType );
		m_pcIFace->SetEnabled( m_pcCbEnabled->GetValue().AsBool(  ) );
		m_pcIFace->SetDefault( bDefault );
		Messenger cMsnger( m_pcParent );

		cMsnger.SendMessage( new Message( ApplyInterfaceChanges ) );
	}
}
开发者ID:rickcaudill,项目名称:Pyro,代码行数:58,代码来源:IFaceWin.cpp

示例5:

QDebug operator<<(QDebug debug, const Alert &alert)
{
    if (alert.isValid()) {
        debug << "Snore::Alert(" << alert.name() << ")" ;
    } else {
        debug << "Snore::Alert(0x00)" ;
    }
    return debug.maybeSpace();
}
开发者ID:gaoxiaojun,项目名称:Snorenotify,代码行数:9,代码来源:alert.cpp

示例6: create

Alert* Alert::create(std::string header_msg, std::string sub_header_msg, std::string body_msg)
{
    Alert* alert = Alert::create();

    alert->set_header_str(header_msg);
    alert->set_sub_header_str(sub_header_msg);
    alert->set_body_str(body_msg);

    return alert;
};
开发者ID:tankorsmash,项目名称:BuildUpABase,代码行数:10,代码来源:Alert.cpp

示例7: Alert

void Address::DisplayAbout()
{
	String cTitle = (String)"About " + (String)PLUGIN_NAME + (String)"...";
	String cInfo = (String)"Version:  " +  (String)PLUGIN_VERSION + (String)"\n\nAuthor:   " + (String)PLUGIN_AUTHOR + (String)"\n\nDesc:      " + (String)PLUGIN_DESC;	
	
	Alert* pcAlert = new Alert(cTitle.c_str(),cInfo.c_str(),m_pcIcon->LockBitmap(),0,"_OK",NULL);
	m_pcIcon->UnlockBitmap();
	pcAlert->Go(new Invoker());
	pcAlert->MakeFocus();
}
开发者ID:rickcaudill,项目名称:Pyro,代码行数:10,代码来源:Address.cpp

示例8: Alert

void MainView::ShowAbout(void)
{
	Alert* sAbout = new Alert("sIRC 0.03",
		"sIRC 0.01\n\n"
		"Syllable Internet Relay Chat Client\n"
		"By James Coxon 2006\n"
		"[email protected]"
		,
		0x00, "Close", NULL);
	sAbout->Go(new Invoker);
}
开发者ID:peekaye,项目名称:Syllable-sIRC,代码行数:11,代码来源:sIRC32.cpp

示例9: getCommand

/*
 * Processes the initialization response. Returns 0 in case of success, an
 * error code in case of error.
 *
 * @param msg the response from the server
 */
int SyncMLProcessor::processServerAlert(SyncSource& source, SyncML* syncml) {

    int ret             = -1;
    int iterator        = 0;
    AbstractCommand* a  = NULL;
    bool found          = false;

    ret = 0;
    do {
        a = getCommand(syncml->getSyncBody(), ALERT, iterator);
        if (a == NULL) {
            // This happens with the Synthesis server's reply:
            // instead of sending SyncBody/Alert we get SyncBody/Put
            // with device infos and a SyncBody/Get requesting our own
            // device infos. Ignoring the request is not correct, but
            // allows synchronization to proceed and complete eventually
            // without any further errors. For that to work we must not
            // set lastErrorCode here, as it will be checked at the end of
            // the sync.
            //
            // lastErrorCode = ERR_REPRESENTATION;
            // sprintf(lastErrorMsg, "SyncBody/Alert not found!");
            goto finally;
        }
        Alert* alert = (Alert*)a;
        Item* item = NULL;
        ArrayList* itemList = alert->getItems();

        for (int i = 0; i < itemList->size(); i++) {
            item = (Item*)getArrayElement(itemList, i);
            const char *locURI = ((Target*)item->getTarget())->getLocURI();
            if (strcmp( locURI, _wcc(source.getName()) ) == 0) {
                if ( !alert->getData() ) {
                    setError(ERR_REPRESENTATION, "SyncBody/Alert/Data not found!");
                    goto finally;
                }

                source.setSyncMode((SyncMode)alert->getData());
                ret = 0;
                found = true;
                break;
            }
        }
        iterator++;
        if (found)
            break;

    } while(a);

finally:

    return ret;
}
开发者ID:ruphy,项目名称:kfunambol,代码行数:59,代码来源:SyncMLProcessor.cpp

示例10: switch

void DockCamera::HandleMessage(Message* pcMessage)
{
	switch (pcMessage->GetCode())
	{
		case M_CAMERA_ABOUT:
		{
			String cTitle = (String)"About " + (String)PLUGIN_NAME + (String)"...";
			String cInfo = (String)"Version:  " +  (String)PLUGIN_VERSION + (String)"\n\nAuthor:   " + (String)PLUGIN_AUTHOR + (String)"\n\nDesc:      " + (String)PLUGIN_DESC;	
			Alert* pcAlert = new Alert(cTitle.c_str(),cInfo.c_str(),m_pcIcon->LockBitmap(),0,"OK",NULL);
			pcAlert->Go(new Invoker());
			pcAlert->MakeFocus();
			break;
		}
		case M_PREFS:
		{
			ShowPrefs(m_pcPlugin->GetPath());
			break;
		}
		
		case M_PREFS_SEND_TO_PARENT:
		{
			pcMessage->FindFloat("click",&vClick);
			pcMessage->FindFloat("key/instant",&vInstant);
			pcMessage->FindFloat("key/delay",&vDelay);
			pcMessage->FindFloat("delay",&vDelayTime);
			SaveSettings();
			LoadSettings();
			pcPrefsWin->Close();
			pcPrefsWin = NULL;			
		
			break;
		}
		
		case M_PRINT_SCREEN:
		{
			if (bFirst)
			{
				bFirst = false;
			}
			else
			{	
				pcCameraDelayedLooper->AddTimer(pcCameraDelayedLooper,CAMERA_ID,0);
			}
			break;
		}		
	}
}
开发者ID:rickcaudill,项目名称:Pyro,代码行数:47,代码来源:Camera.cpp

示例11: sendAlert

// send alert
int sendAlert(SSL& ssl, const Alert& alert)
{
    output_buffer out;
    buildAlert(ssl, out, alert);
    ssl.Send(out.get_buffer(), out.get_size());

    return alert.get_length();
}
开发者ID:hans511002,项目名称:erydb,代码行数:9,代码来源:handshake.cpp

示例12: run

 void run() {
   while (!isInterruptionRequested()) {
     Alert alert;
     if (_buffer.tryGet(&alert, 500)) {
       ++_gridboardsEvaluationsCounter;
       QList<Gridboard> &gridboards = _alerter->_gridboards.lockData();
       for (int i = 0; i < gridboards.size(); ++i) {
         QRegularExpressionMatch match =
             gridboards[i].patternRegexp().match(alert.id());
         if (match.hasMatch()) {
           ++_gridboardsUpdatesCounter;
           gridboards[i].update(match, alert);
         }
       }
       _alerter->_gridboards.unlockData();
     }
   }
 }
开发者ID:g76r,项目名称:libqron,代码行数:18,代码来源:alerter.cpp

示例13: set_thread_priority

void Address::ExecuteBrowser(const String& cUrl)
{
	int nError=0;
	
	if (fork() == 0)
	{
		set_thread_priority( -1, 0 );
		nError = execlp("/Applications/Webster/Webster","/Applications/Webster/Webster",cUrl.c_str(),NULL);	
	}	
	
	if (nError == -1)
	{
		if (errno == ENOENT)
		{
			Alert* pcAlert = new Alert("Address...","Could not find Webster browser.",m_pcIcon->LockBitmap(),0,"_OK",NULL);
			m_pcIcon->UnlockBitmap();
			pcAlert->CenterInScreen();
			pcAlert->Go(new Invoker());	
		}
		else
		{
			Alert* pcAlert = new Alert("Address...","Error launching Webster browser.",m_pcIcon->LockBitmap(),0,"_OK",NULL);
			m_pcIcon->UnlockBitmap();
			pcAlert->CenterInScreen();
			pcAlert->Go(new Invoker());	
		}
	}
	
}
开发者ID:rickcaudill,项目名称:Pyro,代码行数:29,代码来源:Address.cpp

示例14: switch

void LogAlertChannel::doNotifyAlert(Alert alert) {
    switch(alert.status()) {
    case Alert::Nonexistent:
    case Alert::Raised:
        if (!alert.subscription().notifyEmit())
            return;
        Log::log(alert.subscription().emitMessage(alert),
                 Log::severityFromString(alert.subscription().address(alert)));
        break;
    case Alert::Canceled:
        if (!alert.subscription().notifyCancel())
            return;
        Log::log(alert.subscription().cancelMessage(alert),
                 Log::severityFromString(alert.subscription().address(alert)));
        break;
    case Alert::Rising:
    case Alert::MayRise:
    case Alert::Dropping:
        ; // should never happen
    }
}
开发者ID:g76r,项目名称:libqron,代码行数:21,代码来源:logalertchannel.cpp

示例15: TEST

TEST(AnomalyTrackerTest, TestConsecutiveBuckets) {
    const int64_t bucketSizeNs = 30 * NS_PER_SEC;
    const int32_t refractoryPeriodSec = 2 * bucketSizeNs / NS_PER_SEC;
    Alert alert;
    alert.set_num_buckets(3);
    alert.set_refractory_period_secs(refractoryPeriodSec);
    alert.set_trigger_if_sum_gt(2);

    AnomalyTracker anomalyTracker(alert, kConfigKey);
    MetricDimensionKey keyA = getMockMetricDimensionKey(1, "a");
    MetricDimensionKey keyB = getMockMetricDimensionKey(1, "b");
    MetricDimensionKey keyC = getMockMetricDimensionKey(1, "c");

    int64_t eventTimestamp0 = 10 * NS_PER_SEC;
    int64_t eventTimestamp1 = bucketSizeNs + 11 * NS_PER_SEC;
    int64_t eventTimestamp2 = 2 * bucketSizeNs + 12 * NS_PER_SEC;
    int64_t eventTimestamp3 = 3 * bucketSizeNs + 13 * NS_PER_SEC;
    int64_t eventTimestamp4 = 4 * bucketSizeNs + 14 * NS_PER_SEC;
    int64_t eventTimestamp5 = 5 * bucketSizeNs + 5 * NS_PER_SEC;
    int64_t eventTimestamp6 = 6 * bucketSizeNs + 16 * NS_PER_SEC;

    std::shared_ptr<DimToValMap> bucket0 = MockBucket({{keyA, 1}, {keyB, 2}, {keyC, 1}});
    std::shared_ptr<DimToValMap> bucket1 = MockBucket({{keyA, 1}});
    std::shared_ptr<DimToValMap> bucket2 = MockBucket({{keyB, 1}});
    std::shared_ptr<DimToValMap> bucket3 = MockBucket({{keyA, 2}});
    std::shared_ptr<DimToValMap> bucket4 = MockBucket({{keyB, 5}});
    std::shared_ptr<DimToValMap> bucket5 = MockBucket({{keyA, 2}});
    std::shared_ptr<DimToValMap> bucket6 = MockBucket({{keyA, 2}});

    // Start time with no events.
    EXPECT_EQ(anomalyTracker.mSumOverPastBuckets.size(), 0u);
    EXPECT_EQ(anomalyTracker.mMostRecentBucketNum, -1LL);

    // Event from bucket #0 occurs.
    EXPECT_TRUE(detectAnomaliesPass(anomalyTracker, 0, bucket0, {}, {keyA, keyB, keyC}));
    detectAndDeclareAnomalies(anomalyTracker, 0, bucket0, eventTimestamp1);
    checkRefractoryTimes(anomalyTracker, eventTimestamp0, refractoryPeriodSec,
            {{keyA, -1}, {keyB, -1}, {keyC, -1}});

    // Adds past bucket #0
    anomalyTracker.addPastBucket(bucket0, 0);
    EXPECT_EQ(anomalyTracker.mSumOverPastBuckets.size(), 3u);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyA), 1LL);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyB), 2LL);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyC), 1LL);
    EXPECT_EQ(anomalyTracker.mMostRecentBucketNum, 0LL);

    // Event from bucket #1 occurs.
    EXPECT_TRUE(detectAnomaliesPass(anomalyTracker, 1, bucket1, {}, {keyA, keyB, keyC}));
    detectAndDeclareAnomalies(anomalyTracker, 1, bucket1, eventTimestamp1);
    checkRefractoryTimes(anomalyTracker, eventTimestamp1, refractoryPeriodSec,
            {{keyA, -1}, {keyB, -1}, {keyC, -1}});

    // Adds past bucket #0 again. The sum does not change.
    anomalyTracker.addPastBucket(bucket0, 0);
    EXPECT_EQ(anomalyTracker.mSumOverPastBuckets.size(), 3u);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyA), 1LL);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyB), 2LL);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyC), 1LL);
    EXPECT_EQ(anomalyTracker.mMostRecentBucketNum, 0LL);
    EXPECT_TRUE(detectAnomaliesPass(anomalyTracker, 1, bucket1, {}, {keyA, keyB, keyC}));
    detectAndDeclareAnomalies(anomalyTracker, 1, bucket1, eventTimestamp1 + 1);
    checkRefractoryTimes(anomalyTracker, eventTimestamp1, refractoryPeriodSec,
            {{keyA, -1}, {keyB, -1}, {keyC, -1}});

    // Adds past bucket #1.
    anomalyTracker.addPastBucket(bucket1, 1);
    EXPECT_EQ(anomalyTracker.mMostRecentBucketNum, 1L);
    EXPECT_EQ(anomalyTracker.mSumOverPastBuckets.size(), 3UL);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyA), 2LL);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyB), 2LL);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyC), 1LL);

    // Event from bucket #2 occurs. New anomaly on keyB.
    EXPECT_TRUE(detectAnomaliesPass(anomalyTracker, 2, bucket2, {keyB}, {keyA, keyC}));
    detectAndDeclareAnomalies(anomalyTracker, 2, bucket2, eventTimestamp2);
    checkRefractoryTimes(anomalyTracker, eventTimestamp2, refractoryPeriodSec,
            {{keyA, -1}, {keyB, eventTimestamp2}, {keyC, -1}});

    // Adds past bucket #1 again. Nothing changes.
    anomalyTracker.addPastBucket(bucket1, 1);
    EXPECT_EQ(anomalyTracker.mMostRecentBucketNum, 1L);
    EXPECT_EQ(anomalyTracker.mSumOverPastBuckets.size(), 3UL);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyA), 2LL);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyB), 2LL);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyC), 1LL);
    // Event from bucket #2 occurs (again).
    EXPECT_TRUE(detectAnomaliesPass(anomalyTracker, 2, bucket2, {keyB}, {keyA, keyC}));
    detectAndDeclareAnomalies(anomalyTracker, 2, bucket2, eventTimestamp2 + 1);
    checkRefractoryTimes(anomalyTracker, eventTimestamp2, refractoryPeriodSec,
            {{keyA, -1}, {keyB, eventTimestamp2}, {keyC, -1}});

    // Adds past bucket #2.
    anomalyTracker.addPastBucket(bucket2, 2);
    EXPECT_EQ(anomalyTracker.mMostRecentBucketNum, 2L);
    EXPECT_EQ(anomalyTracker.mSumOverPastBuckets.size(), 2UL);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyA), 1LL);
    EXPECT_EQ(anomalyTracker.getSumOverPastBuckets(keyB), 1LL);

    // Event from bucket #3 occurs. New anomaly on keyA.
//.........这里部分代码省略.........
开发者ID:Dark98,项目名称:platform_frameworks_base,代码行数:101,代码来源:AnomalyTracker_test.cpp


注:本文中的Alert类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。