本文整理匯總了C++中Empty函數的典型用法代碼示例。如果您正苦於以下問題:C++ Empty函數的具體用法?C++ Empty怎麽用?C++ Empty使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Empty函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: switch
int Panel::ProcessKey(int Key, unsigned int ControlState) {
switch (Key) {
case VK_F3:
if (ControlState == PKF_SHIFT) {
return true;
}
break;
case VK_F4:
switch (ControlState) {
case 0:
DlgShutdown();
return true;
case PKF_SHIFT:
return true;
}
break;
case VK_F6:
switch (ControlState) {
case 0:
if (DlgConnection()) {
psi.Control(this, FCTL_UPDATEPANEL, 0, nullptr);
psi.Control(this, FCTL_REDRAWPANEL, 0, nullptr);
}
return true;
case PKF_SHIFT:
try {
m_conn->Open(nullptr);
} catch (WinError &e) {
farebox_code(e.code(), e.where().c_str());
}
psi.Control(this, FCTL_UPDATEPANEL, 0, nullptr);
psi.Control(this, FCTL_REDRAWPANEL, 0, nullptr);
return true;
}
break;
case VK_F7:
switch (ControlState) {
case 0:
AutoUTF cmd = L"mstsc.exe";
if (!Empty(m_conn->host())) {
cmd += L" /v:";
cmd += m_conn->host();
}
ExecCMD(cmd);
return true;
}
break;
}
if ((ControlState == 0 && (Key == VK_F3 || Key == VK_F5 || Key == VK_F8)) ||
(ControlState == PKF_SHIFT && (Key == VK_F7 || Key == VK_F8))) {
FarPnl pInfo(this, FCTL_GETPANELINFO);
WinTS::iterator m_cur;
if (pInfo.ItemsNumber() && pInfo.CurrentItem() &&
(m_cur = std::find(m_ts.begin(), m_ts.end(), pInfo[pInfo.CurrentItem()].FindData.nFileSize)) != m_ts.end()) {
if (ControlState == 0 && Key == VK_F3) {
AutoUTF tmp(TempFile(TempDir()));
HANDLE hfile = ::CreateFileW(tmp.c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hfile != INVALID_HANDLE_VALUE) {
FileWrite(hfile, Info(m_cur));
::CloseHandle(hfile);
psi.Viewer(tmp.c_str(), nullptr, 0, 0, -1, -1,
VF_DELETEONLYFILEONCLOSE | VF_ENABLE_F6 | VF_DISABLEHISTORY |
VF_NONMODAL | VF_IMMEDIATERETURN, CP_AUTODETECT);
}
return true;
} else if (ControlState == 0 && Key == VK_F5) {
DlgMessage(m_cur->id());
} else if (ControlState == PKF_SHIFT && Key == VK_F7) {
WinTSession::ConnectLocal(m_cur->id());
} else if (ControlState == 0 && Key == VK_F8) {
if (farquestion(GetMsg(txtAreYouSure), GetMsg(txtDisconnectSession)))
WinTSession::Disconnect(m_cur->id(), m_conn->host());
} else if (ControlState == PKF_SHIFT && Key == VK_F8) {
if (farquestion(GetMsg(txtAreYouSure), GetMsg(txtLogoffSession)))
WinTSession::LogOff(m_cur->id(), m_conn->host());
}
psi.Control(this, FCTL_UPDATEPANEL, 0, nullptr);
psi.Control(this, FCTL_REDRAWPANEL, 0, nullptr);
return true;
}
}
return false;
}
示例2: ObjectGuid
bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
{
if (!arenaTeamMembersResult)
return false;
bool captainPresentInTeam = false;
do
{
Field* fields = arenaTeamMembersResult->Fetch();
// prevent crash if db records are broken, when all members in result are already processed and current team hasn't got any members
if (!fields)
break;
uint32 arenaTeamId = fields[0].GetUInt32();
if (arenaTeamId < m_TeamId)
{
// there is in table arena_team_member record which doesn't have arenateamid in arena_team table, report error
sLog.outErrorDb("ArenaTeam %u does not exist but it has record in arena_team_member table, deleting it!", arenaTeamId);
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", arenaTeamId);
continue;
}
if (arenaTeamId > m_TeamId)
// we loaded all members for this arena_team already, break cycle
break;
ArenaTeamMember newmember;
newmember.guid = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32());
newmember.games_week = fields[2].GetUInt32();
newmember.wins_week = fields[3].GetUInt32();
newmember.games_season = fields[4].GetUInt32();
newmember.wins_season = fields[5].GetUInt32();
newmember.personal_rating = fields[6].GetUInt32();
newmember.name = fields[7].GetCppString();
newmember.Class = fields[8].GetUInt8();
// check if member exists in characters table
if (newmember.name.empty())
{
sLog.outErrorDb("ArenaTeam %u has member with empty name - probably player %s doesn't exist, deleting him from memberlist!", arenaTeamId, newmember.guid.GetString().c_str());
DelMember(newmember.guid);
continue;
}
// arena team can't be > 2 * arenatype (2 for 2x2, 3 for 3x3, 5 for 5x5)
if (GetMembersSize() >= GetMaxMembersSize())
return false;
if (newmember.guid == GetCaptainGuid())
captainPresentInTeam = true;
m_members.push_back(newmember);
}
while (arenaTeamMembersResult->NextRow());
if (Empty() || !captainPresentInTeam)
{
// arena team is empty or captain is not in team, delete from db
sLog.outErrorDb("ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", m_TeamId);
return false;
}
return true;
}
示例3: AddError
//.........這裏部分代碼省略.........
pro = xpro;
xpro = NULL;
Clear( rx->follow );
for( i = 0; i < x->kersize; ++i ) {
ry = &x->name.state[i]->redun[at[i]];
if( ry->pro == pro ) {
Union( rx->follow, ry->follow );
++(at[i]);
++ry;
}
if( ry->pro > xpro ) {
xpro = ry->pro;
}
}
UnionAnd( conflict, rx->follow, defined );
Union( defined, rx->follow );
rx->pro = pro;
++rx;
}
xsym = NULL;
for( i = 0; i < x->kersize; ++i ) {
at[i] = 0;
if( (sym = x->name.state[i]->trans->sym) > xsym ) {
xsym = sym;
}
}
tx = trans;
while( xsym ) {
sym = xsym;
xsym = NULL;
t = s;
for( i = 0; i < x->kersize; ++i ) {
ty = &x->name.state[i]->trans[at[i]];
if( ty->sym == sym ) {
if( !IsMarked( *ty->state ) ) {
Mark( *ty->state );
*t++ = ty->state;
}
++(at[i]);
++ty;
}
if( ty->sym > xsym ) {
xsym = ty->sym;
}
}
tx->sym = sym;
if( sym->pro ) {
++nvtrans;
} else {
if( IsBitSet( defined, sym->id ) ) {
SetBit( conflict, sym->id );
while( --t >= s ) {
Unmark( **t );
}
continue;
} else {
SetBit( defined, sym->id );
}
}
tx->state = AddErrState( &errsym->enter, s, t );
++tx;
}
x->trans = CALLOC( tx - trans + 1, a_shift_action );
memcpy( x->trans, trans, ((char *) tx) - ((char *) trans) );
if( Empty( conflict ) ) {
redun->pro = NULL;
i = 0;
} else {
i = 1;
}
while( --rx > redun ) {
AndNot( rx->follow, conflict );
if( Empty( rx->follow ) ) {
rx->pro = NULL;
} else {
++i;
}
}
x->redun = CALLOC( i + 1, a_reduce_action );
if( i ) {
rset = CALLOC( i*wperset, a_word );
rx = redun;
while( i > 0 ) {
if( rx->pro ) {
--i;
x->redun[i].pro = rx->pro;
x->redun[i].follow = rset;
Assign( rset, rx->follow );
rset += wperset;
}
++rx;
}
}
}
free( trans );
free( redun );
free( conflict );
free( s );
free( at );
}
示例4: Empty
HDM::HDM()
{
Mnemonic = "HDM";
Empty();
}
示例6: peek
int peek(Stack* stack)
{
if (Empty(stack))
return INT_MIN;
return stack->array[stack->top];
}
示例7: Empty
Empty ReturnsEmpty::getEmpty()
{
return Empty();
}
示例8: Empty
CFX_ListCtrl::~CFX_ListCtrl() {
Empty();
}
示例9: Front
ValueType Front(void)
{
assert(!Empty());
return Element(_context, _current);
}
示例10: CalculateBlobOrder
void ResultIterator::CalculateBlobOrder(
GenericVector<int> *blob_indices) const {
bool context_is_ltr = current_paragraph_is_ltr_ ^ in_minor_direction_;
blob_indices->clear();
if (Empty(RIL_WORD)) return;
if (context_is_ltr || it_->word()->UnicharsInReadingOrder()) {
// Easy! just return the blobs in order;
for (int i = 0; i < word_length_; i++)
blob_indices->push_back(i);
return;
}
// The blobs are in left-to-right order, but the current reading context
// is right-to-left.
const int U_LTR = UNICHARSET::U_LEFT_TO_RIGHT;
const int U_RTL = UNICHARSET::U_RIGHT_TO_LEFT;
const int U_EURO_NUM = UNICHARSET::U_EUROPEAN_NUMBER;
const int U_EURO_NUM_SEP = UNICHARSET::U_EUROPEAN_NUMBER_SEPARATOR;
const int U_EURO_NUM_TERM = UNICHARSET::U_EUROPEAN_NUMBER_TERMINATOR;
const int U_COMMON_NUM_SEP = UNICHARSET::U_COMMON_NUMBER_SEPARATOR;
const int U_OTHER_NEUTRAL = UNICHARSET::U_OTHER_NEUTRAL;
// Step 1: Scan for and mark European Number sequences
// [:ET:]*[:EN:]+(([:ES:]|[:CS:])?[:EN:]+)*[:ET:]*
GenericVector<int> letter_types;
for (int i = 0; i < word_length_; i++) {
letter_types.push_back(it_->word()->SymbolDirection(i));
}
// Convert a single separtor sandwiched between two EN's into an EN.
for (int i = 0; i + 2 < word_length_; i++) {
if (letter_types[i] == U_EURO_NUM && letter_types[i + 2] == U_EURO_NUM &&
(letter_types[i + 1] == U_EURO_NUM_SEP ||
letter_types[i + 1] == U_COMMON_NUM_SEP)) {
letter_types[i + 1] = U_EURO_NUM;
}
}
// Scan for sequences of European Number Terminators around ENs and convert
// them to ENs.
for (int i = 0; i < word_length_; i++) {
if (letter_types[i] == U_EURO_NUM_TERM) {
int j = i + 1;
while (j < word_length_ && letter_types[j] == U_EURO_NUM_TERM) { j++; }
if (j < word_length_ && letter_types[j] == U_EURO_NUM) {
// The sequence [i..j] should be converted to all European Numbers.
for (int k = i; k < j; k++) letter_types[k] = U_EURO_NUM;
}
j = i - 1;
while (j > -1 && letter_types[j] == U_EURO_NUM_TERM) { j--; }
if (j > -1 && letter_types[j] == U_EURO_NUM) {
// The sequence [j..i] should be converted to all European Numbers.
for (int k = j; k <= i; k++) letter_types[k] = U_EURO_NUM;
}
}
}
// Step 2: Convert all remaining types to either L or R.
// Sequences ([:L:]|[:EN:])+ (([:CS:]|[:ON:])+ ([:L:]|[:EN:])+)* -> L.
// All other are R.
for (int i = 0; i < word_length_;) {
int ti = letter_types[i];
if (ti == U_LTR || ti == U_EURO_NUM) {
// Left to right sequence; scan to the end of it.
int last_good = i;
for (int j = i + 1; j < word_length_; j++) {
int tj = letter_types[j];
if (tj == U_LTR || tj == U_EURO_NUM) {
last_good = j;
} else if (tj == U_COMMON_NUM_SEP || tj == U_OTHER_NEUTRAL) {
// do nothing.
} else {
break;
}
}
// [i..last_good] is the L sequence
for (int k = i; k <= last_good; k++) letter_types[k] = U_LTR;
i = last_good + 1;
} else {
letter_types[i] = U_RTL;
i++;
}
}
// At this point, letter_types is entirely U_LTR or U_RTL.
for (int i = word_length_ - 1; i >= 0;) {
if (letter_types[i] == U_RTL) {
blob_indices->push_back(i);
i--;
} else {
// left to right sequence. scan to the beginning.
int j = i - 1;
for (; j >= 0 && letter_types[j] != U_RTL; j--) { } // pass
// Now (j, i] is LTR
for (int k = j + 1; k <= i; k++) blob_indices->push_back(k);
i = j;
}
}
ASSERT_HOST(blob_indices->size() == word_length_);
}
示例11: Next
void Next(void)
{
assert(!Empty());
++_current;
}
示例12: Empty
GraphType::~GraphType()
{
Empty();
}
示例13: Empty
SATELLITE_DATA::~SATELLITE_DATA()
{
Empty();
}
示例15: IsOneToken
bool TokenSection::IsOneToken() const
{
return !Empty() && Begin->next() == End;
}